Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Fix] yolov8 export sample fix #1638

Merged
merged 4 commits into from
Jun 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions src/sparseml/yolov8/trainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -754,12 +754,26 @@ def export(self, **kwargs):
deployment_folder = exporter.create_deployment_folder(onnx_model_name=name)
if args["export_samples"]:
trainer_config = get_cfg(cfg=DEFAULT_SPARSEML_CONFIG_PATH)
# First check if the yaml exists locally
if os.path.exists(args["data"]):
trainer_config.data = args["data"]
else:
# If it does not exist, may be a uralytics provided yaml. Try
# downloading and updating path to dataset_path
# Does this case actually happen? I.e. is args["data"] ever not a
# checkpointed local yaml path?
try:
if args["dataset_path"] is not None:
args["data"] = data_from_dataset_path(
args["data"], args["dataset_path"]
)
trainer_config.data = args["data"]
except ValueError:
LOGGER.info(
f"yaml in {args['data']} could not be found. "
"Using default config"
)

if args["dataset_path"] is not None:
args["data"] = data_from_dataset_path(
args["data"], args["dataset_path"]
)
trainer_config.data = args["data"]
trainer_config.imgsz = args["imgsz"]
trainer = DetectionTrainer(trainer_config)
# inconsistency in name between
Expand Down
Loading