Zaktualizuj 'ml_pytorch_mlflow.py'

This commit is contained in:
Sebastian Wałęsa 2022-05-15 22:15:17 +02:00
parent 7397c907a0
commit 5662816b96

View File

@ -151,17 +151,16 @@ def my_main(epochs):
print(inputs)
# input_example = val_ds[0]
# # input_example = input_example.unsqueeze(0)
# signature = infer_signature(input_[0], prediction(input_[0], model))
# tracking_url_type_store = urlparse(mlflow.get_tracking_uri()).scheme
input_example = inputs[0]
signature = infer_signature(inputs, expected)
tracking_url_type_store = urlparse(mlflow.get_tracking_uri()).scheme
# if tracking_url_type_store != "file":
# mlflow.pytorch.log_model(model, "model", registered_model_name="s478839", signature=siganture,
# input_example=input_example)
# else:
# mlflow.pytorch.log_model(model, "model", signature=siganture, input_example=input_example)
# mlflow.pytorch.save_model(model, "my_model", signature=siganture, input_example=input_example)
if tracking_url_type_store != "file":
mlflow.pytorch.log_model(model, "model", registered_model_name="s478839", signature=siganture,
input_example=input_example)
else:
mlflow.pytorch.log_model(model, "model", signature=siganture, input_example=input_example)
mlflow.pytorch.save_model(model, "my_model", signature=siganture, input_example=input_example)
with mlflow.start_run() as run: