| --- |
| license: mit |
| language: |
| - en |
| pretty_name: minimal-distribution |
| --- |
| |
| # Run distributed programs on the HF infra |
|
|
| This is a collection of scripts that showcase minimal examples of distributed programming. All the scripts are taken from [The Ultra-Scale Playbook](https://huggingface.co/spaces/nanotron/ultrascale-playbook) |
|
|
| ## Run the scripts |
|
|
| To run an example on HF's infra use the following: |
| ``` |
| hf jobs run --detach --flavor l4x4 ghcr.io/astral-sh/uv:debian /bin/bash -c \ |
| "uv venv .venv --python 3.12 && \ |
| source .venv/bin/activate && \ |
| uv pip install --upgrade torch numpy && \ |
| wget https://huggingface.co/datasets/ariG23498/distributed/raw/main/<SCRIPT_NAME> && \ |
| torchrun --nproc-per-node=4 <SCRIPT_NAME>" |
| ``` |
| Rememeber to replace the `<SCRIPT_NAME>` with the script that you want to run. |
|
|
| You would need a Pro account to run the script on Hugging Face's Infra. To know more: https://huggingface.co/docs/huggingface_hub/guides/jobs |