basetenlabs/kingkong
Python
Captured source
source ↗basetenlabs/kingkong
Language: Python
License: BSD-3-Clause
Stars: 2
Forks: 0
Open issues: 10
Created: 2026-01-13T16:26:49Z
Pushed: 2026-05-09T03:18:52Z
Default branch: main
Fork: no
Archived: no
README:
torchtitan is under extensive development. To use the latest features of torchtitan, we recommend using the most recent PyTorch nightly.
Latest News
- [2025/11] AMD released an optimized fork of
torchtitanfor AMD GPUs. - [2025/10] We released
torchtitanv0.2.0. - [2025/10] SkyPilot now supports
torchtitan! See the tutorial here. - [2025/07] We published [instructions](/torchtitan/models/README.md) on how to add a model to
torchtitan. - [2025/04] Our paper was accepted by ICLR 2025.
- [2024/12] GPU MODE lecture on torchtitan.
- [2024/07] Presentation at PyTorch Conference 2024.
Overview
torchtitan is a PyTorch native platform designed for rapid experimentation and large-scale training of generative AI models. As a minimal clean-room implementation of PyTorch native scaling techniques, torchtitan provides a flexible foundation for developers to build upon. With torchtitan [extension points](docs/extension.md), one can easily create custom extensions tailored to specific needs.
Our mission is to accelerate innovation in the field of generative AI by empowering researchers and developers to explore new modeling architectures and infrastructure techniques.
The Guiding Principles when building torchtitan
- Designed to be easy to understand, use and extend for different training purposes.
- Minimal changes to the model code when applying multi-dimensional parallelism.
- Bias towards a clean, minimal codebase while providing basic reusable / swappable components.
torchtitan has been showcasing PyTorch's latest distributed training features, via support for pretraining Llama 3.1 LLMs of various sizes.
Contributing
We look forward to your contributions!
- To accelerate contributions to and innovations around torchtitan, we host an [
experiments](torchtitan/experiments) folder. New ideas should start there. To contribute, follow the [experiments guidelines](torchtitan/experiments/README.md). - For fixes and contributions to core, follow these [
guidelines](CONTRIBUTING.md).
Llama 3.1 training
Key features available
1. Multi-dimensional composable parallelisms
- [FSDP2](docs/fsdp.md) with per-parameter sharding
- Tensor Parallel (including async TP)
- Pipeline Parallel
- Context Parallel
2. Meta device initialization 3. Selective (layer or operator) and full activation checkpointing 4. Distributed checkpointing (including async checkpointing)
- [Interoperable checkpoints](docs/checkpoint.md) which can be loaded directly into `torchtune` for fine-tuning
5. torch.compile support 6. Float8 support ([how-to](docs/float8.md)) 7. [MXFP8 training for dense and MoE models](docs/mxfp8.md) on Blackwell GPUs. 7. DDP and HSDP 8. TorchFT integration 9. Checkpointable data-loading, with the C4 dataset pre-configured (144M entries) and support for [custom datasets](docs/datasets.md) 10. Gradient accumulation, enabled by giving an additional --training.global_batch_size argument in configuration 11. Flexible learning rate scheduler (warmup-stable-decay) 12. Loss, GPU memory, throughput (tokens/sec), TFLOPs, and MFU displayed and logged via [Tensorboard or Weights & Biases](/docs/metrics.md) 13. [Debugging tools](docs/debugging.md) including CPU/GPU profiling, memory profiling, Flight Recorder, etc. 14. All options easily configured via [toml files](torchtitan/models/llama3/train_configs/) 15. [Helper scripts](scripts/) to
- download tokenizers from Hugging Face
- convert original Llama 3 checkpoints into the expected DCP format
- estimate FSDP/HSDP memory usage without materializing the model
- run distributed inference with Tensor Parallel
We report [performance](benchmarks/llama3_h100_202412_torchtitan.md) on up to 512 GPUs, and verify [loss converging](docs/converging.md) correctness of various techniques.
Dive into the code
You may want to see how the model is defined or how parallelism techniques are applied. For a guided tour, see these files first:
- [torchtitan/train.py](torchtitan/train.py) - the main training loop and high-level setup code
- [torchtitan/models/llama3/model/model.py](torchtitan/models/llama3/model/model.py) - the Llama 3.1 model definition
- [torchtitan/models/llama3/infra/parallelize.py](torchtitan/models/llama3/infra/parallelize.py) - helpers for applying Data Parallel, Tensor Parallel, activation checkpointing, and
torch.compileto the model - [torchtitan/models/llama3/infra/pipeline.py](torchtitan/models/llama3/infra/pipeline.py) - helpers for applying Pipeline Parallel to the model
- [torchtitan/components/checkpoint.py](torchtitan/components/checkpoint.py) - utils for saving/loading distributed checkpoints
- [torchtitan/components/quantization/float8.py](torchtitan/components/quantization/float8.py) - utils for applying Float8 techniques
Installation
One can directly run the source code, or install torchtitan from a nightly build, or a stable release.
From source
This method requires the nightly build of PyTorch, or the latest PyTorch built from source.
git clone https://github.com/pytorch/torchtitan cd…
Excerpt shown — open the source for the full document.
Notability
notability 1.0/10Low traction, trivial new repo