Instructions to use EleutherAI/pythia-2.8b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use EleutherAI/pythia-2.8b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="EleutherAI/pythia-2.8b")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("EleutherAI/pythia-2.8b") model = AutoModelForCausalLM.from_pretrained("EleutherAI/pythia-2.8b") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use EleutherAI/pythia-2.8b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "EleutherAI/pythia-2.8b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EleutherAI/pythia-2.8b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/EleutherAI/pythia-2.8b
- SGLang
How to use EleutherAI/pythia-2.8b 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 "EleutherAI/pythia-2.8b" \ --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": "EleutherAI/pythia-2.8b", "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 "EleutherAI/pythia-2.8b" \ --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": "EleutherAI/pythia-2.8b", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use EleutherAI/pythia-2.8b with Docker Model Runner:
docker model run hf.co/EleutherAI/pythia-2.8b
Equal model revisions issue
Hi,
I just noticed that when downloading different revisions of Pythia-2.8b, the same weights are downloaded. For example, "step0" and "main" revisions output the exact same generations, altough they should be really different.
oh yeah I hit this too, spent way too long confused about why my step0 model was generating coherent text lol. it's the safetensors file.
every step branch has a model.safetensors that's just main's final weights. same hash on all of them:
ab496f1c... model.safetensors (5,684,693,096 bytes) β step0, step1000, step100000, main, all identical
the actual checkpoint weights are still there, but only in the sharded model-0000* files, which do differ per step like they should:
step0 model-00001-of-00002.safetensors dee700d6...
step1000 model-00001-of-00002.safetensors f6a6c2f8...
step10000 model-00001-of-00002.safetensors 35f6b564...
and transformers grabs the single model.safetensors before it even looks at the sharded index, so revision="stepN" silently hands you the fully-trained model no matter what N you ask for. use_safetensors=False doesn't save you either β the pytorch_model.bin on the step branches is also just a copy of main's (36f0f93d...). step100000 is the one exception, its .bin is actually unique.
pretty sure it's just leftover from the SFconvertbot safetensors conversion back in 2023 (commit 2a259cd) β it converted main's bin into that ab496f1c file, and the step branches ended up carrying it and nobody removed it when the real shards were added later.
check it without downloading anything:
from huggingface_hub import HfApi
api = HfApi()
for rev in ["step0", "step1000", "step100000", "main"]:
for f in api.get_paths_info("EleutherAI/pythia-2.8b",
["model.safetensors", "model-00001-of-00002.safetensors"], revision=rev):
print(rev, f.path, f.lfs.sha256[:12] if f.lfs else f.blob_id)
workaround that actually works, only pull the shards:
from huggingface_hub import snapshot_download
path = snapshot_download("EleutherAI/pythia-2.8b", revision="step1000",
allow_patterns=["config.json", "tokenizer*", "special_tokens*",
"model-0000*", "model.safetensors.index.json"])
model = AutoModelForCausalLM.from_pretrained(path)
quick way to confirm you actually got different weights: next(model.parameters()).abs().sum() should come out different for each step.
real fix would be dropping that stray model.safetensors (and the stale .bin) off the step branches. fwiw the deduped repo doesn't have the extra file so it loads fine there β might be worth checking the other sizes too.