Views
No views yet
from transformers import GPTNeoForCausalLM, GPT2Tokenizer
tokenizer = GPT2Tokenizer.from_pretrained(Tincando/fiction_story_generator)
model = GPTNeoForCausalLM.from_pretrained(Tincando/fiction_story_generator)
# Generate a fiction story
input_prompt = "[WP] I can't believe I died the same way twice."
input_ids = tokenizer(input_prompt, add_special_tokens=False, return_tensors="pt").input_ids
output = model.generate(input_ids,
max_length=300,
temperature=0.9,
top_k=2,
top_p=0.9,
repetition_penalty=1.2,
do_sample=True,
num_return_sequences=2
)
generated_story = tokenizer.batch_decode(output,clean_up_tokenization_spaces=True)[0]
print(generated_story)| Training Loss | Epoch | Step | Validation Loss |
|---|---|---|---|
| 3.0842 | 1.0 | 34075 | 3.1408 |
| 3.0026 | 2.0 | 68150 | 3.1275 |
| 2.9344 | 3.0 | 102225 | 3.1270 |
| 2.8932 | 4.0 | 136300 | 3.1306 |
| 2.8517 | 5.0 | 170375 | 3.1357 |