huggingface / huggingface/diffusers

ConnectionError: Tried to launch distributed communication on port 29401, but another process is utilizing it. Please specify a different port (such as using the --main_process_port flag or specifying a different main_process_port in your config file) and rerun your script. To automatically use the next open port (on a single node), you can set this to 0.

Offen
#9,856 7 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug stale
Vorherrschende Sprache
Python
Sterne
34.5k
Forks
7.3k
Ø Merge
3 T. 3 Std.
Gemergte PRs (30 T.)
91

Beschreibung

### Describe the bug

ConnectionError: Tried to launch distributed communication on port 29401, but another process is utilizing it. Please specify a different port (such as using the --main_process_port flag or specifying a different main_process_port in your config file) and rerun your script. To automatically use the next open port (on a single node), you can set this to 0.

### Reproduction

export MODEL_NAME="CompVis/stable-diffusion-v1-4" \
export TRAIN_DATA_DIR="/home/qinchang/pro/qc/new_project/newConcept/data/poisoned_images" \
export OUTPUT_DIR="/home/qinchang/pro/qc/new_project/newConcept/model/model_first" \

CUDA_VISIBLE_DEVICES=1 accelerate launch --config_file="/home/qinchang/.cache/huggingface/accelerate/default_config.yaml" train_text_to_image_lora.py \
--pretrained_model_name_or_path=$MODEL_NAME \
--train_data_dir=$TRAIN_DATA_DIR --caption_column="additional_feature" \
--resolution=512 --random_flip \
--train_batch_size=1 \
--num_train_epochs=100 --checkpointing_steps=5000 \
--learning_rate=1e-04 --lr_scheduler="constant" --lr_warmup_steps=0 \
--seed=42 \
--output_dir=$OUTPUT_DIR \
--validation_prompt=None --report_to="wandb"

### Logs

```shell
Traceback (most recent call last):
File "/home/qinchang/miniconda3/envs/diagnosis_new/bin/accelerate", line 8, in
sys.exit(main())
File "/home/qinchang/miniconda3/envs/diagnosis_new/lib/python3.9/site-packages/accelerate/commands/accelerate_cli.py", line 48, in main
args.func(args)
File "/home/qinchang/miniconda3/envs/diagnosis_new/lib/python3.9/site-packages/accelerate/commands/launch.py", line 1159, in launch_command
multi_gpu_launcher(args)
File "/home/qinchang/miniconda3/envs/diagnosis_new/lib/python3.9/site-packages/accelerate/commands/launch.py", line 771, in multi_gpu_launcher
current_env = prepare_multi_gpu_env(args)
File "/home/qinchang/miniconda3/envs/diagnosis_new/lib/python3.9/site-packages/accelerate/utils/launch.py", line 212, in prepare_multi_gpu_env
raise ConnectionError(
ConnectionError: Tried to launch distributed communication on port `29400`, but another process is utilizing it. Please specify a different port (such as using the `--main_process_port` flag or specifying a different `main_process_port` in your config file) and rerun your script. To automatically use the next open port (on a single node), you can set this to `0`.
```

### System Info

Diffusers version: 0.31.0
- Platform: Linux-6.8.0-48-generic-x86_64-with-glibc2.39
- Running on Google Colab?: No
- Python version: 3.9.18
- PyTorch version (GPU?): 2.5.1+cu124 (True)
- Flax version (CPU?/GPU?/TPU?): not installed (NA)
- Jax version: not installed
- JaxLib version: not installed
- Huggingface_hub version: 0.26.2
- Transformers version: 4.46.1
- Accelerate version: 1.1.0
- PEFT version: not installed
- Bitsandbytes version: not installed
- Safetensors version: 0.4.5
- xFormers version: not installed
- Accelerator: NVIDIA GeForce RTX 3090 Ti, 24564 MiB
NVIDIA GeForce RTX 3090 Ti, 24564 MiB
- Using GPU in script?: yes
- Using distributed or parallel set-up in script?: yes
one machine with two gpus

### Who can help?

_No response_

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start with the reported `accelerate launch` command, `train_text_to_image_lora.py`, and the referenced `default_config.yaml`, focusing on `main_process_port` and the distributed launch path. Reproduce the port-in-use case and determine whether the expected outcome is a code change or clearer documentation; done should include a verified resolution for the reported launch failure.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python, pytorch
Bereich
distributed-systems, machine-learning
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
20/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.