1 instantiation of SentencePiece
Microsoft.ML.Tokenizers (1)
SentencepieceModel.cs (1)
238
SentencePiece result =
new
();
29 references to SentencePiece
Microsoft.ML.Tokenizers (29)
Model\SentencePieceBpeModel.cs (11)
30
var
piece = modelProto.Pieces[i];
34
if (piece.Type == ModelProto.Types.
SentencePiece
.Types.Type.Byte)
180
if (type != (byte)ModelProto.Types.
SentencePiece
.Types.Type.Unused)
268
if (id.Type != (byte)ModelProto.Types.
SentencePiece
.Types.Type.Unused ||
458
if (type != (byte)ModelProto.Types.
SentencePiece
.Types.Type.Unused)
573
if (id.Type != (byte)ModelProto.Types.
SentencePiece
.Types.Type.Unused ||
726
if (type != (byte)ModelProto.Types.
SentencePiece
.Types.Type.Unused)
832
if (id.Type != (byte)ModelProto.Types.
SentencePiece
.Types.Type.Unused ||
1002
if (type != (byte)ModelProto.Types.
SentencePiece
.Types.Type.Unused)
1108
if (id.Type != (byte)ModelProto.Types.
SentencePiece
.Types.Type.Unused ||
1208
if (leftId.Type == (byte)ModelProto.Types.
SentencePiece
.Types.Type.Unused)
Model\SentencePieceUnigramModel.cs (14)
21
private readonly (string Piece, float Score, ModelProto.Types.
SentencePiece
.Types.Type Type)[] _vocabReverse;
38
_vocabReverse = new (string Piece, float Score, ModelProto.Types.
SentencePiece
.Types.Type Type)[modelProto.Pieces.Count];
45
if (modelProto.Pieces[i].Type == ModelProto.Types.
SentencePiece
.Types.Type.Normal ||
46
modelProto.Pieces[i].Type == ModelProto.Types.
SentencePiece
.Types.Type.UserDefined ||
47
modelProto.Pieces[i].Type == ModelProto.Types.
SentencePiece
.Types.Type.Unused)
56
else if (modelProto.Pieces[i].Type == ModelProto.Types.
SentencePiece
.Types.Type.Byte)
60
else if (modelProto.Pieces[i].Type == ModelProto.Types.
SentencePiece
.Types.Type.Unknown)
63
_vocabReverse[i] = (modelProto.Pieces[i].Piece, modelProto.Pieces[i].Score, ModelProto.Types.
SentencePiece
.Types.Type.Unknown);
85
_vocabReverse[modelProto.TrainerSpec.BosId] = (modelProto.TrainerSpec.BosPiece, 0f, ModelProto.Types.
SentencePiece
.Types.Type.Control);
86
_vocabReverse[modelProto.TrainerSpec.EosId] = (modelProto.TrainerSpec.EosPiece, 0f, ModelProto.Types.
SentencePiece
.Types.Type.Control);
87
_vocabReverse[modelProto.TrainerSpec.UnkId] = (modelProto.TrainerSpec.UnkPiece, 0f, ModelProto.Types.
SentencePiece
.Types.Type.Unknown);
92
_vocabReverse[modelProto.TrainerSpec.PadId] = (modelProto.TrainerSpec.PadPiece, 0f, ModelProto.Types.
SentencePiece
.Types.Type.Control);
506
if (_vocabReverse[ret].Type == ModelProto.Types.
SentencePiece
.Types.Type.Unused)
516
float score = _vocabReverse[ret].Type == ModelProto.Types.
SentencePiece
.Types.Type.UserDefined ? length * _maxScore - 0.1f : _vocabReverse[ret].Score;
SentencepieceModel.cs (4)
174
internal List<Types.
SentencePiece
> Pieces { get; } = new();
203
result.Pieces.Add(Types.
SentencePiece
.Parse(data, pos, pos + length));
236
internal static
SentencePiece
Parse(byte[] data, int start, int end)
238
SentencePiece
result = new();