Skip to content

Commit 0494f42

Browse files
committed
specify model weights file name for uploading custom weights
1 parent f0609a9 commit 0494f42

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

roboflow/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from roboflow.models import CLIPModel, GazeModel # noqa: F401
1515
from roboflow.util.general import write_line
1616

17-
__version__ = "1.1.23"
17+
__version__ = "1.1.24"
1818

1919

2020
def check_key(api_key, model, notebook, num_retries=0):

roboflow/core/version.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,13 @@ def live_plot(epochs, mAP, loss, title=""):
419419
return self.model
420420

421421
# @warn_for_wrong_dependencies_versions([("ultralytics", "==", "8.0.196")])
422-
def deploy(self, model_type: str, model_path: str) -> None:
423-
"""Uploads provided weights file to Roboflow
422+
def deploy(self, model_type: str, model_path: str, filename: str = "weights/best.pt") -> None:
423+
"""Uploads provided weights file to Roboflow.
424424
425425
Args:
426-
model_path (str): File path to model weights to be uploaded
426+
model_type (str): The type of the model to be deployed.
427+
model_path (str): File path to the model weights to be uploaded.
428+
filename (str, optional): The name of the weights file. Defaults to "weights/best.pt".
427429
"""
428430

429431
supported_models = ["yolov5", "yolov7-seg", "yolov8", "yolov9", "yolonas"]
@@ -457,7 +459,7 @@ def deploy(self, model_type: str, model_path: str) -> None:
457459
" Please install it with `pip install torch`"
458460
)
459461

460-
model = torch.load(os.path.join(model_path, "weights/best.pt"))
462+
model = torch.load(os.path.join(model_path, filename))
461463

462464
if isinstance(model["model"].names, list):
463465
class_names = model["model"].names

0 commit comments

Comments
 (0)