Update docs (#73)

Co-authored-by: Laughing-q <1185102784@qq.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
single_channel
Ayush Chaurasia 2 years ago committed by GitHub
parent 681cfc1c35
commit d198f3f9d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -24,11 +24,15 @@ CLI requires no customization or code. You can simply run all tasks from the ter
classify val s-seg.pt classify val s-seg.pt
``` ```
=== "Example" === "Example training"
```bash ```bash
yolo task=detect mode=val model=s.yaml yolo task=detect mode=train model=s.yaml
``` ```
TODO: add terminal screen/gif TODO: add terminal screen/gif
=== "Example training DDP"
```bash
yolo task=detect mode=train model=s.yaml device=\'0,1,2,3\'
```
[CLI Guide](#){ .md-button .md-button--primary} [CLI Guide](#){ .md-button .md-button--primary}
## Python API ## Python API
@ -42,5 +46,6 @@ Ultralytics YOLO comes with pythonic Model and Trainer interface.
model.new("s-seg.yaml") # automatically detects task type model.new("s-seg.yaml") # automatically detects task type
model.load("s-seg.pt") # load checkpoint model.load("s-seg.pt") # load checkpoint
model.train(data="coco128-segments", epochs=1, lr0=0.01, ...) model.train(data="coco128-segments", epochs=1, lr0=0.01, ...)
model.train(data="coco128-segments", epochs=1, lr0=0.01, device="0,1,2,3") # DDP mode
``` ```
[API Guide](#){ .md-button .md-button--primary} [API Guide](#){ .md-button .md-button--primary}

@ -74,6 +74,7 @@ You can easily cusotmize Trainers to support custom tasks or explore R&D ideas.
from ultralytics import yolo from ultralytics import yolo
trainer = yolo.DetectionTrainer(data=..., epochs=1) # override default configs trainer = yolo.DetectionTrainer(data=..., epochs=1) # override default configs
trainer = yolo.DetectionTrainer(data=..., epochs=1, device="1,2,3,4") # DDP
trainer.train() trainer.train()
``` ```
@ -82,6 +83,7 @@ You can easily cusotmize Trainers to support custom tasks or explore R&D ideas.
from ultralytics import yolo from ultralytics import yolo
trainer = yolo.SegmentationTrainer(data=..., epochs=1) # override default configs trainer = yolo.SegmentationTrainer(data=..., epochs=1) # override default configs
trainer = yolo.SegmentationTrainer(data=..., epochs=1, device="0,1,2,3") # DDP
trainer.train() trainer.train()
``` ```
=== "ClassificationTrainer" === "ClassificationTrainer"
@ -89,6 +91,7 @@ You can easily cusotmize Trainers to support custom tasks or explore R&D ideas.
from ultralytics import yolo from ultralytics import yolo
trainer = yolo.ClassificationTrainer(data=..., epochs=1) # override default configs trainer = yolo.ClassificationTrainer(data=..., epochs=1) # override default configs
trainer = yolo.ClassificationTrainer(data=..., epochs=1, device="0,1,2,3") # DDP
trainer.train() trainer.train()
``` ```

@ -119,7 +119,7 @@ class BaseTrainer:
torch.cuda.set_device(rank) torch.cuda.set_device(rank)
self.device = torch.device('cuda', rank) self.device = torch.device('cuda', rank)
self.console.info(f"RANK - WORLD_SIZE - DEVICE: {rank} - {world_size} - {self.device} ") self.console.info(f"RANK - WORLD_SIZE - DEVICE: {rank} - {world_size} - {self.device} ")
mp.use_start_method('spawn', force=True)
dist.init_process_group("nccl" if dist.is_nccl_available() else "gloo", rank=rank, world_size=world_size) dist.init_process_group("nccl" if dist.is_nccl_available() else "gloo", rank=rank, world_size=world_size)
def _setup_train(self, rank, world_size): def _setup_train(self, rank, world_size):

Loading…
Cancel
Save