Run this model with HF Jobs

Run ZeroYB/FromScratchGPT 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/ZeroYB/FromScratchGPT. 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/ZeroYB/FromScratchGPT 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/ZeroYB/FromScratchGPT. 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/ZeroYB/FromScratchGPT. 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.
FromScratchGPT / README.md
ZeroYB's picture
Pretrained on TinyStories for ten minutes, in episode 2
c86f255 verified
|
Raw History Blame Contribute Delete
2.27 kB
metadata
license: mit
language: en
library_name: transformers
pipeline_tag: text-generation
datasets:
  - roneneldan/TinyStories
  - roneneldan/TinyStoriesInstruct
tags:
  - FromScratchGPT
  - 6x384
  - tinystories
  - transformers.js

FromScratchGPT

From Scratch GPT is a small decoder-only transformer, written from scratch in PyTorch for the YouTube series From Scratch GPT. It writes short children's stories, in the style of TinyStories. The code that trained it is at https://github.com/FromScratchGPT/FromScratchGPT, with a tag for each step of each episode.

This revision, ep002-pretrain: Pretrained on TinyStories for ten minutes, in episode 2.

It has 6 Transformer blocks and 384 embedding channels. Its vocabulary has 10,000 tokens.

Use it

from transformers import AutoModelForCausalLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("ZeroYB/FromScratchGPT", revision="ep002-pretrain")
model = AutoModelForCausalLM.from_pretrained("ZeroYB/FromScratchGPT", revision="ep002-pretrain")
ids = tokenizer("Once upon a time", return_tensors="pt").input_ids
out = model.generate(ids, max_new_tokens=200, do_sample=True, temperature=0.8, top_k=50)
print(tokenizer.decode(out[0, ids.shape[1]:], skip_special_tokens=True))

In a browser, with Transformers.js, from the 8-bit ONNX model in onnx/:

import { pipeline } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.1";

const writer = await pipeline("text-generation", "ZeroYB/FromScratchGPT", { dtype: "q8", revision: "ep002-pretrain" });
const [out] = await writer("Once upon a time", { max_new_tokens: 100, do_sample: true, top_k: 50 });

Revisions

Each episode that changes the model pushes a new commit here, tagged after the episode, such as ep002-pretrain for the pretrained model and ep003-sft for the fine-tuned one, and ep012-pretrain for a model of 91 million parameters, pretrained on four GPUs. revision= loads a tag, and main is the latest.

Limitations

  • It writes children's stories, and nothing else: no facts, arithmetic or chat.
  • Its context window is 256 tokens.