Ok, the mistake was staring me in the eye the entire time.
I thought that set_metadata
worked on the local output model. But what it actually does is try to update metadata on the remote. The output model doesn't exist on the remote before you call update_weights
, so you have to set_metadata
after upload.
import torch
import torchvision
from clearml import Task, OutputModel
scripted_model = torch.jit.script(torchvision.models.resnet18())
scripted_model.save("model.pt")
task = Task.init(project_name="OutputModelMVE", task_name="Testing shit")
outputmodel = OutputModel(task=task, framework='PyTorch')
outputmodel.update_labels({'Clearml': 0, 'Debug': 1})
outputmodel.set_upload_destination(INSERT DESTINATION)
metadatas = dict(Score=("0.2", "float"),
SomeField=("SomeField", "str"),
OtherField=("OtherField", "str"))
for key, (val, type) in metadatas.items():
outputmodel.set_metadata(key, val, type, )
outputmodel.update_weights(weights_filename="model.pt",
target_filename="model.pt",
auto_delete_file=False,
is_package=True)
outputmodel.wait_for_uploads()
If you remove lines 17-18 and dont't change the metadtata the upload works.
Hi @<1562973083189383168:profile|GrievingDuck15> , do you have a standalone snippet that reproduces this error?