Text Generation
Transformers
ONNX
Safetensors
Transformers.js
English
gpt2
FromScratchGPT
6x384
tinystories
text-generation-inference
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.
Instructions to use ZeroYB/FromScratchGPT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ZeroYB/FromScratchGPT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="ZeroYB/FromScratchGPT")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("ZeroYB/FromScratchGPT") model = AutoModelForCausalLM.from_pretrained("ZeroYB/FromScratchGPT", device_map="auto") - Transformers.js
How to use ZeroYB/FromScratchGPT with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-generation', 'ZeroYB/FromScratchGPT'); - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use ZeroYB/FromScratchGPT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ZeroYB/FromScratchGPT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ZeroYB/FromScratchGPT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/ZeroYB/FromScratchGPT
- SGLang
How to use ZeroYB/FromScratchGPT with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "ZeroYB/FromScratchGPT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ZeroYB/FromScratchGPT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "ZeroYB/FromScratchGPT" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ZeroYB/FromScratchGPT", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use ZeroYB/FromScratchGPT with Docker Model Runner:
docker model run hf.co/ZeroYB/FromScratchGPT
Fine-tuned on TinyStories-Instruct, in episode 3
Browse files19 unmodified lines20212223232425262 unmodified lines293031323332333435365 unmodified lines424344454546474819 unmodified lines[TinyStories](https://huggingface.co/datasets/roneneldan/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.This revision, `ep003-sft`: Fine-tuned on TinyStories-Instruct, in episode 3.
It has 6 Transformer blocks and 384 embedding channels. Its vocabulary has 10,000 tokens.
2 unmodified lines```pythonfrom transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("ZeroYB/FromScratchGPT", revision="ep002-pretrain")model = AutoModelForCausalLM.from_pretrained("ZeroYB/FromScratchGPT", revision="ep002-pretrain")tokenizer = AutoTokenizer.from_pretrained("ZeroYB/FromScratchGPT", revision="ep003-sft")model = AutoModelForCausalLM.from_pretrained("ZeroYB/FromScratchGPT", revision="ep003-sft")ids = tokenizer("Once upon a time", return_tensors="pt").input_idsout = 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))5 unmodified lines```jsimport { 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 writer = await pipeline("text-generation", "ZeroYB/FromScratchGPT", { dtype: "q8", revision: "ep003-sft" });const [out] = await writer("Once upon a time", { max_new_tokens: 100, do_sample: true, top_k: 50 });```
README.md+4-4