distributed-llm-pretraining-torchtitan
Provides PyTorch-native distributed LLM pretraining using torchtitan with 4D parallelism (FSDP2, TP, PP, CP). Use when pretraining Llama 3.1, DeepSeek V3, or custom models at scale from 8 to 512+ GPUs with Float8, torch.compile, and distributed checkpointing.
Installation
Pick a client and clone the repository into its skills directory.
Installation
About this skill
Provides PyTorch-native distributed LLM pretraining using torchtitan with 4D parallelism (FSDP2, TP, PP, CP). Use when pretraining Llama 3.1, DeepSeek V3, or custom models at scale from 8 to 512+ GPUs with Float8, torch.compile, and distributed checkpointing.
How to use
Zainstaluj TorchTitan za pomocą pip install torchtitan lub klonując repozytorium PyTorch i instalując zależności z requirements.txt. Wymaga PyTorch w wersji 2.6.0 lub nowszej.
Pobierz tokenizer modelu, który chcesz trenować. Przejdź na https://huggingface.co/settings/tokens, wygeneruj token dostępu, a następnie uruchom python scripts/download_hf_assets.py --repo_id meta-llama/Llama-3.1-8B --assets tokenizer --hf_token=TWÓJ_TOKEN (zastąp TWÓJ_TOKEN swoim tokenem HuggingFace).
Przygotuj plik konfiguracji treningowej w formacie TOML. Możesz użyć istniejącego szablonu z ./torchtitan/models/llama3/train_configs/llama3_8b.toml lub stworzyć własny, definiując parametry takie jak folder wyjściowy, rozmiar modelu i ustawienia paralelizacji.
Uruchom trening na dostępnych GPU-ach, wykonując ./run_train.sh z wskazaniem pliku konfiguracji. Na pojedynczym węźle z 8 GPU-ami użyj CONFIG_FILE="./torchtitan/models/llama3/train_configs/llama3_8b.toml" ./run_train.sh.
Monitoruj postęp treningowy i zarządzaj checkpointami. TorchTitan automatycznie zapisuje punkty kontrolne w folderze dump_folder zdefiniowanym w konfiguracji, co umożliwia wznowienie treningów w razie przerwania.