Repository navigation
Quick Start
Sudhanshu edited this page Nov 11, 2026
·
1 revision
Run commands from the code-repository root, where llm_ddp_parallel_training.py exists.
python llm_ddp_parallel_training.py --model tiny --cpu --max-steps 2 --save-dir ddp_example_outputpython -m torch.distributed.run --standalone --nproc_per_node=2 llm_ddp_parallel_training.py --model tiny --cpu --batch-size 2 --max-steps 2Expected pattern (exact loss values can vary):
Mode=tiny, world_size=2, backend=gloo, per_device_batch=2, global_batch=4
Rank 0/2 on cpu: first batch has sample IDs [...]
Rank 1/2 on cpu: first batch has sample IDs [...]
epoch=1 step=1 mean_loss=...
Tiny Transformer saved at: .../tiny_transformer.pt
python -m torch.distributed.run --standalone --nproc_per_node=1 llm_ddp_parallel_training.py --model qwen --batch-size 1 --seq-len 64 --max-steps 2This command downloads pretrained weights and requires compatible CUDA hardware and dependencies. To use two CUDA GPUs, confirm torch.cuda.device_count() >= 2 and change --nproc_per_node=2. Do not run more processes than devices.
python llm_ddp_parallel_training.py --model tiny --cpu --corpus-file examples/sample_corpus.txt --repeat 1 --max-steps 2See Configuration and Troubleshooting.
Distributed LLM Training · PyTorch DDP (educational) — Home · System-Architecture · Low-Level-Design · Publishing-the-Wiki
This project is licensed under the Apache License, Version 2.0.© 2026 Sudhanshu Shukla · Licensed under the Apache License, Version 2.0.