Run this model with HF Jobs

Run superMohammad/GenerativeAICourse-llama-75m on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/superMohammad/GenerativeAICourse-llama-75m. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/superMohammad/GenerativeAICourse-llama-75m on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/superMohammad/GenerativeAICourse-llama-75m. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/superMohammad/GenerativeAICourse-llama-75m. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
superMohammad's picture
Update repo name in model card
13bf127 verified
|
Raw History Blame Contribute Delete
2.74 kB
metadata
language: en
library_name: transformers
pipeline_tag: text-generation
datasets:
  - roneneldan/TinyStories
tags:
  - llama
  - causal-lm
  - tinystories
  - from-scratch

This work was done by Mohammad Almalke & Abdullrahman Almuharib

GenerativeAICourse-llama-75m

A 75M-parameter Llama-style language model trained from scratch on TinyStories for a Generative AI course lab on scaling laws. It writes short, simple children's stories in English.

Quick start

from transformers import AutoModelForCausalLM, AutoTokenizer

repo = "superMohammad/GenerativeAICourse-llama-75m"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo)

prompt = "Once upon a time, a little robot found a book."
inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False)
output = model.generate(**inputs, max_new_tokens=80, do_sample=False)
print(tokenizer.decode(output[0], skip_special_tokens=True))

Model

Architecture LlamaForCausalLM
Parameters 74,998,272
Layers 24
Hidden size 512
MLP size 1408 (SiLU)
Attention heads 8 query / 4 key-value (GQA), head dim 64
Context length 512 tokens
Vocabulary 8,192 (byte-level BPE trained on the training split)
Embeddings tied input/output

Training

Data 300,000 TinyStories documents, split 270k / 15k / 15k (train / val / test)
Tokens seen 524,288,000 (1,000 updates × 32 sequences × 32 accumulation × 512 tokens)
Optimizer AdamW, β = (0.9, 0.95), weight decay 0.1, grad clip 1.0
Learning rate 3e-4, 100 warmup steps, cosine decay to 0
Precision mixed precision (FP16 autocast) on a single GPU
Seed 42

The run used about 35% of the Chinchilla-style budget of 20 tokens per parameter (≈1.5B tokens).

Results

Split Loss Perplexity
Validation (before training) 9.033 8374
Validation 1.901 6.69
Test 1.899 6.68

The repository also contains experiment.json (the full run record) and loss_curve.png.

Prompt: Once upon a time, a little robot found a book.

  • Before training: bo bo bo bo bo bo ...
  • After training: The robot was very happy and wanted to read it. So, the robot went to the library to find the book. But when he got there, he saw that the book was not there. The robot was sad and scared...

Limitations

  • Trained only on synthetic children's stories, so it has no general knowledge and can't follow instructions.
  • It often repeats itself and loses track of characters in long generations.
  • English only, with a 512-token context.