@@ -459,8 +459,10 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best
459459 model_path (str): File path to the model weights to be uploaded.
460460 filename (str, optional): The name of the weights file. Defaults to "weights/best.pt".
461461 """
462+ if model_type .startswith ("yolo11" ):
463+ model_type = model_type .replace ("yolo11" , "yolov11" )
462464
463- supported_models = ["yolov5" , "yolov7-seg" , "yolov8" , "yolov9" , "yolonas" , "paligemma" , "yolov10" , "florence-2" ]
465+ supported_models = ["yolov5" , "yolov7-seg" , "yolov8" , "yolov9" , "yolonas" , "paligemma" , "yolov10" , "florence-2" , "yolov11" ]
464466
465467 if not any (supported_model in model_type for supported_model in supported_models ):
466468 raise (ValueError (f"Model type { model_type } not supported. Supported models are" f" { supported_models } " ))
@@ -518,6 +520,19 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best
518520 "The torch python package is required to deploy yolov5 models."
519521 " Please install it with `pip install torch`"
520522 )
523+
524+ elif "yolov11" in model_type :
525+ try :
526+ import torch
527+ import ultralytics
528+
529+ except ImportError :
530+ raise RuntimeError (
531+ "The ultralytics python package is required to deploy yolov10"
532+ " models. Please install it with `pip install ultralytics`"
533+ )
534+
535+ print_warn_for_wrong_dependencies_versions ([("ultralytics" , ">=" , "8.3.0" )], ask_to_continue = True )
521536
522537 model = torch .load (os .path .join (model_path , filename ))
523538
@@ -530,9 +545,9 @@ def deploy(self, model_type: str, model_path: str, filename: str = "weights/best
530545 class_names .sort (key = lambda x : x [0 ])
531546 class_names = [x [1 ] for x in class_names ]
532547
533- if "yolov8" in model_type or "yolov10" in model_type :
548+ if "yolov8" in model_type or "yolov10" in model_type or "yolov11" in model_type :
534549 # try except for backwards compatibility with older versions of ultralytics
535- if "-cls" in model_type or model_type .startswith ("yolov10" ):
550+ if "-cls" in model_type or model_type .startswith ("yolov10" ) or model_type . startswith ( "yolov11" ) :
536551 nc = model ["model" ].yaml ["nc" ]
537552 args = model ["train_args" ]
538553 else :
0 commit comments