> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Why does my training hang with distributed training?

This article helps you resolve training hangs when you use Weights & Biases with distributed training frameworks, so your runs can start and finish without stalling.

Two common reasons cause training to stall when you use Weights & Biases with distributed training:

* **Stalls at the beginning of training**: Multiprocessing can interfere with the multiprocessing from distributed training frameworks.
* **Stalls at the end of training**: The Weights & Biases process doesn't detect when to exit.

## Fix hangs at the start

If your run stalls as training begins, the cause is usually a conflict between multiprocessing and the distributed training framework's multiprocessing. To resolve this, enable W\&B Service, which is the default for W\&B SDK `0.13.0` and later. If you're on an older version, upgrade your SDK:

```bash theme={"system"}
pip install --upgrade wandb
```

For W\&B SDK `0.12.5` through `0.12.x`, enable W\&B Service explicitly:

```python theme={"system"}
def main():
    wandb.require("service")
    # rest of your script
```

For W\&B SDK `0.12.4` and earlier, set the `WANDB_START_METHOD` environment variable:

```bash theme={"system"}
export WANDB_START_METHOD=thread
```

After you enable W\&B Service (or set the start method on older SDKs), your distributed training run starts without stalling.

## Fix hangs at the end

If your run stalls after training completes, Weights & Biases doesn't detect that the run is finished. Call `wandb.finish()` at the end of your training script to signal to Weights & Biases that the run is complete:

```python theme={"system"}
wandb.finish()
```

This call uploads all data and exits the Weights & Biases process cleanly.

For more information, see [Distributed training](/products/wandb/track/log/distributed-training).

***

<Badge stroke shape="pill" color="blue" size="md">[Experiments](/support/models/tags/experiments)</Badge><Badge stroke shape="pill" color="blue" size="md">[Run Crashes](/support/models/tags/run-crashes)</Badge>
