HuggingFaceFW/fineweb-edu
Viewer • Updated • 3.5B • 578k • 1.07k
How to use Alignment-Lab-AI/GPT-2-optim with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Alignment-Lab-AI/GPT-2-optim") # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Alignment-Lab-AI/GPT-2-optim")
model = AutoModelForCausalLM.from_pretrained("Alignment-Lab-AI/GPT-2-optim")How to use Alignment-Lab-AI/GPT-2-optim with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Alignment-Lab-AI/GPT-2-optim"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Alignment-Lab-AI/GPT-2-optim",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/Alignment-Lab-AI/GPT-2-optim
How to use Alignment-Lab-AI/GPT-2-optim with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Alignment-Lab-AI/GPT-2-optim" \
--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": "Alignment-Lab-AI/GPT-2-optim",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "Alignment-Lab-AI/GPT-2-optim" \
--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": "Alignment-Lab-AI/GPT-2-optim",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use Alignment-Lab-AI/GPT-2-optim with Docker Model Runner:
docker model run hf.co/Alignment-Lab-AI/GPT-2-optim
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("Alignment-Lab-AI/GPT-2-optim")
model = AutoModelForCausalLM.from_pretrained("Alignment-Lab-AI/GPT-2-optim")A 124M parameter GPT2 model trained with the 10B fineweb-edu dataset using https://github.com/karpathy/llm.c
Training took 20 hours on a single 4090 GPU (limited to 350W), giving the following graphs:
The training parameters where:
./train_gpt2cu \
-i "dev/data/edu_fineweb10B/edu_fineweb_train_*.bin" \
-j "dev/data/edu_fineweb10B/edu_fineweb_val_*.bin" \
-o log124M \
-e "d12" \
-b 56 -t 1024 \
-d 458752 \
-r 1 \
-z 1 \
-c 0.1 \
-l 0.002 \
-q 0.0 \
-u 700 \
-n 5000 \
-v 250 -s 20000 \
-h 1
The model has had no further finetuning.
Evals using Eleuther AI Harness as described in the open_llm_leaderboard and comparing with those published for openai-community/gpt2
| Eval Test | Score |
|---|---|
| arc_challenge (25 shot) | 24.49 |
| gsm8k (5 shot) | 0.08 |
| hellaswag (10 shot) | 32.64 |
| mmlu (5 shot) | 26.06 |
| truthfulqa (0 shot) | 42.45 |
| winogrande (5 shot) | 52.17 |
| Overall Score | 29.65 |
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Alignment-Lab-AI/GPT-2-optim")