ANT1P4T1C4/charades_words
Viewer • Updated • 844 • 14
Simple usage of the model:
from transformers import AutoModel, AutoTokenizer, T5ForConditionalGeneration
model_name = 'ANT1P4T1C4/generate_charade_prompt'
model = T5ForConditionalGeneration.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
def generate_word(difficulty):
input = tokenizer(difficulty, return_tensors="pt")
word = model.generate(input["input_ids"], max_length=10, do_sample=True)
return tokenizer.decode(word[0], skip_special_tokens=True)
print("easy: ", generate_word('easy prompt'))
print("medium: ", generate_word(('medium prompt')))
print("hard: ", generate_word("hard prompt"))