1 write to Id
Microsoft.ML.Tokenizers (1)
EncodedToken.cs (1)
38
Id
= id;
92 references to Id
Microsoft.ML.Tokenizers (17)
EncodedToken.cs (2)
44
public bool Equals(EncodedToken other) =>
Id
== other.
Id
&& Value == other.Value && Offset.Equals(other.Offset);
Model\CodeGenTokenizer.cs (8)
1020
accumulatedIds.Add(t.
Id
);
1046
accumulatedIds?.Add(tokens[k].
Id
);
1058
accumulatedIds?.Add(tokens[tokenCount].
Id
);
1076
accumulatedIds.Add(t.
Id
);
1094
accumulatedIds?.Add(tokens[i].
Id
);
1596
tokens.Add(new EncodedToken(tokensToAdd[0].
Id
, tokensToAdd[0].Value, new Range(r.s, r.e)));
1600
tokens.Add(new EncodedToken(tokensToAdd[i].
Id
, tokensToAdd[i].Value, new Range(tokensToAdd[i].Offset.Start.Value + offset - 1, tokensToAdd[i].Offset.End.Value + offset - 1)));
1608
tokens.Add(new EncodedToken(t.
Id
, t.Value, new Range(t.Offset.Start.Value + offset, t.Offset.End.Value + offset)));
Model\EnglishRobertaTokenizer.cs (6)
339
tokens.Add(new EncodedToken(t.
Id
, t.Value, new Range(split.Offset + t.Offset.Start.Value, split.Offset + t.Offset.End.Value)));
598
accumulatedIds.Add(t.
Id
);
610
accumulatedIds.Add(tokens[i].
Id
);
635
accumulatedIds.Add(t.
Id
);
647
accumulatedIds.Add(tokens[i].
Id
);
929
list.Add(new EncodedToken(tokens[j].
Id
, tokens[j].Value, new Range(indexMapping[index], indexMapping[index] + tokens[j].Value.Length)));
Tokenizer.cs (1)
49
ids[i] = results.Tokens[i].
Id
;
Microsoft.ML.Tokenizers.Tests (73)
BpeTests.cs (6)
258
int[] encodingIds = encoding.Select(t => t.
Id
).ToArray();
278
Assert.Equal(ids[i], encoding[i].
Id
);
380
Assert.Equal(encoding.Select(t => t.
Id
).ToArray(), ids);
434
Assert.Equal(expectedIds, encoding.Select(t => t.
Id
).ToArray());
438
Assert.Equal(expectedIds, encoding1.Select(t => t.
Id
).ToArray());
528
Assert.Equal(expectedTokens.Select(t => t.
Id
).ToArray(), ids);
CodeGenTests.cs (44)
236
Assert.Equal(expectedIdsWithSpace, encoding.Select(t => t.
Id
).ToArray());
242
Assert.Equal(expectedIds, encoding.Select(t => t.
Id
).ToArray());
253
int[] ids = encoding.Select(t => t.
Id
).ToArray();
256
ids = encoding.Select(t => t.
Id
).ToArray();
261
ids = encoding.Select(t => t.
Id
).ToArray();
264
ids = encoding.Select(t => t.
Id
).ToArray();
269
ids = encoding.Select(t => t.
Id
).ToArray();
272
ids = encoding.Select(t => t.
Id
).ToArray();
277
ids = encoding.Select(t => t.
Id
).ToArray();
280
ids = encoding.Select(t => t.
Id
).ToArray();
285
ids = encoding.Select(t => t.
Id
).ToArray();
288
ids = encoding.Select(t => t.
Id
).ToArray();
293
ids = encoding.Select(t => t.
Id
).ToArray();
297
ids = encoding.Select(t => t.
Id
).ToArray();
556
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
561
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
566
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
571
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
580
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
585
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
590
Assert.Equal(expectedIds, encoding.Select(t => t.
Id
).ToArray());
595
Assert.Equal(expectedIds, encoding.Select(t => t.
Id
).ToArray());
600
Assert.Equal(expectedIdsWithSpace, encoding.Select(t => t.
Id
).ToArray());
605
Assert.Equal(expectedIdsWithSpace, encoding.Select(t => t.
Id
).ToArray());
689
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
694
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
699
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
704
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
713
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
718
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
723
Assert.Equal(expectedIds, encoding.Select(t => t.
Id
).ToArray());
728
Assert.Equal(expectedIds, encoding.Select(t => t.
Id
).ToArray());
733
Assert.Equal(expectedIdsWithSpace, encoding.Select(t => t.
Id
).ToArray());
738
Assert.Equal(expectedIdsWithSpace, encoding.Select(t => t.
Id
).ToArray());
824
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
830
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
836
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
842
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
854
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
860
Assert.Equal(idList, encoding.Select(t => t.
Id
).ToArray());
866
Assert.Equal(expectedIds, encoding.Select(t => t.
Id
).ToArray());
872
Assert.Equal(expectedIds, encoding.Select(t => t.
Id
).ToArray());
878
Assert.Equal(expectedIdsWithSpace, encoding.Select(t => t.
Id
).ToArray());
884
Assert.Equal(expectedIdsWithSpace, encoding.Select(t => t.
Id
).ToArray());
EnglishRobertaTests.cs (3)
186
Assert.Equal(expectedIds, encoding.Select(t => t.
Id
).ToArray());
190
Assert.Equal(expectedIds, encoding1.Select(t => t.
Id
).ToArray());
266
int[] encodingIds = encoding.Select(t => t.
Id
).ToArray();
LlamaTests.cs (12)
245
Assert.Equal(ids, result.Select(t => t.
Id
).ToArray());
267
Assert.Equal(ids.Skip(1), bpeTokens.Select(token => token.
Id
));
269
int[] extractedIds = bpeTokens.Select(token => token.
Id
).ToArray();
277
Assert.Equal(isEmptyInput ? Array.Empty<int>() : ids.Skip(1).Concat(new[] { bpe.EndOfSentenceId }), bpeTokens.Select(token => token.
Id
));
279
extractedIds = bpeTokens.Select(token => token.
Id
).ToArray();
287
Assert.Equal(isEmptyInput ? Array.Empty<int>() : ids.Concat(new[] { bpe.EndOfSentenceId }), bpeTokens.Select(token => token.
Id
));
289
extractedIds = bpeTokens.Select(token => token.
Id
).ToArray();
505
Assert.Equal(expectedIds, encoding.Select(t => t.
Id
).ToArray());
509
Assert.Equal(expectedIds, encoding1.Select(t => t.
Id
).ToArray());
543
Assert.Equal(expectedIds1, encoding.Select(t => t.
Id
).ToArray());
666
Assert.Equal(new[] { tokenizer.BeginningOfSentenceId, kvp.Value }, encodedTokens.Select(et => et.
Id
).ToArray());
670
Assert.Equal(encodedIds, encodedTokens.Select(et => et.
Id
).ToArray());
TiktokenTests.cs (8)
146
int[] ids = result.Select(token => token.
Id
).ToArray();
199
int[] ids = result.Select(token => token.
Id
).ToArray();
240
int[] ids = result.Select(token => token.
Id
).ToArray();
275
Assert.Equal(encoded, result.Select(token => token.
Id
).ToArray());
310
Assert.Equal(encoded, result.Select(token => token.
Id
).ToArray());
573
Assert.Equal(expectedIds, encoding.Select(t => t.
Id
).ToArray());
577
Assert.Equal(expectedIds, encoding1.Select(t => t.
Id
).ToArray());
684
int[] ids = result.Select(r => r.
Id
).ToArray();
Microsoft.ML.TorchSharp (2)
NasBert\NerTrainer.cs (1)
190
t = torch.tensor((ZeroArray).Concat(Tokenizer.RobertaModel().ConvertIdsToOccurrenceRanks(encoding.Select(t => t.
Id
).ToArray())).ToList(), device: Device);
Roberta\QATrainer.cs (1)
406
var contextTokenId = Tokenizer.RobertaModel().ConvertIdsToOccurrenceRanks(contextTokens.Select(t => t.
Id
).ToArray());