Collection d'implémentations GPT-2 en Python et Rust pour comparer différentes stratégies d'optimisation.
| Dossier | Description |
|---|---|
numpy-gpt2 | Pure NumPy, single-thread |
numpy-gpt2-kvcache | NumPy avec KV-cache |
pytorch-gpt2 | PyTorch sans cache |
pytorch-gpt2-kvcache | PyTorch avec KV-cache |
transformers-gpt2 | Hugging Face Transformers |
| Dossier | Description |
|---|---|
gpt2-rs-naive | Single-thread baseline |
gpt2-rs-threads-rayon | Rayon work-stealing |
gpt2-rs-threads-crossbeam | Thread pool persistant (crossbeam channels) |
gpt2-rs-threads-crossbeam-scope | Scoped threads (crossbeam::scope) |
gpt2-rs-async-tokio | Async Tokio (spawn_blocking + join!) |
Voir BENCHMARKS.md pour une analyse détaillée.
| Implementation | TTFT | tok/s |
|---|---|---|
| pytorch-gpt2-kvcache | 25 ms | 54 |
| gpt2-rs-threads-crossbeam | 28 ms | 44 |
| gpt2-rs-async-tokio | 50 ms | 46 |
./test-engines.sh # benchmark tous les engines
./test-engines.sh --list # lister engines/modèles disponibles
./test-engines.sh -e pytorch-gpt2-kvcache # engine spécifique
./test-engines.sh -m openai-community/gpt2-xl # modèle spécifique
./test-engines.sh --all # tous les modèles
Python:
source .venv/bin/activate
cd pytorch-gpt2-kvcache
python main.py "Once upon a time" --model openai-community/gpt2 --profile
Rust:
cd gpt2-rs-threads-crossbeam
cargo build --release
./target/release/gpt2-rs-threads-crossbeam \
--model ~/models/openai-community/gpt2 \
--prompt "Once upon a time" \
--max-tokens 30 \
--profile
./download-models.sh
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cd gpt2-rs-threads-crossbeam
cargo build --release
Format: Hugging Face avec model.safetensors.
1 commits
Rust
75.3%
Python
19.0%
Assembly
4.1%
Shell
1.6%
Collection d'implémentations GPT-2 en Python et Rust pour comparer différentes stratégies d'optimisation.
| Dossier | Description |
|---|---|
numpy-gpt2 | Pure NumPy, single-thread |
numpy-gpt2-kvcache | NumPy avec KV-cache |
pytorch-gpt2 | PyTorch sans cache |
pytorch-gpt2-kvcache | PyTorch avec KV-cache |
transformers-gpt2 | Hugging Face Transformers |
| Dossier | Description |
|---|---|
gpt2-rs-naive | Single-thread baseline |
gpt2-rs-threads-rayon | Rayon work-stealing |
gpt2-rs-threads-crossbeam | Thread pool persistant (crossbeam channels) |
gpt2-rs-threads-crossbeam-scope | Scoped threads (crossbeam::scope) |
gpt2-rs-async-tokio | Async Tokio (spawn_blocking + join!) |
Voir BENCHMARKS.md pour une analyse détaillée.
| Implementation | TTFT | tok/s |
|---|---|---|
| pytorch-gpt2-kvcache | 25 ms | 54 |
| gpt2-rs-threads-crossbeam | 28 ms | 44 |
| gpt2-rs-async-tokio | 50 ms | 46 |
./test-engines.sh # benchmark tous les engines
./test-engines.sh --list # lister engines/modèles disponibles
./test-engines.sh -e pytorch-gpt2-kvcache # engine spécifique
./test-engines.sh -m openai-community/gpt2-xl # modèle spécifique
./test-engines.sh --all # tous les modèles
Python:
source .venv/bin/activate
cd pytorch-gpt2-kvcache
python main.py "Once upon a time" --model openai-community/gpt2 --profile
Rust:
cd gpt2-rs-threads-crossbeam
cargo build --release
./target/release/gpt2-rs-threads-crossbeam \
--model ~/models/openai-community/gpt2 \
--prompt "Once upon a time" \
--max-tokens 30 \
--profile
./download-models.sh
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cd gpt2-rs-threads-crossbeam
cargo build --release
Format: Hugging Face avec model.safetensors.
1 commits
Rust
75.3%
Python
19.0%
Assembly
4.1%
Shell
1.6%