[Tokenizers] Add a Hugging Face-style tokenizer factory
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 45/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- csharp, huggingface
- Área
- ai-infra-agents, tooling
Línea de trabajo
The issue is about adding a factory to the Microsoft.ML.Tokenizers library. Start by examining the existing tokenizer implementations (e.g., BpeTokenizer, WordPieceTokenizer) and their constructors. Look at how Hugging Face tokenizer.json files are structured and map their configuration to .NET types. The work involves reading configuration, detecting tokenizer type, and handling unsupported features. Check related issues #7383 and #7384 for context. 'Done' means a factory method can load a tokenizer from a model directory or tokenizer.json file with proper error reporting.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Is your feature request related to a problem? Please describe.
Migrating a custom Hugging Face tokenizer to .NET requires the caller to know the tokenizer implementation, identify and load the correct vocabulary and merge files, interpret tokenizer configuration, and manually map those resources to the corresponding Microsoft.ML.Tokenizers type. In Python, AutoTokenizer.from_pretrained(...) handles this discovery and construction from a model directory or tokenizer configuration.
This gap makes migration harder and encourages application-specific loader code. #7384 can document the current process, but documentation alone does not provide an equivalent loading abstraction.
Describe the solution you'd like
Provide a factory API that creates the appropriate tokenizer from Hugging Face tokenizer artifacts, for example from a model directory or tokenizer.json file. The factory should:
- Detect the supported tokenizer implementation and construct the corresponding .NET tokenizer.
- Read the relevant tokenizer configuration, vocabulary, merges, special tokens, normalizer, pre-tokenizer, post-processor, and decoder settings when supported.
- Report unsupported tokenizer types or configuration sections explicitly rather than silently changing behavior.
- Allow callers to inspect the concrete tokenizer or its capabilities when implementation-specific behavior is needed.
The final API shape does not need to match Python, but the migration experience should be comparable to AutoTokenizer.from_pretrained(...) for supported formats.
Describe alternatives you've considered
Callers can identify the tokenizer type themselves and write adapters around individual tokenizer constructors. A migration guide can explain those steps, but every consuming library still has to reproduce the detection, configuration mapping, validation, and error handling.
Additional context
This request was identified while splitting the feedback in #7383, which originated in microsoft/semantic-kernel#9793. Related format-specific gaps should remain separately trackable, while this issue covers the complete discovery-and-construction experience.
[!NOTE]
This issue was drafted with AI assistance.
- Lenguaje dominante
- C#
- Estrellas
- 9.4k
- Forks
- 2k
- Merge medio
- 2 d 18 h
- PR fusionados (30 d)
- 64
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dotnet/machinelearning
-
area-Native untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
dotnet/machinelearning#7837 ·
Los mantenedores suelen responder en 1 día
-
area-TensorFlow untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
dotnet/machinelearning#7836 ·
Los mantenedores suelen responder en 1 día
-
ToArrowRecordBatches accumulates arrays from previous batches, producing invalid record batchesAbiertoarea-DataFrame bug untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
dotnet/machinelearning#7799 ·
Los mantenedores suelen responder en 1 día
-
LlamaTokenizer encodes some runs of repeated characters differently from SentencePiecePosiblemente ocupada @Laurianti la tomó hace 42 días. Abiertoarea-Tokenizers untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
dotnet/machinelearning#7751 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
BertTokenizer merges words separated only by `\n`, `\t` or `\r`Posiblemente ocupada @Laurianti la tomó hace 23 días. Abiertoarea-Tokenizers green
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
dotnet/machinelearning#7724 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de dotnet/machinelearning
Issues similares
-
bug emitter:client:csharp
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
microsoft/typespec#12572 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
needs-area-label
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
AWS Lambda: KeyNotFoundException drops HTTP-triggered transactions when allowAllHeaders is disabledAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
newrelic/newrelic-dotnet-agent#3949 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
area-networking
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dotnet/aspnetcore#70545 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 87/100
Los mantenedores suelen responder en 1 día