{"id":23697955,"url":"https://github.com/huggingface/picotron","last_synced_at":"2025-10-14T15:32:18.471Z","repository":{"id":268830459,"uuid":"859282056","full_name":"huggingface/picotron","owner":"huggingface","description":"Minimalistic 4D-parallelism distributed training framework for education purpose","archived":false,"fork":false,"pushed_at":"2025-08-26T13:47:24.000Z","size":3226,"stargazers_count":1834,"open_issues_count":11,"forks_count":136,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-09-30T18:02:30.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/huggingface.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-09-18T12:01:22.000Z","updated_at":"2025-09-30T03:37:49.000Z","dependencies_parsed_at":"2025-02-24T14:26:50.904Z","dependency_job_id":"1ec5bdea-cb25-49ec-a9ba-bf2dde4d249d","html_url":"https://github.com/huggingface/picotron","commit_stats":null,"previous_names":["huggingface/picotron"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/huggingface/picotron","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Fpicotron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Fpicotron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Fpicotron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Fpicotron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/huggingface","download_url":"https://codeload.github.com/huggingface/picotron/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/huggingface%2Fpicotron/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279019322,"owners_count":26086711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-30T07:01:39.038Z","updated_at":"2025-10-14T15:32:18.436Z","avatar_url":"https://github.com/huggingface.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# picotron\nIn the spirit of [NanoGPT](https://github.com/karpathy/nanoGPT), we created Picotron: The minimalist \u0026 most-hackable repository for pre-training Llama-like models with [4D Parallelism](https://arxiv.org/abs/2407.21783) (Data, Tensor, Pipeline, Context parallel). It is designed with simplicity and **educational** purposes in mind, making it an excellent tool for learning and experimentation.\n\n![](assets/banière.png)\n- The code itself is simple and readable: `train.py`, `model.py` and `[data|tensor|pipeline|context]_parallel.py` are all under **300** lines of code.\n\n- Performance is not the best but still under active development. We observed 38% MFU on a LLaMA-2-7B model using 64 H100 GPUs and nearly 50% MFU on the SmolLM-1.7B model with 8 H100 GPUs. Benchmarks will come soon\n- Compared to [Nanotron](https://github.com/huggingface/nanotron/tree/main), Picotron is primarily for educational purposes, helping people quickly get familiar with all the techniques in distributed training\n\n# Tutorial videos\n\n- A step by step tutorial on how to build Picotron distributed training framework form scratch:\n    - [Picotron tutorial (playlist)](https://www.youtube.com/playlist?list=PL-_armZiJvAnhcRr6yTJ0__f3Oi-LLi9S) 🎬\n    - [Picotron tutorial (codebase)](https://github.com/huggingface/picotron_tutorial) 👷🏻‍♂️\n\n# Install\n\n```\npip install -e .\n```\n\n# Quick start\n- Get a HF token [here](https://huggingface.co/settings/tokens) to download models from HuggingFace\n\n- GPU\n    ```sh\n    # To create a config file in json format under tmp by default\n    python create_config.py --out_dir tmp --exp_name llama-1B --dp 8 --model_name HuggingFaceTB/SmolLM-1.7B --num_hidden_layers 15  --grad_acc_steps 32 --mbs 4 --seq_len 1024 --hf_token \u003cHF_TOKEN\u003e\n\n    # Locally\n    torchrun --nproc_per_node 8 train.py --config tmp/llama-1B/config.json \n\n    # 3D Parallelism\n    python create_config.py --out_dir tmp --dp 4 --tp 2 --pp 2 --pp_engine 1f1b --exp_name llama-7B --model_name meta-llama/Llama-2-7b-hf  --grad_acc_steps 32 --mbs 4 --seq_len 1024 --hf_token \u003cHF_TOKEN\u003e\n\n    # Slurm\n    python submit_slurm_jobs.py --inp_dir tmp/llama-7B --qos high --hf_token \u003cHF_TOKEN\u003e\n    ```\n\n-  CPU (expect it to be slow)\n    ```sh\n    # 3D Parallelism on CPU\n    python create_config.py --out_dir tmp --exp_name llama-1B-cpu --dp 2 --tp 2 --pp 2 --pp_engine 1f1b --model_name HuggingFaceTB/SmolLM-1.7B --num_hidden_layers 5  --grad_acc_steps 2 --mbs 4 --seq_len 128 --hf_token \u003cHF_TOKEN\u003e --use_cpu\n\n    # Locally\n    torchrun --nproc_per_node 8 train.py --config tmp/llama-1B-cpu/config.json\n    ```\n\n# Citation\nIf you use Picotron, please cite it as:\n\n```bibtex\n@misc{zhao2025picotron,\n  author = {Haojun Zhao and Ferdinand Mom},\n  title = {Picotron: Distributed training framework for education and research experimentation},\n  year = {2025},\n  publisher = {GitHub},\n  journal = {GitHub repository},\n  howpublished = {\\url{https://github.com/huggingface/picotron}}\n}\n```\n\n# Acknowledgements\n\n- [Megatron-LM](https://github.com/NVIDIA/Megatron-LM)\n- [FairScale](https://github.com/facebookresearch/fairscale)\n- [LitGPT](https://github.com/Lightning-AI/lit-gpt)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuggingface%2Fpicotron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhuggingface%2Fpicotron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhuggingface%2Fpicotron/lists"}