AI GitHub
Transformers for using published model architectures
Load supported pretrained models and connect tokenizers and processors to inference or training code.
Key Takeaways
- Transformers provides model implementations, auto classes and task pipelines.
- Select the checkpoint and task class, then load the tokenizer or processor specified for that checkpoint.
- Compare a task pipeline with the corresponding lower-level model call on one input.
- Review the model card and configuration before enabling remote repository code or relying on a model's output.
How it works
Transformers provides model implementations, auto classes and task pipelines. Each checkpoint can specify architecture, preprocessing and tokenizer details that matter to the calling code.
What you need
Select the checkpoint and task class, then load the tokenizer or processor specified for that checkpoint. Keep the two revisions together when reporting results.
What to try first
Compare a task pipeline with the corresponding lower-level model call on one input. Check how padding, truncation and generation settings affect results.
Load the same tokenizer and model revision on two machines. Save the input IDs so differences in output can be traced to preprocessing or execution settings.
Where to look for failures
Review the model card and configuration before enabling remote repository code or relying on a model's output. Check artifact revisions when reproducing behavior.
Related Franklin pages
Keep the task and input representation fixed as you move between a model library and tensor frameworks. Separate compile or initialization time from subsequent execution.
- Build and train neural networks with tensors, automatic differentiation and modules. PyTorch for tensor programs and neural-network training
- Compose transformations for differentiation, vectorization and compilation around array functions. JAX for transforming numerical programs
For the role of multilayer networks and how they learn, see Franklin’s glossary. Deep learning
Project documentation
Try it for your workflow
Explore the project’s documentation for setup and usage, or save this page to a collection for later.
Read the project documentation ↗