Instructions to use EleutherAI/GPT-2-wikitext-chunks with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use EleutherAI/GPT-2-wikitext-chunks with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="EleutherAI/GPT-2-wikitext-chunks")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("EleutherAI/GPT-2-wikitext-chunks") model = AutoModelForCausalLM.from_pretrained("EleutherAI/GPT-2-wikitext-chunks", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use EleutherAI/GPT-2-wikitext-chunks with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "EleutherAI/GPT-2-wikitext-chunks" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EleutherAI/GPT-2-wikitext-chunks", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/EleutherAI/GPT-2-wikitext-chunks
- SGLang
How to use EleutherAI/GPT-2-wikitext-chunks 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/GPT-2-wikitext-chunks" \ --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/GPT-2-wikitext-chunks", "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/GPT-2-wikitext-chunks" \ --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/GPT-2-wikitext-chunks", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use EleutherAI/GPT-2-wikitext-chunks with Docker Model Runner:
docker model run hf.co/EleutherAI/GPT-2-wikitext-chunks
File size: 1,289 Bytes
48a7559 8bbd516 48a7559 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | ---
license: mit
base_model: gpt2
datasets:
- EleutherAI/bergson-wikitext-512-chunks
library_name: transformers
pipeline_tag: text-generation
---
# GPT-2 fine-tuned on bergson-wikitext-512-chunks
GPT-2 (124M) fine-tuned on [EleutherAI/bergson-wikitext-512-chunks](https://huggingface.co/datasets/EleutherAI/bergson-wikitext-512-chunks)
(WikiText-2 pre-chunked to 512-token sequences, 4,608 train chunks) using the
[bergson](https://github.com/EleutherAI/bergson) MAGIC trainer, as the trained
model for MAGIC attribution experiments.
## Training
- 4 epochs, global batch size 64 (8x data parallel), 288 steps
- AdamW, polynomial LR schedule: lr 8e-4 (start 1e-6, end 8e-5), 25% warmup, fp32
- Loss on held-out `test[:4]` chunks: 3.22 (base gpt2: 3.62)
## Files
- Standard HF model + tokenizer files
- `bergson_config.yaml` — the fully-resolved bergson run config (all fields incl. defaults) that produced this model; rerun with `python -m bergson bergson_config.yaml`
- `optimizer.pt` — AdamW second moments (`exp_avg_sq`) at the final training
step, in bergson's `optimizer.pt` normalizer format
(`{"state": {idx: {"exp_avg_sq": ...}}, "param_groups": [...]}` with `idx`
indexing deduplicated `model.named_parameters()`), for gradient
normalization in attribution runs.
|