Zaktualizuj 'train-mlflow.py'

This commit is contained in:
Kornelia Girejko 2022-05-17 21:28:09 +02:00
parent d703a9eec2
commit 3914f6e091

View File

@ -30,7 +30,7 @@ from urllib.parse import urlparse
from mlflow.models import infer_signature
mlflow.set_experiment("478815")
#mlflow.set_tracking_uri("http://172.17.0.1:5000")
mlflow.set_tracking_uri("http://172.17.0.1:5000")
# Model
class Model(nn.Module):
@ -106,16 +106,16 @@ def my_main(epochs):
print(np.array(X_testing[0]))
#input_example = np.array(X_testing[0])
#siganture = mlflow.models.signature.infer_signature(np.array(X_training), np.array(y_predicted_train))
#tracking_url_type_store = urlparse(mlflow.get_tracking_uri()).scheme
input_example = np.array(X_testing[0])
siganture = mlflow.models.signature.infer_signature(np.array(X_training), np.array(y_predicted_train))
tracking_url_type_store = urlparse(mlflow.get_tracking_uri()).scheme
#if tracking_url_type_store != "file":
# mlflow.pytorch.log_model(model, "model_new", registered_model_name="478815", signature=siganture,
# input_example=input_example)
#else:
# mlflow.pytorch.log_model(model, "model_new", signature=siganture, input_example=input_example)
#mlflow.pytorch.save_model(model, "model_new", signature=siganture, input_example=input_example)
if tracking_url_type_store != "file":
mlflow.pytorch.log_model(model, "model_new", registered_model_name="478815", signature=siganture,
input_example=input_example)
else:
mlflow.pytorch.log_model(model, "model_new", signature=siganture, input_example=input_example)
mlflow.pytorch.save_model(model, "model_new", signature=siganture, input_example=input_example)
rmse = mean_squared_error(y_testing, y_predicted)
#print(rmse)