Downloads · 30 days
7
37% of all-time downloads
Siyam025/MODEL-3
MODEL-3 is a machine learning model from Siyam025. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
gpt2-basic-small is a compact GPT-2 style causal language model optimized for lightweight text generation tasks. It is trained on a mixed web-text corpus with emphasis on coherent short-form paragraph generation and c…
Downloads · 30 days
7
37% of all-time downloads
All-time downloads
19
Public
Repo size
—
Likes
0
Public
Click a slice to open those files.
.md2 KB · 40%
From the Hugging Face model README
gpt2-basic-small is a compact GPT-2 style causal language model optimized for lightweight text generation tasks. It is trained on a mixed web-text corpus with emphasis on coherent short-form paragraph generation and code-comment style synthesis.
Not intended for:
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "your-username/gpt2-basic-small"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id)
prompt = "In the near future, urban gardens will"
inputs = tokenizer(prompt, return_tensors="pt")
with torch.no_grad():
outputs = model.generate(
**inputs,
max_length=80,
num_beams=4,
do_sample=True,
top_k=50,
top_p=0.95,
temperature=0.9,
early_stopping=True,
pad_token_id=tokenizer.pad_token_id
)
generated = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(generated)