Views
No views yet
google-t5/t5-large for kerasformers. One implementation runs unmodified on TensorFlow / Torch / JAX, bit-exact with the Hugging Face original. T5 is a text-to-text encoder-decoder; this repo hosts the full backbone (kf_config.json declares T5Model), and every T5 class (T5ConditionalGenerate, T5EncoderModel, and the classification / QA heads) loads its subset from the one model.weights.h5.1import os
2os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
3
4from kerasformers.models.t5 import T5ConditionalGenerate, T5Tokenizer
5
6model = T5ConditionalGenerate.from_weights("kerasformers/t5_large")
7tokenizer = T5Tokenizer.from_weights("kerasformers/t5_large")
8
9inputs = tokenizer("translate English to German: The house is wonderful.")
10output_ids = model.generate(
11 inputs["input_ids"], inputs["attention_mask"], max_new_tokens=40
12)
13print(tokenizer.decode(output_ids[0]))from_weights("kerasformers/<variant>"). Browse them all in the T5 collection.from_weights("kerasformers/t5_large") (or on the fly via the hf: prefix). The pretrained backbone is shared; task heads not stored in this checkpoint start randomly initialized, ready for fine-tuning (or load a hf: fine-tune).| Class | Task |
|---|---|
T5Model | Encoder backbone |
T5ConditionalGenerate | Text-to-text generation |
T5EncoderModel | Encoder-only features |
T5SequenceClassify | Sequence classification |
T5TokenClassify | Token classification (NER / POS) |
T5QnA | Extractive question answering |
1from kerasformers.models.t5 import T5SequenceClassify
2model = T5SequenceClassify.from_weights("kerasformers/t5_large")