@@ -74,11 +74,7 @@ def __init__(
7474 else :
7575 self .__api_key = api_key
7676 self .name = name
77-
78- # FIXME: the version argument is inconsistently passed into this object.
79- # Sometimes it is passed as: test-workspace/test-project/2
80- # Other times, it is passed as: 2
81- self .version = version
77+ self .version = unwrap_version_id (version_id = version )
8278 self .type = type
8379 self .augmentation = version_dict ["augmentation" ]
8480 self .created = version_dict ["created" ]
@@ -139,7 +135,6 @@ def __check_if_generating(self):
139135 url = f"{ API_URL } /{ self .workspace } /{ self .project } /{ self .version } ?nocache=true"
140136 response = requests .get (url , params = {"api_key" : self .__api_key })
141137 response .raise_for_status ()
142-
143138 if response .json ()["version" ]["progress" ] == None :
144139 progress = 0.0
145140 else :
@@ -197,11 +192,11 @@ def download(self, model_format=None, location=None, overwrite: bool = True):
197192 try :
198193 import_module ("ultralytics" )
199194 print_warn_for_wrong_dependencies_versions (
200- [("ultralytics" , "==" , "8.0.134 " )]
195+ [("ultralytics" , "==" , "8.0.196 " )]
201196 )
202197 except ImportError as e :
203198 print (
204- "[WARNING] we noticed you are downloading a `yolov8` datasets but you don't have `ultralytics` installed. Roboflow `.deploy` supports only models trained with `ultralytics==8.0.134 `, to intall it `pip install ultralytics==8.0.134 `."
199+ "[WARNING] we noticed you are downloading a `yolov8` datasets but you don't have `ultralytics` installed. Roboflow `.deploy` supports only models trained with `ultralytics==8.0.196 `, to intall it `pip install ultralytics==8.0.196 `."
205200 )
206201 # silently fail
207202 pass
@@ -460,7 +455,7 @@ def live_plot(epochs, mAP, loss, title=""):
460455 # return the model object
461456 return self .model
462457
463- # @warn_for_wrong_dependencies_versions([("ultralytics", "==", "8.0.134 ")])
458+ # @warn_for_wrong_dependencies_versions([("ultralytics", "==", "8.0.196 ")])
464459 def deploy (self , model_type : str , model_path : str ) -> None :
465460 """Uploads provided weights file to Roboflow
466461
@@ -490,7 +485,7 @@ def deploy(self, model_type: str, model_path: str) -> None:
490485 )
491486
492487 print_warn_for_wrong_dependencies_versions (
493- [("ultralytics" , "==" , "8.0.134 " )], ask_to_continue = True
488+ [("ultralytics" , "==" , "8.0.196 " )], ask_to_continue = True
494489 )
495490
496491 elif "yolov5" in model_type or "yolov7" in model_type :
@@ -775,7 +770,7 @@ def data_yaml_callback(content: dict) -> dict:
775770 try :
776771 # get_wrong_dependencies_versions raises exception if ultralytics is not installed at all
777772 if format == "yolov8" and not get_wrong_dependencies_versions (
778- dependencies_versions = [("ultralytics" , "==" , "8.0.134 " )]
773+ dependencies_versions = [("ultralytics" , "==" , "8.0.196 " )]
779774 ):
780775 content ["train" ] = "train/images"
781776 content ["val" ] = "valid/images"
@@ -802,3 +797,7 @@ def __str__(self):
802797 "workspace" : self .workspace ,
803798 }
804799 return json .dumps (json_value , indent = 2 )
800+
801+
802+ def unwrap_version_id (version_id : str ) -> str :
803+ return version_id if "/" not in str (version_id ) else version_id .split ("/" )[- 1 ]
0 commit comments