Downloads · 30 days
39
19% of all-time downloads
FrankL/storytellerLM-v0
storytellerLM-v0 is a text generation model from FrankL. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
Downloads · 30 days
39
19% of all-time downloads
All-time downloads
210
Public
Parameters
29M
116 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors116 MB · 98%
From the Hugging Face model README
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
model = AutoModel.from_pretrained('FrankL/storytellerLM-v0', trust_remote_code=True, torch_dtype=torch.float16)
model = model.to(device='cuda')
tokenizer = AutoTokenizer.from_pretrained('FrankL/storytellerLM-v0', trust_remote_code=True)
def inference(
model: AutoModelForCausalLM,
tokenizer: AutoTokenizer,
input_text: str = "Once upon a time, ",
max_new_tokens: int = 16
):
inputs = tokenizer(input_text, return_tensors="pt").to(device)
outputs = model.generate(
**inputs,
pad_token_id=tokenizer.eos_token_id,
max_new_tokens=max_new_tokens,
do_sample=True,
top_k=40,
top_p=0.95,
temperature=0.8
)
generated_text = tokenizer.decode(
outputs[0],
skip_special_tokens=True
)
# print(outputs)
print(generated_text)
inference(model, tokenizer)