Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Paula Derrenger 2024-10-05 15:52:35 +02:00 committed by GitHub
parent 73e6861d95
commit 830e8334d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 99 additions and 99 deletions

View file

@ -183,11 +183,10 @@ class Exporter:
# Get the closest match if format is invalid
matches = difflib.get_close_matches(fmt, fmts, n=1, cutoff=0.6) # 60% similarity required to match
if matches:
LOGGER.warning(f"WARNING ⚠️ Invalid export format='{fmt}', updating to format='{matches[0]}'")
fmt = matches[0]
else:
if not matches:
raise ValueError(f"Invalid export format='{fmt}'. Valid formats are {fmts}")
LOGGER.warning(f"WARNING ⚠️ Invalid export format='{fmt}', updating to format='{matches[0]}'")
fmt = matches[0]
flags = [x == fmt for x in fmts]
if sum(flags) != 1:
raise ValueError(f"Invalid export format='{fmt}'. Valid formats are {fmts}")