Transformers
PyTorch
TensorBoard
English
t5
text2text-generation
Generated from Trainer
IteraTeR
text-generation-inference
Instructions to use mrm8488/t5-base-iterater with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mrm8488/t5-base-iterater with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSeq2SeqLM tokenizer = AutoTokenizer.from_pretrained("mrm8488/t5-base-iterater") model = AutoModelForSeq2SeqLM.from_pretrained("mrm8488/t5-base-iterater") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -87,6 +87,19 @@ MODEL_CKPT = 'mrm8488/t5-base-iterater'
|
|
| 87 |
tokenizer = T5TokenizerFast.from_pretrained(MODEL_CKPT)
|
| 88 |
model = T5ForConditionalGeneration.from_pretrained(MODEL_CKPT)
|
| 89 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
```
|
| 91 |
|
| 92 |
### Framework versions
|
|
|
|
| 87 |
tokenizer = T5TokenizerFast.from_pretrained(MODEL_CKPT)
|
| 88 |
model = T5ForConditionalGeneration.from_pretrained(MODEL_CKPT)
|
| 89 |
|
| 90 |
+
def predict(intent, text):
|
| 91 |
+
input_text = f"<{intent}> {text}"
|
| 92 |
+
features = tokenizer([input_text], return_tensors='pt')
|
| 93 |
+
output = model.generate(input_ids=features['input_ids'],
|
| 94 |
+
attention_mask=features['attention_mask'], max_length=128, num_beams=8)
|
| 95 |
+
return tokenizer.decode(output[0], skip_special_tokens=True)
|
| 96 |
+
|
| 97 |
+
text = "Delay-based schemes have the potential to resolve this last packet problem by scheduling the link based on the delay for the packet has encountered."
|
| 98 |
+
intent = "clarity"
|
| 99 |
+
|
| 100 |
+
predict(intent, text)
|
| 101 |
+
# Delay-based schemes have the potential to resolve this last packet problem by scheduling the link based on the delay the packet has encountered.
|
| 102 |
+
|
| 103 |
```
|
| 104 |
|
| 105 |
### Framework versions
|