Downloads · 30 days
77
50% of all-time downloads
Haider92/tinystories-gpt-from-scratch
tinystories-gpt-from-scratch is a text generation model from Haider92. Use it when you need the model to write or continue text. It is set up for pytorch. The card lists the license as mit.
A small GPT-style language model trained from scratch on TinyStories. It is an educational model for generating short, simple English stories.
Downloads · 30 days
77
50% of all-time downloads
All-time downloads
154
Public
Repo size
49.2 MB
Likes
0
Public
Click a slice to open those files.
.pt49.2 MB · 99%
From the Hugging Face model README
A small GPT-style language model trained from scratch on TinyStories. It is an educational model for generating short, simple English stories.
The exported checkpoint was saved at training step 1,000. Its recorded training loss was 3.11046 and recorded validation loss was 3.07700. These values are checkpoint metadata, not a broader benchmark.
import sys
from pathlib import Path
import torch
from huggingface_hub import snapshot_download
from tokenizers import Tokenizer
model_dir = Path(snapshot_download("Haider92/tinystories-gpt-from-scratch"))
sys.path.insert(0, str(model_dir))
from inference_utils import generate_story, load_exported_model
device = torch.device("cpu")
model = load_exported_model(
model_dir / "config.json",
model_dir / "model.pt",
device,
)
tokenizer = Tokenizer.from_file(
str(model_dir / "tinystories_tokenizer.json")
)
result = generate_story(
model,
tokenizer,
prompt="Once upon a time",
target_tokens=120,
extra_tokens=80,
temperature=0.8,
top_k=40,
device=device,
)
print(result.story)
This model is intended for education, experimentation, and short TinyStories-style text generation. It is not a general-purpose assistant.
The model is small and trained on a constrained synthetic-story dataset. Outputs may be repetitive, inconsistent, incomplete, or factually incorrect. It has no application-specific safety guarantees.
TinyStories is distributed under CDLA-Sharing-1.0. No dataset files are included in this repository.
The exported model weights and included source code are available under the MIT License.