/
sentencepiece_model.pb.go
1497 lines (1359 loc) · 66.5 KB
/
sentencepiece_model.pb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2016 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.!
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.32.0
// protoc v4.25.2
// source: sentencepiece_model.proto
package sentencepiece
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Model type. only have UNIGRAM now.
type TrainerSpec_ModelType int32
const (
TrainerSpec_UNIGRAM TrainerSpec_ModelType = 1 // Unigram language model with dynamic algorithm
TrainerSpec_BPE TrainerSpec_ModelType = 2 // Byte Pair Encoding
TrainerSpec_WORD TrainerSpec_ModelType = 3 // Delimitered by whitespace.
TrainerSpec_CHAR TrainerSpec_ModelType = 4 // tokenizes into character sequence
)
// Enum value maps for TrainerSpec_ModelType.
var (
TrainerSpec_ModelType_name = map[int32]string{
1: "UNIGRAM",
2: "BPE",
3: "WORD",
4: "CHAR",
}
TrainerSpec_ModelType_value = map[string]int32{
"UNIGRAM": 1,
"BPE": 2,
"WORD": 3,
"CHAR": 4,
}
)
func (x TrainerSpec_ModelType) Enum() *TrainerSpec_ModelType {
p := new(TrainerSpec_ModelType)
*p = x
return p
}
func (x TrainerSpec_ModelType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (TrainerSpec_ModelType) Descriptor() protoreflect.EnumDescriptor {
return file_sentencepiece_model_proto_enumTypes[0].Descriptor()
}
func (TrainerSpec_ModelType) Type() protoreflect.EnumType {
return &file_sentencepiece_model_proto_enumTypes[0]
}
func (x TrainerSpec_ModelType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Do not use.
func (x *TrainerSpec_ModelType) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)
if err != nil {
return err
}
*x = TrainerSpec_ModelType(num)
return nil
}
// Deprecated: Use TrainerSpec_ModelType.Descriptor instead.
func (TrainerSpec_ModelType) EnumDescriptor() ([]byte, []int) {
return file_sentencepiece_model_proto_rawDescGZIP(), []int{0, 0}
}
type ModelProto_SentencePiece_Type int32
const (
ModelProto_SentencePiece_NORMAL ModelProto_SentencePiece_Type = 1 // normal symbol
ModelProto_SentencePiece_UNKNOWN ModelProto_SentencePiece_Type = 2 // unknown symbol. only <unk> for now.
ModelProto_SentencePiece_CONTROL ModelProto_SentencePiece_Type = 3 // control symbols. </s>, <s>, <2ja> etc.
ModelProto_SentencePiece_USER_DEFINED ModelProto_SentencePiece_Type = 4 // user defined symbols.
// Typical usage of USER_DEFINED symbol
// is placeholder.
ModelProto_SentencePiece_BYTE ModelProto_SentencePiece_Type = 6 // byte symbols. Used when `byte_fallback` is true.
ModelProto_SentencePiece_UNUSED ModelProto_SentencePiece_Type = 5 // this piece is not used.
)
// Enum value maps for ModelProto_SentencePiece_Type.
var (
ModelProto_SentencePiece_Type_name = map[int32]string{
1: "NORMAL",
2: "UNKNOWN",
3: "CONTROL",
4: "USER_DEFINED",
6: "BYTE",
5: "UNUSED",
}
ModelProto_SentencePiece_Type_value = map[string]int32{
"NORMAL": 1,
"UNKNOWN": 2,
"CONTROL": 3,
"USER_DEFINED": 4,
"BYTE": 6,
"UNUSED": 5,
}
)
func (x ModelProto_SentencePiece_Type) Enum() *ModelProto_SentencePiece_Type {
p := new(ModelProto_SentencePiece_Type)
*p = x
return p
}
func (x ModelProto_SentencePiece_Type) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (ModelProto_SentencePiece_Type) Descriptor() protoreflect.EnumDescriptor {
return file_sentencepiece_model_proto_enumTypes[1].Descriptor()
}
func (ModelProto_SentencePiece_Type) Type() protoreflect.EnumType {
return &file_sentencepiece_model_proto_enumTypes[1]
}
func (x ModelProto_SentencePiece_Type) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Do not use.
func (x *ModelProto_SentencePiece_Type) UnmarshalJSON(b []byte) error {
num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)
if err != nil {
return err
}
*x = ModelProto_SentencePiece_Type(num)
return nil
}
// Deprecated: Use ModelProto_SentencePiece_Type.Descriptor instead.
func (ModelProto_SentencePiece_Type) EnumDescriptor() ([]byte, []int) {
return file_sentencepiece_model_proto_rawDescGZIP(), []int{3, 0, 0}
}
// TrainerSpec encodes a various parameters for SentencePiece training.
// Next id: 55
type TrainerSpec struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
extensionFields protoimpl.ExtensionFields
// /////////////////////////////////////////////////////////////////
// General parameters
//
// Input corpus files.
//
// Trainer accepts the following two formats:
// A) Monolingual: plain text, one sentence per line.
// B) Bilingual: TSV, source sentence <tab> target sentence
// When bilingual data is passed, shared vocabulary model is built.
// Note that the input file must be raw corpus, not a preprocessed corpus.
// Trainer only loads the first `input_sentence_size` sentences specified
// with this parameter.
Input []string `protobuf:"bytes,1,rep,name=input" json:"input,omitempty"`
// Input corpus format:
// "text": one-sentence-per-line text format (default)
// "tsv": sentence <tab> freq
InputFormat *string `protobuf:"bytes,7,opt,name=input_format,json=inputFormat" json:"input_format,omitempty"`
// Output model file prefix.
// <model_prefix>.model and <model_prefix>.vocab are generated.
ModelPrefix *string `protobuf:"bytes,2,opt,name=model_prefix,json=modelPrefix" json:"model_prefix,omitempty"`
ModelType *TrainerSpec_ModelType `protobuf:"varint,3,opt,name=model_type,json=modelType,enum=sentencepiece.TrainerSpec_ModelType,def=1" json:"model_type,omitempty"`
// Vocabulary size. 8k is the default size.
VocabSize *int32 `protobuf:"varint,4,opt,name=vocab_size,json=vocabSize,def=8000" json:"vocab_size,omitempty"`
// List of the languages this model can accept.
// Since the model is language-agnostic, this field is used as a reference.
AcceptLanguage []string `protobuf:"bytes,5,rep,name=accept_language,json=acceptLanguage" json:"accept_language,omitempty"`
// Size of self-test samples, which are encoded in the model file.
SelfTestSampleSize *int32 `protobuf:"varint,6,opt,name=self_test_sample_size,json=selfTestSampleSize,def=0" json:"self_test_sample_size,omitempty"`
// Whether to use DP version of sentencepiece. Use it with TSV input format
// (requires precomputed word tab counts to work).
EnableDifferentialPrivacy *bool `protobuf:"varint,50,opt,name=enable_differential_privacy,json=enableDifferentialPrivacy,def=0" json:"enable_differential_privacy,omitempty"`
// Set these parameters if you need DP version of sentencepiece.
// std of noise to add.
DifferentialPrivacyNoiseLevel *float32 `protobuf:"fixed32,51,opt,name=differential_privacy_noise_level,json=differentialPrivacyNoiseLevel,def=0" json:"differential_privacy_noise_level,omitempty"`
// Clipping threshold to apply after adding noise. All the words with
// frequency less than this value are dropped.
DifferentialPrivacyClippingThreshold *uint64 `protobuf:"varint,52,opt,name=differential_privacy_clipping_threshold,json=differentialPrivacyClippingThreshold,def=0" json:"differential_privacy_clipping_threshold,omitempty"`
// /////////////////////////////////////////////////////////////////
// Training parameters.
//
// Uses characters which cover the corpus with the ratio of `chars_coverage`.
// This parameter determines the set of basic Alphabet of sentence piece.
// 1.0 - `chars_coverage` characters are treated as UNK.
// See also required_chars field.
CharacterCoverage *float32 `protobuf:"fixed32,10,opt,name=character_coverage,json=characterCoverage,def=0.9995" json:"character_coverage,omitempty"`
// Maximum size of sentences the trainer loads from `input` parameter.
// Trainer simply loads the `input` files in sequence.
// It is better to shuffle the input corpus randomly.
InputSentenceSize *uint64 `protobuf:"varint,11,opt,name=input_sentence_size,json=inputSentenceSize,def=0" json:"input_sentence_size,omitempty"`
ShuffleInputSentence *bool `protobuf:"varint,19,opt,name=shuffle_input_sentence,json=shuffleInputSentence,def=1" json:"shuffle_input_sentence,omitempty"`
// Maximum size of sentences to make seed sentence pieces.
// Extended suffix array is constructed to extract frequent
// sub-strings from the corpus. This uses 20N working space,
// where N is the size of corpus.
//
// Deprecated: Marked as deprecated in sentencepiece_model.proto.
MiningSentenceSize *int32 `protobuf:"varint,12,opt,name=mining_sentence_size,json=miningSentenceSize" json:"mining_sentence_size,omitempty"`
// Maximum size of sentences to train sentence pieces.
//
// Deprecated: Marked as deprecated in sentencepiece_model.proto.
TrainingSentenceSize *int32 `protobuf:"varint,13,opt,name=training_sentence_size,json=trainingSentenceSize" json:"training_sentence_size,omitempty"`
// The size of seed sentencepieces.
// `seed_sentencepiece_size` must be larger than `vocab_size`.
SeedSentencepieceSize *int32 `protobuf:"varint,14,opt,name=seed_sentencepiece_size,json=seedSentencepieceSize,def=1000000" json:"seed_sentencepiece_size,omitempty"`
// In every EM sub-iterations, keeps top
// `shrinking_factor` * `current sentencepieces size` with respect to
// the loss of the sentence piece. This value should be smaller than 1.0.
ShrinkingFactor *float32 `protobuf:"fixed32,15,opt,name=shrinking_factor,json=shrinkingFactor,def=0.75" json:"shrinking_factor,omitempty"`
// The maximum sentence length in byte. The sentences with the length
// larger than `max_sentence_length` is simply ignored.
// Longer input tends to bring the following risks:
// - Overflow during EM training (unigram language model only)
// - Performance drop because of O(n log n) cost in BPE.
MaxSentenceLength *int32 `protobuf:"varint,18,opt,name=max_sentence_length,json=maxSentenceLength,def=4192" json:"max_sentence_length,omitempty"`
// Number of threads in the training.
NumThreads *int32 `protobuf:"varint,16,opt,name=num_threads,json=numThreads,def=16" json:"num_threads,omitempty"`
// Number of EM sub iterations.
NumSubIterations *int32 `protobuf:"varint,17,opt,name=num_sub_iterations,json=numSubIterations,def=2" json:"num_sub_iterations,omitempty"`
// /////////////////////////////////////////////////////////////////
// SentencePiece parameters which control the shapes of sentence piece.
//
// Maximum length of sentencepiece.
MaxSentencepieceLength *int32 `protobuf:"varint,20,opt,name=max_sentencepiece_length,json=maxSentencepieceLength,def=16" json:"max_sentencepiece_length,omitempty"`
// Uses Unicode script to split sentence pieces.
// When `split_by_unicode_script` is true, we do not allow sentence piece to
// include multiple Unicode scripts, e.g. "F1" is not a valid piece.
// Exception: CJ characters (Hiragana/Katakana/Han) are all handled
// as one script type, since Japanese word can consist of multiple scripts.
// This exception is always applied regardless of the accept-language
// parameter.
SplitByUnicodeScript *bool `protobuf:"varint,21,opt,name=split_by_unicode_script,json=splitByUnicodeScript,def=1" json:"split_by_unicode_script,omitempty"`
// When `split_by_number` is true, put a boundary between number and
// non-number transition. If we want to treat "F1" is one token, set this flag
// to be false.
SplitByNumber *bool `protobuf:"varint,23,opt,name=split_by_number,json=splitByNumber,def=1" json:"split_by_number,omitempty"`
// Use a white space to split sentence pieces.
// When `split_by_whitespace` is false, we may have the piece containing
// a white space in the middle. e.g., "in_the".
SplitByWhitespace *bool `protobuf:"varint,22,opt,name=split_by_whitespace,json=splitByWhitespace,def=1" json:"split_by_whitespace,omitempty"`
// Adds whitespace symbol (_) as a suffix instead of prefix. e.g., _hello =>
// hello_. When `treat_whitespace_as_suffix` is true,
// NormalizerSpec::add_dummy_prefix will add the dummy whitespace to the end
// of sentence.
TreatWhitespaceAsSuffix *bool `protobuf:"varint,24,opt,name=treat_whitespace_as_suffix,json=treatWhitespaceAsSuffix,def=0" json:"treat_whitespace_as_suffix,omitempty"`
// Allows pieces that only contain whitespaces instead of appearing only as
// prefix or suffix of other pieces.
AllowWhitespaceOnlyPieces *bool `protobuf:"varint,26,opt,name=allow_whitespace_only_pieces,json=allowWhitespaceOnlyPieces,def=0" json:"allow_whitespace_only_pieces,omitempty"`
// Split all digits (0-9) into separate pieces.
SplitDigits *bool `protobuf:"varint,25,opt,name=split_digits,json=splitDigits,def=0" json:"split_digits,omitempty"`
// Defines the pre-tokenization delimiter.
// When specified, no pieces crossing this delimiter is not included
// in the vocab. Then the delimiter string is virtually ignored
// during the training. This field can allows constraints on the vocabulary
// selection. Note that this field is available on unigram mode.
PretokenizationDelimiter *string `protobuf:"bytes,53,opt,name=pretokenization_delimiter,json=pretokenizationDelimiter,def=" json:"pretokenization_delimiter,omitempty"`
// /////////////////////////////////////////////////////////////////
// Vocabulary management
//
// Defines control symbols used as an indicator to
// change the behavior of the decoder. <s> and </s> are pre-defined.
// We can use this field to encode various meta information,
// including language indicator in multilingual model.
// These symbols are not visible to users, but visible to
// the decoder. Note that when the input sentence contains control symbols,
// they are not treated as one token, but segmented into normal pieces.
// Control symbols must be inserted independently from the segmentation.
ControlSymbols []string `protobuf:"bytes,30,rep,name=control_symbols,json=controlSymbols" json:"control_symbols,omitempty"`
// Defines user defined symbols.
// These symbols are added with extremely high score
// so they are always treated as one unique symbol in any context.
// Typical usage of user_defined_symbols is placeholder for named entities.
UserDefinedSymbols []string `protobuf:"bytes,31,rep,name=user_defined_symbols,json=userDefinedSymbols" json:"user_defined_symbols,omitempty"`
// Defines required characters. Each UTF8 character in this string is included
// in the character set regardless of character_coverage value. Unlike
// user_defined_symbols, these characters have scores based on the frequency
// on input sentences, and the model can form subwords using characters
// in this field.
RequiredChars *string `protobuf:"bytes,36,opt,name=required_chars,json=requiredChars" json:"required_chars,omitempty"`
// Decomposes unknown pieces into UTF-8 bytes.
ByteFallback *bool `protobuf:"varint,35,opt,name=byte_fallback,json=byteFallback,def=0" json:"byte_fallback,omitempty"`
// When creating the vocabulary file, defines whether or not to additionally
// output the score for each piece.
VocabularyOutputPieceScore *bool `protobuf:"varint,32,opt,name=vocabulary_output_piece_score,json=vocabularyOutputPieceScore,def=1" json:"vocabulary_output_piece_score,omitempty"`
// `vocab_size` is treated as hard limit. Crash if
// the model can not produce the vocab of size `vocab_size`,
// When `hard_vocab_limit` is false, vocab_size is treated
// as soft limit. Note that when model_type=char,
// always assumes hard_vocab_limit = false.
HardVocabLimit *bool `protobuf:"varint,33,opt,name=hard_vocab_limit,json=hardVocabLimit,def=1" json:"hard_vocab_limit,omitempty"`
// use all symbols for vocab extraction. This flag is valid
// if model type is either CHAR or WORD
UseAllVocab *bool `protobuf:"varint,34,opt,name=use_all_vocab,json=useAllVocab,def=0" json:"use_all_vocab,omitempty"`
// /////////////////////////////////////////////////////////////////
// Reserved special meta tokens.
// * -1 is not used.
// * unk_id must not be -1.
// Id must starts with 0 and be contigous.
UnkId *int32 `protobuf:"varint,40,opt,name=unk_id,json=unkId,def=0" json:"unk_id,omitempty"` // <unk>
BosId *int32 `protobuf:"varint,41,opt,name=bos_id,json=bosId,def=1" json:"bos_id,omitempty"` // <s>
EosId *int32 `protobuf:"varint,42,opt,name=eos_id,json=eosId,def=2" json:"eos_id,omitempty"` // </s>
PadId *int32 `protobuf:"varint,43,opt,name=pad_id,json=padId,def=-1" json:"pad_id,omitempty"` // <pad> (padding)
UnkPiece *string `protobuf:"bytes,45,opt,name=unk_piece,json=unkPiece,def=<unk>" json:"unk_piece,omitempty"`
BosPiece *string `protobuf:"bytes,46,opt,name=bos_piece,json=bosPiece,def=<s>" json:"bos_piece,omitempty"`
EosPiece *string `protobuf:"bytes,47,opt,name=eos_piece,json=eosPiece,def=</s>" json:"eos_piece,omitempty"`
PadPiece *string `protobuf:"bytes,48,opt,name=pad_piece,json=padPiece,def=<pad>" json:"pad_piece,omitempty"`
// Encodes <unk> into U+2047 (DOUBLE QUESTION MARK),
// since this character can be useful both for user and
// developer. We can easily figure out that <unk> is emitted.
UnkSurface *string `protobuf:"bytes,44,opt,name=unk_surface,json=unkSurface,def= ⁇ " json:"unk_surface,omitempty"`
// Increase bit depth to allow unigram model training on large
// (>10M sentences) corpora. A Side-effect of enabling this flag
// is increased memory usage.
TrainExtremelyLargeCorpus *bool `protobuf:"varint,49,opt,name=train_extremely_large_corpus,json=trainExtremelyLargeCorpus,def=0" json:"train_extremely_large_corpus,omitempty"`
// Path to a seed sentencepieces file, with one tab-separated
// seed sentencepiece <tab> frequency per line.
SeedSentencepiecesFile *string `protobuf:"bytes,54,opt,name=seed_sentencepieces_file,json=seedSentencepiecesFile,def=" json:"seed_sentencepieces_file,omitempty"`
}
// Default values for TrainerSpec fields.
const (
Default_TrainerSpec_ModelType = TrainerSpec_UNIGRAM
Default_TrainerSpec_VocabSize = int32(8000)
Default_TrainerSpec_SelfTestSampleSize = int32(0)
Default_TrainerSpec_EnableDifferentialPrivacy = bool(false)
Default_TrainerSpec_DifferentialPrivacyNoiseLevel = float32(0)
Default_TrainerSpec_DifferentialPrivacyClippingThreshold = uint64(0)
Default_TrainerSpec_CharacterCoverage = float32(0.9994999766349792)
Default_TrainerSpec_InputSentenceSize = uint64(0)
Default_TrainerSpec_ShuffleInputSentence = bool(true)
Default_TrainerSpec_SeedSentencepieceSize = int32(1000000)
Default_TrainerSpec_ShrinkingFactor = float32(0.75)
Default_TrainerSpec_MaxSentenceLength = int32(4192)
Default_TrainerSpec_NumThreads = int32(16)
Default_TrainerSpec_NumSubIterations = int32(2)
Default_TrainerSpec_MaxSentencepieceLength = int32(16)
Default_TrainerSpec_SplitByUnicodeScript = bool(true)
Default_TrainerSpec_SplitByNumber = bool(true)
Default_TrainerSpec_SplitByWhitespace = bool(true)
Default_TrainerSpec_TreatWhitespaceAsSuffix = bool(false)
Default_TrainerSpec_AllowWhitespaceOnlyPieces = bool(false)
Default_TrainerSpec_SplitDigits = bool(false)
Default_TrainerSpec_PretokenizationDelimiter = string("")
Default_TrainerSpec_ByteFallback = bool(false)
Default_TrainerSpec_VocabularyOutputPieceScore = bool(true)
Default_TrainerSpec_HardVocabLimit = bool(true)
Default_TrainerSpec_UseAllVocab = bool(false)
Default_TrainerSpec_UnkId = int32(0)
Default_TrainerSpec_BosId = int32(1)
Default_TrainerSpec_EosId = int32(2)
Default_TrainerSpec_PadId = int32(-1)
Default_TrainerSpec_UnkPiece = string("<unk>")
Default_TrainerSpec_BosPiece = string("<s>")
Default_TrainerSpec_EosPiece = string("</s>")
Default_TrainerSpec_PadPiece = string("<pad>")
Default_TrainerSpec_UnkSurface = string(" ⁇ ")
Default_TrainerSpec_TrainExtremelyLargeCorpus = bool(false)
Default_TrainerSpec_SeedSentencepiecesFile = string("")
)
func (x *TrainerSpec) Reset() {
*x = TrainerSpec{}
if protoimpl.UnsafeEnabled {
mi := &file_sentencepiece_model_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TrainerSpec) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TrainerSpec) ProtoMessage() {}
func (x *TrainerSpec) ProtoReflect() protoreflect.Message {
mi := &file_sentencepiece_model_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TrainerSpec.ProtoReflect.Descriptor instead.
func (*TrainerSpec) Descriptor() ([]byte, []int) {
return file_sentencepiece_model_proto_rawDescGZIP(), []int{0}
}
func (x *TrainerSpec) GetInput() []string {
if x != nil {
return x.Input
}
return nil
}
func (x *TrainerSpec) GetInputFormat() string {
if x != nil && x.InputFormat != nil {
return *x.InputFormat
}
return ""
}
func (x *TrainerSpec) GetModelPrefix() string {
if x != nil && x.ModelPrefix != nil {
return *x.ModelPrefix
}
return ""
}
func (x *TrainerSpec) GetModelType() TrainerSpec_ModelType {
if x != nil && x.ModelType != nil {
return *x.ModelType
}
return Default_TrainerSpec_ModelType
}
func (x *TrainerSpec) GetVocabSize() int32 {
if x != nil && x.VocabSize != nil {
return *x.VocabSize
}
return Default_TrainerSpec_VocabSize
}
func (x *TrainerSpec) GetAcceptLanguage() []string {
if x != nil {
return x.AcceptLanguage
}
return nil
}
func (x *TrainerSpec) GetSelfTestSampleSize() int32 {
if x != nil && x.SelfTestSampleSize != nil {
return *x.SelfTestSampleSize
}
return Default_TrainerSpec_SelfTestSampleSize
}
func (x *TrainerSpec) GetEnableDifferentialPrivacy() bool {
if x != nil && x.EnableDifferentialPrivacy != nil {
return *x.EnableDifferentialPrivacy
}
return Default_TrainerSpec_EnableDifferentialPrivacy
}
func (x *TrainerSpec) GetDifferentialPrivacyNoiseLevel() float32 {
if x != nil && x.DifferentialPrivacyNoiseLevel != nil {
return *x.DifferentialPrivacyNoiseLevel
}
return Default_TrainerSpec_DifferentialPrivacyNoiseLevel
}
func (x *TrainerSpec) GetDifferentialPrivacyClippingThreshold() uint64 {
if x != nil && x.DifferentialPrivacyClippingThreshold != nil {
return *x.DifferentialPrivacyClippingThreshold
}
return Default_TrainerSpec_DifferentialPrivacyClippingThreshold
}
func (x *TrainerSpec) GetCharacterCoverage() float32 {
if x != nil && x.CharacterCoverage != nil {
return *x.CharacterCoverage
}
return Default_TrainerSpec_CharacterCoverage
}
func (x *TrainerSpec) GetInputSentenceSize() uint64 {
if x != nil && x.InputSentenceSize != nil {
return *x.InputSentenceSize
}
return Default_TrainerSpec_InputSentenceSize
}
func (x *TrainerSpec) GetShuffleInputSentence() bool {
if x != nil && x.ShuffleInputSentence != nil {
return *x.ShuffleInputSentence
}
return Default_TrainerSpec_ShuffleInputSentence
}
// Deprecated: Marked as deprecated in sentencepiece_model.proto.
func (x *TrainerSpec) GetMiningSentenceSize() int32 {
if x != nil && x.MiningSentenceSize != nil {
return *x.MiningSentenceSize
}
return 0
}
// Deprecated: Marked as deprecated in sentencepiece_model.proto.
func (x *TrainerSpec) GetTrainingSentenceSize() int32 {
if x != nil && x.TrainingSentenceSize != nil {
return *x.TrainingSentenceSize
}
return 0
}
func (x *TrainerSpec) GetSeedSentencepieceSize() int32 {
if x != nil && x.SeedSentencepieceSize != nil {
return *x.SeedSentencepieceSize
}
return Default_TrainerSpec_SeedSentencepieceSize
}
func (x *TrainerSpec) GetShrinkingFactor() float32 {
if x != nil && x.ShrinkingFactor != nil {
return *x.ShrinkingFactor
}
return Default_TrainerSpec_ShrinkingFactor
}
func (x *TrainerSpec) GetMaxSentenceLength() int32 {
if x != nil && x.MaxSentenceLength != nil {
return *x.MaxSentenceLength
}
return Default_TrainerSpec_MaxSentenceLength
}
func (x *TrainerSpec) GetNumThreads() int32 {
if x != nil && x.NumThreads != nil {
return *x.NumThreads
}
return Default_TrainerSpec_NumThreads
}
func (x *TrainerSpec) GetNumSubIterations() int32 {
if x != nil && x.NumSubIterations != nil {
return *x.NumSubIterations
}
return Default_TrainerSpec_NumSubIterations
}
func (x *TrainerSpec) GetMaxSentencepieceLength() int32 {
if x != nil && x.MaxSentencepieceLength != nil {
return *x.MaxSentencepieceLength
}
return Default_TrainerSpec_MaxSentencepieceLength
}
func (x *TrainerSpec) GetSplitByUnicodeScript() bool {
if x != nil && x.SplitByUnicodeScript != nil {
return *x.SplitByUnicodeScript
}
return Default_TrainerSpec_SplitByUnicodeScript
}
func (x *TrainerSpec) GetSplitByNumber() bool {
if x != nil && x.SplitByNumber != nil {
return *x.SplitByNumber
}
return Default_TrainerSpec_SplitByNumber
}
func (x *TrainerSpec) GetSplitByWhitespace() bool {
if x != nil && x.SplitByWhitespace != nil {
return *x.SplitByWhitespace
}
return Default_TrainerSpec_SplitByWhitespace
}
func (x *TrainerSpec) GetTreatWhitespaceAsSuffix() bool {
if x != nil && x.TreatWhitespaceAsSuffix != nil {
return *x.TreatWhitespaceAsSuffix
}
return Default_TrainerSpec_TreatWhitespaceAsSuffix
}
func (x *TrainerSpec) GetAllowWhitespaceOnlyPieces() bool {
if x != nil && x.AllowWhitespaceOnlyPieces != nil {
return *x.AllowWhitespaceOnlyPieces
}
return Default_TrainerSpec_AllowWhitespaceOnlyPieces
}
func (x *TrainerSpec) GetSplitDigits() bool {
if x != nil && x.SplitDigits != nil {
return *x.SplitDigits
}
return Default_TrainerSpec_SplitDigits
}
func (x *TrainerSpec) GetPretokenizationDelimiter() string {
if x != nil && x.PretokenizationDelimiter != nil {
return *x.PretokenizationDelimiter
}
return Default_TrainerSpec_PretokenizationDelimiter
}
func (x *TrainerSpec) GetControlSymbols() []string {
if x != nil {
return x.ControlSymbols
}
return nil
}
func (x *TrainerSpec) GetUserDefinedSymbols() []string {
if x != nil {
return x.UserDefinedSymbols
}
return nil
}
func (x *TrainerSpec) GetRequiredChars() string {
if x != nil && x.RequiredChars != nil {
return *x.RequiredChars
}
return ""
}
func (x *TrainerSpec) GetByteFallback() bool {
if x != nil && x.ByteFallback != nil {
return *x.ByteFallback
}
return Default_TrainerSpec_ByteFallback
}
func (x *TrainerSpec) GetVocabularyOutputPieceScore() bool {
if x != nil && x.VocabularyOutputPieceScore != nil {
return *x.VocabularyOutputPieceScore
}
return Default_TrainerSpec_VocabularyOutputPieceScore
}
func (x *TrainerSpec) GetHardVocabLimit() bool {
if x != nil && x.HardVocabLimit != nil {
return *x.HardVocabLimit
}
return Default_TrainerSpec_HardVocabLimit
}
func (x *TrainerSpec) GetUseAllVocab() bool {
if x != nil && x.UseAllVocab != nil {
return *x.UseAllVocab
}
return Default_TrainerSpec_UseAllVocab
}
func (x *TrainerSpec) GetUnkId() int32 {
if x != nil && x.UnkId != nil {
return *x.UnkId
}
return Default_TrainerSpec_UnkId
}
func (x *TrainerSpec) GetBosId() int32 {
if x != nil && x.BosId != nil {
return *x.BosId
}
return Default_TrainerSpec_BosId
}
func (x *TrainerSpec) GetEosId() int32 {
if x != nil && x.EosId != nil {
return *x.EosId
}
return Default_TrainerSpec_EosId
}
func (x *TrainerSpec) GetPadId() int32 {
if x != nil && x.PadId != nil {
return *x.PadId
}
return Default_TrainerSpec_PadId
}
func (x *TrainerSpec) GetUnkPiece() string {
if x != nil && x.UnkPiece != nil {
return *x.UnkPiece
}
return Default_TrainerSpec_UnkPiece
}
func (x *TrainerSpec) GetBosPiece() string {
if x != nil && x.BosPiece != nil {
return *x.BosPiece
}
return Default_TrainerSpec_BosPiece
}
func (x *TrainerSpec) GetEosPiece() string {
if x != nil && x.EosPiece != nil {
return *x.EosPiece
}
return Default_TrainerSpec_EosPiece
}
func (x *TrainerSpec) GetPadPiece() string {
if x != nil && x.PadPiece != nil {
return *x.PadPiece
}
return Default_TrainerSpec_PadPiece
}
func (x *TrainerSpec) GetUnkSurface() string {
if x != nil && x.UnkSurface != nil {
return *x.UnkSurface
}
return Default_TrainerSpec_UnkSurface
}
func (x *TrainerSpec) GetTrainExtremelyLargeCorpus() bool {
if x != nil && x.TrainExtremelyLargeCorpus != nil {
return *x.TrainExtremelyLargeCorpus
}
return Default_TrainerSpec_TrainExtremelyLargeCorpus
}
func (x *TrainerSpec) GetSeedSentencepiecesFile() string {
if x != nil && x.SeedSentencepiecesFile != nil {
return *x.SeedSentencepiecesFile
}
return Default_TrainerSpec_SeedSentencepiecesFile
}
// NormalizerSpec encodes a various parameters for string normalizaiton
type NormalizerSpec struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
extensionFields protoimpl.ExtensionFields
// name of normalization rule.
Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"`
// Pre-compiled normalization rule created by
// Builder::GetPrecompiledCharsMap() or Builder::CompileCharsMap() method.
// Usually this field is set by Builder::GetNormalizerSpec() method.
PrecompiledCharsmap []byte `protobuf:"bytes,2,opt,name=precompiled_charsmap,json=precompiledCharsmap" json:"precompiled_charsmap,omitempty"`
// Adds dummy whitespace at the beginning of text in order to
// treat "world" in "world" and "hello world" in the same way.
AddDummyPrefix *bool `protobuf:"varint,3,opt,name=add_dummy_prefix,json=addDummyPrefix,def=1" json:"add_dummy_prefix,omitempty"`
// Removes leading, trailing, and duplicate internal whitespace.
RemoveExtraWhitespaces *bool `protobuf:"varint,4,opt,name=remove_extra_whitespaces,json=removeExtraWhitespaces,def=1" json:"remove_extra_whitespaces,omitempty"`
// Replaces whitespace with meta symbol.
// This field must be true to train sentence piece model.
EscapeWhitespaces *bool `protobuf:"varint,5,opt,name=escape_whitespaces,json=escapeWhitespaces,def=1" json:"escape_whitespaces,omitempty"`
// Custom normalization rule file in TSV format.
// https://github.com/google/sentencepiece/blob/master/doc/normalization.md
// This field is only used in SentencePieceTrainer::Train() method, which
// compiles the rule into the binary rule stored in `precompiled_charsmap`.
NormalizationRuleTsv *string `protobuf:"bytes,6,opt,name=normalization_rule_tsv,json=normalizationRuleTsv" json:"normalization_rule_tsv,omitempty"`
}
// Default values for NormalizerSpec fields.
const (
Default_NormalizerSpec_AddDummyPrefix = bool(true)
Default_NormalizerSpec_RemoveExtraWhitespaces = bool(true)
Default_NormalizerSpec_EscapeWhitespaces = bool(true)
)
func (x *NormalizerSpec) Reset() {
*x = NormalizerSpec{}
if protoimpl.UnsafeEnabled {
mi := &file_sentencepiece_model_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *NormalizerSpec) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*NormalizerSpec) ProtoMessage() {}
func (x *NormalizerSpec) ProtoReflect() protoreflect.Message {
mi := &file_sentencepiece_model_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use NormalizerSpec.ProtoReflect.Descriptor instead.
func (*NormalizerSpec) Descriptor() ([]byte, []int) {
return file_sentencepiece_model_proto_rawDescGZIP(), []int{1}
}
func (x *NormalizerSpec) GetName() string {
if x != nil && x.Name != nil {
return *x.Name
}
return ""
}
func (x *NormalizerSpec) GetPrecompiledCharsmap() []byte {
if x != nil {
return x.PrecompiledCharsmap
}
return nil
}
func (x *NormalizerSpec) GetAddDummyPrefix() bool {
if x != nil && x.AddDummyPrefix != nil {
return *x.AddDummyPrefix
}
return Default_NormalizerSpec_AddDummyPrefix
}
func (x *NormalizerSpec) GetRemoveExtraWhitespaces() bool {
if x != nil && x.RemoveExtraWhitespaces != nil {
return *x.RemoveExtraWhitespaces
}
return Default_NormalizerSpec_RemoveExtraWhitespaces
}
func (x *NormalizerSpec) GetEscapeWhitespaces() bool {
if x != nil && x.EscapeWhitespaces != nil {
return *x.EscapeWhitespaces
}
return Default_NormalizerSpec_EscapeWhitespaces
}
func (x *NormalizerSpec) GetNormalizationRuleTsv() string {
if x != nil && x.NormalizationRuleTsv != nil {
return *x.NormalizationRuleTsv
}
return ""
}
// Proto to store samples for self-testing.
type SelfTestData struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
extensionFields protoimpl.ExtensionFields
Samples []*SelfTestData_Sample `protobuf:"bytes,1,rep,name=samples" json:"samples,omitempty"`
}
func (x *SelfTestData) Reset() {
*x = SelfTestData{}
if protoimpl.UnsafeEnabled {
mi := &file_sentencepiece_model_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SelfTestData) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SelfTestData) ProtoMessage() {}
func (x *SelfTestData) ProtoReflect() protoreflect.Message {
mi := &file_sentencepiece_model_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SelfTestData.ProtoReflect.Descriptor instead.
func (*SelfTestData) Descriptor() ([]byte, []int) {
return file_sentencepiece_model_proto_rawDescGZIP(), []int{2}
}
func (x *SelfTestData) GetSamples() []*SelfTestData_Sample {
if x != nil {
return x.Samples
}
return nil
}
// ModelProto stores model parameters.
// SentencePieceProcessor is supposed to be self-contained.
// All settings/parameters which may change the behavior must be encoded
// in ModelProto.
type ModelProto struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
extensionFields protoimpl.ExtensionFields
// Sentence pieces with scores.
Pieces []*ModelProto_SentencePiece `protobuf:"bytes,1,rep,name=pieces" json:"pieces,omitempty"`
// Spec used to generate this model file.
TrainerSpec *TrainerSpec `protobuf:"bytes,2,opt,name=trainer_spec,json=trainerSpec" json:"trainer_spec,omitempty"`
// Spec for text normalization.
NormalizerSpec *NormalizerSpec `protobuf:"bytes,3,opt,name=normalizer_spec,json=normalizerSpec" json:"normalizer_spec,omitempty"`
// Stores sample input and its expected segmentation to verify the model.
SelfTestData *SelfTestData `protobuf:"bytes,4,opt,name=self_test_data,json=selfTestData" json:"self_test_data,omitempty"`
// Spec for text de-normalization.
DenormalizerSpec *NormalizerSpec `protobuf:"bytes,5,opt,name=denormalizer_spec,json=denormalizerSpec" json:"denormalizer_spec,omitempty"`
}
func (x *ModelProto) Reset() {
*x = ModelProto{}
if protoimpl.UnsafeEnabled {
mi := &file_sentencepiece_model_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ModelProto) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ModelProto) ProtoMessage() {}
func (x *ModelProto) ProtoReflect() protoreflect.Message {
mi := &file_sentencepiece_model_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ModelProto.ProtoReflect.Descriptor instead.
func (*ModelProto) Descriptor() ([]byte, []int) {
return file_sentencepiece_model_proto_rawDescGZIP(), []int{3}
}
func (x *ModelProto) GetPieces() []*ModelProto_SentencePiece {
if x != nil {
return x.Pieces
}
return nil
}
func (x *ModelProto) GetTrainerSpec() *TrainerSpec {
if x != nil {
return x.TrainerSpec
}
return nil
}
func (x *ModelProto) GetNormalizerSpec() *NormalizerSpec {
if x != nil {
return x.NormalizerSpec
}
return nil
}
func (x *ModelProto) GetSelfTestData() *SelfTestData {
if x != nil {
return x.SelfTestData
}
return nil
}
func (x *ModelProto) GetDenormalizerSpec() *NormalizerSpec {
if x != nil {
return x.DenormalizerSpec
}
return nil
}
type SelfTestData_Sample struct {