This commit is contained in:
UltralyticsAssistant 2025-02-23 15:42:23 +00:00
parent ed9b85f0d2
commit 6fe685f9aa

View File

@ -95,12 +95,12 @@ from utils.torch_utils import (
) )
# version check # version check
#if torch.__version__.startswith("1.8"): # if torch.__version__.startswith("1.8"):
# Autocast = torch.cuda.amp.autocast(enabled=amp) # Autocast = torch.cuda.amp.autocast(enabled=amp)
# GradScaler = torch.cuda.amp.GradScaler # GradScaler = torch.cuda.amp.GradScaler
#else: # else:
# Autocast = torch.amp.autocast("cuda", enabled=amp) # Autocast = torch.amp.autocast("cuda", enabled=amp)
# GradScaler = torch.amp.GradScaler # GradScaler = torch.amp.GradScaler
LOCAL_RANK = int(os.getenv("LOCAL_RANK", -1)) # https://pytorch.org/docs/stable/elastic/run.html LOCAL_RANK = int(os.getenv("LOCAL_RANK", -1)) # https://pytorch.org/docs/stable/elastic/run.html
RANK = int(os.getenv("RANK", -1)) RANK = int(os.getenv("RANK", -1))
@ -121,7 +121,7 @@ def train(hyp, opt, device, callbacks):
Returns: Returns:
None None
# #
Models and datasets download automatically from the latest YOLOv5 release. Models and datasets download automatically from the latest YOLOv5 release.
Example: Example:
@ -422,7 +422,7 @@ def train(hyp, opt, device, callbacks):
imgs = nn.functional.interpolate(imgs, size=ns, mode="bilinear", align_corners=False) imgs = nn.functional.interpolate(imgs, size=ns, mode="bilinear", align_corners=False)
# Forward # Forward
#with Autocast: # with Autocast:
amp_autocast = None amp_autocast = None
if torch.__version__.startswith("1.8"): if torch.__version__.startswith("1.8"):
amp_autocast = torch.cuda.amp.autocast(enabled=amp) amp_autocast = torch.cuda.amp.autocast(enabled=amp)