huggingface / huggingface/accelerate

`Accelerate test` failing on an 8-GPU docker instance

Open
#934 6 comments 0 reactions 1 assignee Claimed by @muellerzr View on GitHub
bug wip
Dominant language
Python
Stars
9.9k
Forks
1.5k
Avg merge
5d 2h
Merged PRs (30d)
27

Description

### System Info

```Shell
Host machine:
- Docker version 20.10.22, build 3a2c30b
- 8x A100, 80GB

Docker file:

FROM nvidia/cuda:11.6.2-devel-ubuntu20.04

RUN apt update --fix-missing
RUN apt install -y vim git
RUN apt install -y python3 python3-dev python3-pip
RUN ln -sf python3 /usr/bin/python

RUN pip3 install --no-cache --upgrade pip setuptools
RUN pip3 install accelerate

COPY accelerate_config.yaml /root/.cache/huggingface/accelerate/default_config.yaml
```

Accelerate config:
```
compute_environment: LOCAL_MACHINE
deepspeed_config: {}
distributed_type: MULTI_GPU
downcast_bf16: 'no'
fsdp_config: {}
gpu_ids: all
machine_rank: 0
main_process_ip: null
main_process_port: null
main_training_function: main
mixed_precision: 'no'
num_machines: 1
num_processes: 8
rdzv_backend: static
same_network: true
use_cpu: false
```

Accelerate env:
```
- `Accelerate` version: 0.15.0
- Platform: Linux-5.4.0-1078-kvm-x86_64-with-glibc2.29
- Python version: 3.8.10
- Numpy version: 1.24.0
- PyTorch version (GPU?): 1.13.1+cu117 (True)
- `Accelerate` default config:
- compute_environment: LOCAL_MACHINE
- distributed_type: MULTI_GPU
- mixed_precision: no
- use_cpu: False
- dynamo_backend: NO
- num_processes: 8
- machine_rank: 0
- num_machines: 1
- gpu_ids: all
- main_process_ip: None
- main_process_port: None
- rdzv_backend: static
- same_network: True
- main_training_function: main
- deepspeed_config: {}
- fsdp_config: {}
- megatron_lm_config: {}
- downcast_bf16: no
- tpu_name: None
- tpu_zone: None
- command_file: None
- commands: None
```

### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [X] One of the scripts in the examples/ folder of Accelerate or an officially supported `no_trainer` script in the `examples` folder of the `transformers` repo (such as `run_no_trainer_glue.py`)
- [ ] My own task or dataset (give details below)

### Reproduction/Expectation/Core Issue

- Run the above docker instance with 8 GPUs passed through
- Run `accelerate test`

I get the error `stderr: ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: -7) local_rank: 0 (pid: 35215) of binary: /usr/bin/python3`.

**This test works fine and has no errors on the bare metal machine.**

Do you all have any ideas what might be going on?

### What about CPU-only config?
I also tried a CPU-only config, but `accelerate test` gave me assertion errors (both for docker and bare metal):

```
stderr: Traceback (most recent call last):
stderr: File "/usr/local/lib/python3.8/dist-packages/accelerate/test_utils/scripts/test_script.py", line 359, in
stderr: main()
stderr: File "/usr/local/lib/python3.8/dist-packages/accelerate/test_utils/scripts/test_script.py", line 350, in main
stderr: training_check()
stderr: File "/usr/local/lib/python3.8/dist-packages/accelerate/test_utils/scripts/test_script.py", line 271, in training_check
stderr: accelerator.backward(loss)
stderr: File "/usr/local/lib/python3.8/dist-packages/accelerate/accelerator.py", line 1314, in backward
stderr: self.scaler.scale(loss).backward(**kwargs)
stderr: File "/usr/local/lib/python3.8/dist-packages/torch/cuda/amp/grad_scaler.py", line 164, in scale
stderr: assert outputs.is_cuda or outputs.device.type == 'xla'
stderr: AssertionError
```

The environment:
```
- `Accelerate` version: 0.15.0
- Platform: Linux-5.4.0-1078-kvm-x86_64-with-glibc2.29
- Python version: 3.8.10
- Numpy version: 1.24.0
- PyTorch version (GPU?): 1.13.1+cu117 (True)
- `Accelerate` default config:
- compute_environment: LOCAL_MACHINE
- distributed_type: MULTI_CPU
- mixed_precision: no
- use_cpu: True
- dynamo_backend: NO
- num_processes: 4
- machine_rank: 0
- num_machines: 1
- gpu_ids: None
- main_process_ip: None
- main_process_port: None
- rdzv_backend: static
- same_network: True
- main_training_function: main
- deepspeed_config: {}
- fsdp_config: {}
- megatron_lm_config: {}
- downcast_bf16: no
- tpu_name: None
- tpu_zone: None
- command_file: None
- commands: None
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.