Downloads · 30 days
122
0% of all-time downloads
jinymusim/gpt-czech-poet
gpt-czech-poet is a text generation model from jinymusim. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as cc-by-sa-4.0.
GPT2 finetuned on Czech poetry from github project by Institute of Czech Literature, Czech Academy of Sciences.
Downloads · 30 days
122
0% of all-time downloads
All-time downloads
131K
Public
Parameters
124M
8.8 GB on disk
Likes
3
Public
Click a slice to open those files.
.bin498 MB · 50%
From the Hugging Face model README
GPT2 finetuned on Czech poetry from github project by
Institute of Czech Literature, Czech Academy of Sciences.
https://github.com/versotym/corpusCzechVerse
Done using GPT-Czech-Poet
https://github.com/jinymusim/GPT-Czech-Poet
https://arxiv.org/abs/2407.12790
Use as any other GPT2 style model
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
tokenizer = AutoTokenizer.from_pretrained("jinymusim/gpt-czech-poet")
model = AutoModelForCausalLM.from_pretrained("jinymusim/gpt-czech-poet")
# Input Poet Start
poet_start = "# AABB # 1900\nD"
poet_start = poet_start.strip()
tokenized_poet_start = tokenizer.encode(poet_start, return_tensors='pt')
# generated a continuation to it
out = model.generate(tokenized_poet_start,
max_length=256,
do_sample=True,
top_k=50
early_stopping=True,
pad_token_id= tokenizer.pad_token_id,
eos_token_id = tokenizer.eos_token_id)
# Decode Poet
decoded_cont = tokenizer.decode(out[0], skip_special_tokens=True)
print(decoded_cont)