Skip to content

Commit 4e69043

Browse files
committed
🛠️ fix dataset download for models other than YOLOv8
1 parent 29ef89e commit 4e69043

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

roboflow/core/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ def callback(content: dict) -> dict:
570570
if format in ["yolov5pytorch", "yolov7pytorch", "yolov8"]:
571571
content["train"] = location + content["train"].lstrip("..")
572572
content["val"] = location + content["val"].lstrip("..")
573-
if not get_wrong_dependencies_versions([("ultralytics", ">=", "8.0.30")]):
573+
if not get_wrong_dependencies_versions([("ultralytics", ">=", "8.0.30")], pass_uninstalled=True):
574574
content["train"] = "train/images"
575575
content["val"] = "valid/images"
576576
content["test"] = "test/images"

roboflow/util/versions.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55

66

77
def get_wrong_dependencies_versions(
8-
dependencies_versions: List[Tuple[str, str, str]]
8+
dependencies_versions: List[Tuple[str, str, str]], pass_uninstalled: bool = False
99
) -> List[Tuple[str, str, str, str]]:
1010
"""
11-
Get a list of missmatching dependencies with current version installed.
11+
Get a list of mismatching dependencies with current version installed.
1212
E.g., assuming we pass `get_wrong_dependencies_versions([("torch", "==", "1.2.0")]), we will check if the current version of `torch` is `==1.2.0`. If not, we will return `[("torch", "==", "1.2.0", "<current_installed_version>")]
1313
1414
We support `<=`, `==`, `>=`
1515
1616
Args:
1717
dependencies_versions (List[Tuple[str, str]]): List of dependencies we want to check, [("<package_name>", "<version_number_to_check")]
18+
pass_uninstalled (bool): By default get_wrong_dependencies_versions will throw exception if <package_name> is not installed. You can pass_uninstalled packages by setting this parameter to True.
1819
1920
Returns:
2021
List[Tuple[str, str, str]]: List of dependencies with wrong version, [("<package_name>", "<version_number_to_check", "<current_version>")]
@@ -26,18 +27,23 @@ def get_wrong_dependencies_versions(
2627
"<=": lambda x, y: x <= y,
2728
}
2829
for dependency, order, version in dependencies_versions:
29-
module = import_module(dependency)
30-
module_version = module.__version__
31-
if order not in order_funcs:
32-
raise ValueError(
33-
f"order={order} not supported, please use `{', '.join(order_funcs.keys())}`"
34-
)
35-
36-
is_okay = order_funcs[order](Version(module_version), Version(version))
37-
if not is_okay:
38-
wrong_dependencies_versions.append(
39-
(dependency, order, version, module_version)
40-
)
30+
try:
31+
module = import_module(dependency)
32+
module_version = module.__version__
33+
if order not in order_funcs:
34+
raise ValueError(
35+
f"order={order} not supported, please use `{', '.join(order_funcs.keys())}`"
36+
)
37+
38+
is_okay = order_funcs[order](Version(module_version), Version(version))
39+
if not is_okay:
40+
wrong_dependencies_versions.append(
41+
(dependency, order, version, module_version)
42+
)
43+
except Exception as e:
44+
if pass_uninstalled:
45+
continue
46+
raise e
4147
return wrong_dependencies_versions
4248

4349

0 commit comments

Comments
 (0)