SimpleStories Language Model
A 35 million parameters model trained on the SimpleStories dataset: https://huggingface.co/datasets/lennart-finke/SimpleStories
Installation
Follow the steps to install the simple stories package here: https://github.com/chandanms/simple_stories_train/tree/tokenizer_and_configs
Using SimpleStories-35M
Here's how to use the SimpleStories-35M model for text generation:
from transformers import AutoTokenizer
import torch
from simple_stories_train.models.llama import Llama
from simple_stories_train.models.model_configs import MODEL_CONFIGS
# Load model configuration
model_config = MODEL_CONFIGS["35M"]
# Load model and move to GPU
model = Llama.from_pretrained("chandan-sreedhara/SimpleStories-35M", model_config)
model.to("cuda")
model.eval()
# Load tokenizer
tokenizer = AutoTokenizer.from_pretrained("chandan-sreedhara/SimpleStories-35M")
# Define your prompt
prompt = "The curious cat looked at the"
# IMPORTANT: Use tokenizer without special tokens
inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
input_ids = inputs.input_ids.to("cuda")
# IMPORTANT: Set correct EOS token ID (not the default from tokenizer)
eos_token_id = 1
# Generate text
with torch.no_grad():
output_ids = model.generate(
idx=input_ids,
max_new_tokens=800,
temperature=0.7,
top_k=40,
eos_token_id=eos_token_id
)
# Decode output
output_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
print(f"Generated text:\n{output_text}")
- Downloads last month
- 0
Inference Providers
NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API:
The model has no library tag.