Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy model without version #348

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

lrosemberg
Copy link
Contributor

@lrosemberg lrosemberg commented Dec 16, 2024

Description

You can now deploy versions without specifying the version number. To do this, you can use the deploy_model method from the Workspace:

Example:

workspace.deploy_model(
    model_type="yolov8",
    model_path="/path/to/model",
    model_name="my-model123"
    project_ids=["project1", "project2", "project3"],
    filename="weights/best.pt"
)

Alternatively, you can use the CLI:

# Deploy to a specific version
roboflow upload_model -p project1 -v 1 ...

# Deploy to multiple projects without specifying a version
roboflow upload_model -p project1 -p project2 -p project3 -n my-model123 ...

General overview

image

Type of change

  • New feature (non-breaking change which adds functionality)

How has this change been tested, please provide a testcase or example of how you tested the change?

  • To be done

@lrosemberg lrosemberg marked this pull request as draft December 16, 2024 17:57
@lrosemberg lrosemberg self-assigned this Dec 16, 2024
@lrosemberg lrosemberg changed the title Upload model without version Deploy model without version Dec 18, 2024
@tonylampada tonylampada marked this pull request as ready for review December 19, 2024 19:11

except ImportError:
raise RuntimeError(
"The ultralytics python package is required to deploy yolov10"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"The ultralytics python package is required to deploy yolov10"
"The ultralytics python package is required to deploy yolov11"


zip_file_name = "roboflow_deploy.zip"

with zipfile.ZipFile(os.path.join(model_path, zip_file_name), "w") as zipMe:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for now, but we should stop zipping these big files with Python. It is too slow for big files.

Comment on lines +291 to +312
list_files = [
"results.json",
"results.png",
"model_artifacts.json",
"state_dict.pt",
]

zip_file_name = "roboflow_deploy.zip"

with zipfile.ZipFile(os.path.join(model_path, zip_file_name), "w") as zipMe:
for file in list_files:
if os.path.exists(os.path.join(model_path, file)):
zipMe.write(
os.path.join(model_path, file),
arcname=file,
compress_type=zipfile.ZIP_DEFLATED,
)
else:
if file in ["model_artifacts.json", filename]:
raise (ValueError(f"File {file} not found. Please make sure to provide a" " valid model path."))

return zip_file_name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like some duplicated code, but we can organize it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants