Skip to content

Commit

Permalink
Merge pull request #334 from roboflow/fix-yaml-yolo
Browse files Browse the repository at this point in the history
bugfix - downloading yolov8 files incorrectly amends data.yaml
  • Loading branch information
tonylampada authored Oct 15, 2024
2 parents a823346 + c0e0e5a commit 7fe28e5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
2 changes: 1 addition & 1 deletion roboflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from roboflow.models import CLIPModel, GazeModel # noqa: F401
from roboflow.util.general import write_line

__version__ = "1.1.47"
__version__ = "1.1.48"


def check_key(api_key, model, notebook, num_retries=0):
Expand Down
18 changes: 2 additions & 16 deletions roboflow/core/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import sys
import time
import zipfile
from importlib import import_module
from typing import TYPE_CHECKING, Optional, Union

import requests
Expand Down Expand Up @@ -206,19 +205,6 @@ def download(self, model_format=None, location=None, overwrite: bool = False):

self.__wait_if_generating()

if model_format == "yolov8":
# if ultralytics is installed, we will assume users will want to use yolov8 and we check for the supported version # noqa: E501 // docs
try:
import_module("ultralytics")
print_warn_for_wrong_dependencies_versions([("ultralytics", "==", "8.0.196")])
except ImportError:
print(
"[WARNING] we noticed you are downloading a `yolov8` datasets but you don't have `ultralytics` installed. " # noqa: E501 // docs
"Roboflow `.deploy` supports only models trained with `ultralytics==8.0.196`, to intall it `pip install ultralytics==8.0.196`." # noqa: E501 // docs
)
# silently fail
pass

model_format = self.__get_format_identifier(model_format)

if model_format not in self.exports:
Expand Down Expand Up @@ -246,7 +232,7 @@ def download(self, model_format=None, location=None, overwrite: bool = False):

self.__download_zip(link, location, model_format)
self.__extract_zip(location, model_format)
self.__reformat_yaml(location, model_format)
self.__reformat_yaml(location, model_format) # TODO: is roboflow-python a place to be munging yaml files?

return Dataset(self.name, self.version, model_format, os.path.abspath(location))

Expand Down Expand Up @@ -957,7 +943,7 @@ def data_yaml_callback(content: dict) -> dict:
content["train"] = location + content["train"].lstrip(".")
content["val"] = location + content["val"].lstrip(".")
content["test"] = location + content["test"].lstrip(".")
if format in ["yolov5pytorch", "yolov7pytorch", "yolov8", "yolov9"]:
if format in ["yolov5pytorch", "yolov7pytorch"]:
content["train"] = location + content["train"].lstrip("..")
content["val"] = location + content["val"].lstrip("..")
try:
Expand Down
4 changes: 2 additions & 2 deletions tests/manual/debugme.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# args = parser.parse_args(f"upload {thisdir}/../datasets/chess -w wolfodorpythontests -p chess".split()) # noqa: E501 // docs
args = parser.parse_args(
# ["login"]
# "download https://universe.roboflow.com/gdit/aerial-airport".split()
"download -f yolov8 https://universe.roboflow.com/gdit/aerial-airport".split()
# "project list -w wolfodorpythontests".split()
# "project get cultura-pepino-dark".split()
# "workspace list".split()
Expand All @@ -42,6 +42,6 @@
# f"import {thisdir}/data/cultura-pepino-yolov5pytorch -w wolfodorpythontests -p yellow-auto -c 100 -n papaiasso".split() # noqa: E501 // docs
# f"import {thisdir}/../datasets/mosquitos -w wolfodorpythontests -p yellow-auto -n papaiasso".split() # noqa: E501 // docs
# f"deployment list".split() # noqa: E501 // docs
f"import -w tonyprivate -p meh-plvrv {thisdir}/../datasets/paligemma/".split() # noqa: E501 // docs
# f"import -w tonyprivate -p meh-plvrv {thisdir}/../datasets/paligemma/".split() # noqa: E501 // docs
)
args.func(args)

0 comments on commit 7fe28e5

Please sign in to comment.