Translation
Transformers
PyTorch
TensorFlow
JAX
Rust
ONNX
Safetensors
t5
text2text-generation
summarization
text-generation-inference
Instructions to use google-t5/t5-small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google-t5/t5-small with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "translation" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("translation", model="google-t5/t5-small")# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("google-t5/t5-small") model = AutoModelForSeq2SeqLM.from_pretrained("google-t5/t5-small") - Inference
- Notebooks
- Google Colab
- Kaggle
`model_max_length` set to your preferred value.
#3
by NikGC - opened
Please help with the following error. I am a student and trying to run this model in Visual Studio Code and getting this error. No idea how to fix it.
FutureWarning: This tokenizer was incorrectly instantiated with a model max length of 512 which will be corrected in Transformers v5.
For now, this behavior is kept to avoid breaking backwards compatibility when padding/encoding with truncation is True.
- Be aware that you SHOULD NOT rely on t5-small automatically truncating your input to 512 when padding/encoding.
- If you want to encode/pad to sequences longer than 512 you can either instantiate this tokenizer with
model_max_lengthor passmax_lengthwhen encoding/padding. - To avoid this warning, please instantiate this tokenizer with
model_max_lengthset to your preferred value.
warnings.warn(
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("t5-small",model_max_length=512)# just do it