Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
Answered
I Want To Save Some Data On My Outputmodel In Order To Make It More Accessible When I'M Using The Model. When I Use

I want to save some data on my OutputModel in order to make it more accessible when I'm using the model. When I use myOuputModel.save_metadata("somekey", "someval", "str") I get failed validation when I try to upload the model.

jsonschema.exceptions.ValidationError: 'model' is a required property     

(...)
     'required': ['model', 'metadata'],
     'type': 'object'}

On instance:
    {'metadata': [{'key': 'final_score',
                   'type': 'float',
                   'value': '0.00)'}],
     'replace_metadata': False}

I've tried with both set_metadata and set_all_metadata(replace=False) but still get the same.

  
  
Posted one year ago
Votes Newest

Answers 4


Hi @<1562973083189383168:profile|GrievingDuck15> , do you have a standalone snippet that reproduces this error?

  
  
Posted one year ago

I'll make one:)

  
  
Posted one year ago

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.

  
  
Posted one year ago

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.

  
  
Posted one year ago