Zaktualizuj 'train-mlflow.py'
This commit is contained in:
parent
3f679266e0
commit
6e476a06ff
@ -28,8 +28,8 @@ import mlflow.sklearn
|
||||
from urllib.parse import urlparse
|
||||
from mlflow.models import infer_signature
|
||||
|
||||
mlflow.set_experiment("s478815")
|
||||
#mlflow.set_tracking_uri("http://172.17.0.1:5000")
|
||||
mlflow.set_experiment("s-478815")
|
||||
mlflow.set_tracking_uri("http://172.17.0.1:5000")
|
||||
|
||||
# Model
|
||||
class Model(nn.Module):
|
||||
@ -104,15 +104,15 @@ def my_main(epochs):
|
||||
#result.write(f'{y_predicted}')
|
||||
|
||||
input_example = np.array([X_testing.numpy()[0]])
|
||||
siganture = mlflow.models.signature.infer_signature(X_training.detach().numpy(), y_predicted_train.detach().numpy())
|
||||
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, "modelM", registered_model_name="s478815", signature=siganture,
|
||||
mlflow.pytorch.log_model(model, "model", registered_model_name="s-478815", signature=siganture,
|
||||
input_example=input_example)
|
||||
else:
|
||||
mlflow.pytorch.log_model(model, "modelM", signature=siganture, input_example=input_example)
|
||||
#mlflow.pytorch.save_model(model, "modelM", signature=siganture, input_example=input_example)
|
||||
mlflow.pytorch.log_model(model, "model", signature=siganture, input_example=input_example)
|
||||
mlflow.pytorch.save_model(model, "modelM", signature=siganture, input_example=input_example)
|
||||
|
||||
rmse = mean_squared_error(y_testing, y_predicted)
|
||||
#print(rmse)
|
||||
|
Loading…
Reference in New Issue
Block a user