Skip to content

Commit

Permalink
Fix overrides training cfg bug (ultralytics#10002)
Browse files Browse the repository at this point in the history
Co-authored-by: UltralyticsAssistant <[email protected]>
Co-authored-by: Glenn Jocher <[email protected]>
Co-authored-by: Ultralytics AI Assistant <[email protected]>
Co-authored-by: Laughing-q <[email protected]>
  • Loading branch information
5 people authored Apr 14, 2024
1 parent a506a55 commit 3bbbdcf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ultralytics/engine/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,12 @@ def train(
checks.check_pip_update_available()

overrides = yaml_load(checks.check_yaml(kwargs["cfg"])) if kwargs.get("cfg") else self.overrides
custom = {"data": DEFAULT_CFG_DICT["data"] or TASK2DATA[self.task]} # method defaults
custom = {
# NOTE: handle the case when 'cfg' includes 'data'.
"data": overrides.get("data") or DEFAULT_CFG_DICT["data"] or TASK2DATA[self.task],
"model": self.overrides["model"],
"task": self.task,
} # method defaults
args = {**overrides, **custom, **kwargs, "mode": "train"} # highest priority args on the right
if args.get("resume"):
args["resume"] = self.ckpt_path
Expand Down

0 comments on commit 3bbbdcf

Please sign in to comment.