Unanswered
We Do Want To Have Control Which Files Are Logged In The Model Registry. There Is Such Option In Task.Init(), Auto_Connect_Frameworks=False Or Injecting A Dict() To It.. But Our Tasks Are Created As Being Part Of A Pipeline With Add_Function_Step(). So We
Hi @<1543766544847212544:profile|SorePelican79> ! You could use the following workaround:
from clearml import Task
from clearml.binding.frameworks import WeightsFileHandler
import torch
def filter_callback(
callback_type: WeightsFileHandler.CallbackType,
model_info: WeightsFileHandler.ModelInfo,
):
print(model_info.__dict__)
if (
callback_type == WeightsFileHandler.CallbackType.save
and "filter_out.pt" in model_info.local_model_path
):
return None
return model_info
if __name__ == "__main__":
Task.init(project_name="example", task_name="filter out")
WeightsFileHandler.add_pre_callback(filter_callback)
filter_out_model = torch.nn.Module()
dont_filter_out_model = torch.nn.Module()
torch.save(filter_out_model, "filter_out.pt")
torch.save(dont_filter_out_model, "dont_filter_out_model.pt")
As you can see, you can use WeightsFileHandler
after the task has been initialized
151 Views
0
Answers
one year ago
one year ago