Run this model with HF Jobs
Run google/mt5-base on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/google/mt5-base. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/google/mt5-base on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use google/mt5-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use google/mt5-base with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("google/mt5-base") model = AutoModelForSeq2SeqLM.from_pretrained("google/mt5-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
mt5-base embedding size and tokenizer size don't match?
Hello! I'm trying load mt5-base (encoder-only) with transformers, and I'm finding that the config and checkpoint have more input embeddings than there are items in the vocabulary. Specifically:
from transformers import MT5TokenizerFast, MT5Config, MT5EncoderModel
cfg = MT5Config.from_pretrained("google/mt5-base")
tok = MT5TokenizerFast.from_pretrained("google/mt5-base")
mdl = MT5EncoderModel.from_pretrained("google/mt5-base", config=cfg)
print(cfg.vocab_size == mdl.get_input_embeddings().num_embeddings)
print(cfg.vocab_size == len(tok))
print(cfg.vocab_size)
print(len(tok))
prints
True
False
250112
250100
(this happens with both fast and standard tokenizers)
Is this expected? If so, what are the extra 12 tokens for?
Hey @echau18 - good question that many people had :-) See: https://github.com/huggingface/transformers/issues/4875
Thanks @patrickvonplaten ! Seems like this is a common issue that resurfaces frequently. Any chance something could be directly added to the model card as an FYI, rather than needing to route through the transformers repo?