Downloads · 30 days
42
2% of all-time downloads
XiaoZhang98/byT5-DRS
byT5-DRS is a machine learning model from XiaoZhang98. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for transformers.
This section demonstrates how to use the XiaoZhang98/byT5-DRS model with the Hugging Face Transformers library to process an example sentence.
Downloads · 30 days
42
2% of all-time downloads
All-time downloads
2.4K
Public
Repo size
7 GB
Likes
3
Public
Click a slice to open those files.
.bin2.3 GB · 100%
From the Hugging Face model README
This section demonstrates how to use the XiaoZhang98/byT5-DRS model with the Hugging Face Transformers library to process an example sentence.
from transformers import AutoTokenizer, T5ForConditionalGeneration
# Initialize the tokenizer and model
tokenizer = AutoTokenizer.from_pretrained('XiaoZhang98/byT5-DRS', max_length=512)
model = T5ForConditionalGeneration.from_pretrained("XiaoZhang98/byT5-DRS")
# Example sentence
example = "I am a student."
# Tokenize and prepare the input
x = tokenizer(example, return_tensors='pt', padding=True, truncation=True, max_length=512)['input_ids']
# Generate output
output = model.generate(x)
# Decode and print the output text
pred_text = tokenizer.decode(output[0], skip_special_tokens=True, clean_up_tokenization_spaces=False)
print(pred_text)