HuggingFaceFW/fineweb-edu
Viewer • Updated • 3.5B • 618k • 1.1k
How to use rudyon/rudygpt with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="rudyon/rudygpt", trust_remote_code=True) # Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("rudyon/rudygpt", trust_remote_code=True, dtype="auto")How to use rudyon/rudygpt with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "rudyon/rudygpt"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "rudyon/rudygpt",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/rudyon/rudygpt
How to use rudyon/rudygpt with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "rudyon/rudygpt" \
--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": "rudyon/rudygpt",
"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 "rudyon/rudygpt" \
--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": "rudyon/rudygpt",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use rudyon/rudygpt with Docker Model Runner:
docker model run hf.co/rudyon/rudygpt
A 124M parameter causal language model trained from scratch using rudyon/pipeline on the HuggingFaceFW/fineweb-edu dataset.
Training was done on a vast.ai instance with 2x 4090S Ti. Training cost was about ~$10.
import torch
from transformers import AutoTokenizer
# download model.py and pytorch_model.bin manually or via hf_hub_download
from model import GPT, GPTConfig
device = 'cuda' if torch.cuda.is_available() else 'cpu'
tokenizer = AutoTokenizer.from_pretrained("rudyon/rudygpt")
model = GPT(GPTConfig(depth=12, vocab_size=50304))
state_dict = torch.load("pytorch_model.bin", map_location=device)
model.load_state_dict(state_dict)
model.eval()
print(model.generate("Hello!"))