41 references to Helpers
Microsoft.ML.Tokenizers (41)
Model\BPETokenizer.cs (1)
824
await
Helpers
.ReadLineAsync(reader, cancellationToken).ConfigureAwait(false) :
Model\CodeGenTokenizer.cs (8)
459
int encodedLength =
Helpers
.EncodeToUtf8AndTransform(textSpan, token, mapping);
1142
int encodedLength =
Helpers
.EncodeToUtf8AndTransform(textSpan, token, mapping);
1206
int encodedLength =
Helpers
.EncodeToUtf8AndTransform(textSpan, token, mapping);
1291
Helpers
.ArrayPoolGrow(ref bytes, (bytes.Length + bytesCountToEncode) * 2);
1295
bytesIndex +=
Helpers
.GetUtf8Bytes(removePrefixSpace ? specialToken.AsSpan().Slice(1) : specialToken.AsSpan(), bytes.AsSpan().Slice(bytesIndex));
1480
if (!
Helpers
.ConvertUtf8ToUtf16(current, vocabBuffer.Slice(utf16CharsInBuffer), out int utf8BytesConsumed, out int utf16CharsWritten))
1573
Helpers
.ArrayPoolGrow<byte>(ref bytes, bytes.Length * 2);
1581
i +=
Helpers
.EncodeCodePointToUtf8(text, i, ref bytes, ref bytesIndex) - 1;
Model\SentencePieceTokenizer.cs (10)
401
int bytesWritten =
Helpers
.GetUtf8Bytes(text.Slice(i), utf8Bytes);
772
int bytesWritten =
Helpers
.GetUtf8Bytes(text.Slice(i), utf8Bytes);
1091
int encodedCount =
Helpers
.GetUtf8Bytes(text.Slice(i), utf8Bytes);
1471
int encodedCount =
Helpers
.GetUtf8Bytes(text.Slice(0, i + 1), utf8Bytes);
1623
Helpers
.ArrayPoolGrow(ref bytesPoolArray, bytesCount * 2);
1687
Helpers
.ArrayPoolGrow(ref charPoolArray, len);
1690
int charCount =
Helpers
.GetChars(bytesPoolArray.AsSpan(0, bytesCount), charPoolArray);
1906
Helpers
.ArrayPoolGrow(ref bytesPoolArray, bytesCount * 2);
2029
Helpers
.ArrayPoolGrow(ref charPoolArray, len);
2032
int charCount =
Helpers
.GetChars(bytesPoolArray.AsSpan(0, bytesCount), charPoolArray);
Model\TiktokenTokenizer.cs (15)
168
string? line = useAsync ? await
Helpers
.ReadLineAsync(reader, cancellationToken).ConfigureAwait(false) : reader.ReadLine();
174
if (!
Helpers
.TryParseInt32(line, capacity.Length, out suggestedCapacity))
179
line = useAsync ? await
Helpers
.ReadLineAsync(reader, cancellationToken).ConfigureAwait(false) : reader.ReadLine();
189
line = useAsync ? await
Helpers
.ReadLineAsync(reader, cancellationToken).ConfigureAwait(false) : reader.ReadLine();
203
} while ((line = useAsync ? await
Helpers
.ReadLineAsync(reader, cancellationToken).ConfigureAwait(false) : reader.ReadLine()) is not null);
216
if (
Helpers
.TryParseInt32(line, spaceIndex + 1, out int rank))
218
AddData(
Helpers
.FromBase64String(line, 0, spaceIndex), rank);
226
await
Helpers
.ReadLineAsync(reader, cancellationToken).ConfigureAwait(false) :
327
int encodedLength =
Helpers
.EncodeToUtf8(text, arrayPoolArray, indexMappingSpan);
444
int encodedLength =
Helpers
.EncodeToUtf8(text, arrayPoolArray, indexMappingSpan);
609
int encodedLength =
Helpers
.EncodeToUtf8(text, arrayPoolArray, indexMappingSpan);
735
int encodedLength =
Helpers
.EncodeToUtf8(text, arrayPoolArray, indexMappingSpan);
829
return
Helpers
.GetString(utf8Bytes.Slice(0, utf8ByteCount));
912
if (!
Helpers
.ConvertUtf8ToUtf16(tokenBytes.Span, tempBuffer, out int bytesConsumed, out incompleteCharsWritten))
945
if (!
Helpers
.ConvertUtf8ToUtf16(utf8Bytes.Slice(utf8BytesIncompleteIndex, utf8BytesIncompleteCount + tokenBytes.Length), tempBuffer, out int bytesConsumed, out int charsConsumed))
Model\WordPieceTokenizer.cs (2)
103
string? line = useAsync ? await
Helpers
.ReadLineAsync(reader, cancellationToken).ConfigureAwait(false) : reader.ReadLine();
115
line = useAsync ? await
Helpers
.ReadLineAsync(reader, cancellationToken).ConfigureAwait(false) : reader.ReadLine();
Normalizer\BertNormalizer.cs (2)
154
Helpers
.ArrayPoolGrow(ref buffer, index + 40);
165
Helpers
.ArrayPoolGrow(ref buffer, index + buffer.Length + 10);
Utils\Helpers.netcoreapp.cs (1)
83
Helpers
.ArrayPoolGrow(ref destination, destination.Length * 2);
Utils\StringSpanOrdinalKey.cs (1)
46
public override int GetHashCode() =>
Helpers
.GetHashCode(Span);
Utils\ValueStringBuilder.cs (1)
96
Helpers
.Replace(span, oldValue, newValue);