Improve manual model uploading example

This commit is contained in:
allegroai 2022-11-09 11:28:46 +02:00
parent f0400dd099
commit 89ad484839

View File

@ -7,10 +7,15 @@ task = Task.init(project_name="examples", task_name="Model reporting example")
# Create output model and connect it to the task
output_model = OutputModel(task=task)
# Optional: add labels to the model, so we do not forget
labels = {"background": 0, "cat": 1, "dog": 2}
output_model.update_labels(labels)
model_url = "https://allegro-examples.s3.amazonaws.com/clearml-public-resources/v1.0/clearml-examples-open/newexamples/examples/pytorch%20lightning%20mnist%20example.fb969db720e241e5859d522aa5226b81/models/training.pt"
# Manually log a model file, which will have the labels connected above
# Register an already existing Model file somewhere
model_url = "https://github.com/ultralytics/yolov5/releases/download/v6.2/yolov5x6.pt"
output_model.update_weights(register_uri=model_url)
# Or upload a local model file to be later used
# output_model.update_weights(weights_filename="/path/to/file.onnx")
print("Model registration completed")