Text Generation
Transformers
Safetensors
llama
toksuite
tokenization
gpt2
bpe
research
robustness
text-generation-inference
Run this model with HF Jobs
Run toksuite/gpt2 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/toksuite/gpt2. 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/toksuite/gpt2 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/toksuite/gpt2. 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/toksuite/gpt2. 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 toksuite/gpt2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use toksuite/gpt2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="toksuite/gpt2")# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("toksuite/gpt2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use toksuite/gpt2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "toksuite/gpt2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "toksuite/gpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/toksuite/gpt2
- SGLang
How to use toksuite/gpt2 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 "toksuite/gpt2" \ --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": "toksuite/gpt2", "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 "toksuite/gpt2" \ --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": "toksuite/gpt2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use toksuite/gpt2 with Docker Model Runner:
docker model run hf.co/toksuite/gpt2
Update README.md
Browse files16 unmodified lines1718192021222310 unmodified lines3435363738394041424344454616 unmodified lineslibrary_name: transformers---<p align="center"><img src="./toksuite-logo.png" alt="TokSuite Logo" width="260"/></p>10 unmodified lines## Tokenizer- **Tokenizer:** GPT-2- **Tokenizer type:** Byte Pair Encoding (BPE)- **Vocabulary size:** ~50K tokens- **Multilingual support:** Limited- **Out-of-vocabulary handling:** Byte-level fallback- **Normalization:** Minimal; preserves raw byte structureThe GPT-2 tokenizer operates on UTF-8 byte sequences and applies BPE merges, allowing it to represent arbitrary Unicode text while maintaining a compact learned vocabulary.---16 unmodified lines1718192021222310 unmodified lines343536373839404142434445464748495051525354555657585960616216 unmodified lineslibrary_name: transformers---<p align="left"><img src="./toksuite-logo.png" alt="TokSuite Logo" width="260"/></p>10 unmodified lines## Tokenizer- **Tokenizer:** GPT-2- **Tokenization method:** BPE- **Vocabulary size:** 50,257- **Out-of-vocabulary handling:** Byte-fallback- **Language coverage:** English-only- **Pretokenization source:** GPT-2**Processing details (Table 3):**- **Numbers:** Split into individual digits- **Contractions:** Learned- **Unicode normalization:** None- **Whitespace / boundary markers:** Whitespace encoded as part of tokens- **Continuation / subword markers:** BPE continuation tokens## Why GPT-2?GPT-2 was included in TokSuite to represent a **canonical English BPE tokenizer** that has been widely adopted in early large-scale language models. As described in the tokenizer selection rationale of the TokSuite paper, GPT-2 provides a well-established reference point for studying subword tokenization without explicit normalization or language-specific preprocessing.Including GPT-2 enables TokSuite to study tokenizer behavior in settings where:- tokenization is optimized for English,- preprocessing and normalization are minimal,- and whitespace is handled implicitly through token boundaries.This makes GPT-2 a foundational tokenizer design within the TokSuite collection.---
README.md+23-7