Reference for ultralytics/utils/dist.py
Note
This file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/utils/dist.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
ultralytics.utils.dist.find_free_network_port
Find a free port on localhost.
It is useful in single-node training when we don't want to connect to a real main node but have to set the
MASTER_PORT
environment variable.
Returns:
Type | Description |
---|---|
int
|
The available network port number. |
Source code in ultralytics/utils/dist.py
ultralytics.utils.dist.generate_ddp_file
Generates a DDP file and returns its file name.
Source code in ultralytics/utils/dist.py
ultralytics.utils.dist.generate_ddp_command
Generate command for distributed training.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
world_size
|
int
|
Number of processes to spawn for distributed training. |
required |
trainer
|
object
|
The trainer object containing configuration for distributed training. |
required |
Returns:
Name | Type | Description |
---|---|---|
cmd |
List[str]
|
The command to execute for distributed training. |
file |
str
|
Path to the temporary file created for DDP training. |
Source code in ultralytics/utils/dist.py
ultralytics.utils.dist.ddp_cleanup
📅 Created 1 year ago
✏️ Updated 6 months ago