temporary comment tracking
All checks were successful
s444354-training/pipeline/head This commit looks good
s444354-evaluation/pipeline/head This commit looks good

This commit is contained in:
Adrian Charkiewicz 2022-05-15 22:38:48 +02:00
parent bd624b380f
commit af544df669

View File

@ -34,7 +34,7 @@ ex.observers.append(FileStorageObserver('s444354_runs'))
# ex.observers.append(MongoObserver(url='mongodb://mongo_user:mongo_password_IUM_2021@localhost:27017', db_name='sacred'))
ex.observers.append(MongoObserver(url='mongodb://admin:IUM_2021@172.17.0.1:27017', db_name='sacred'))
mlflow.set_tracking_uri("http://172.17.0.1:5000")
#mlflow.set_tracking_uri("http://172.17.0.1:5000")
mlflow.set_experiment('s444354')
try:
@ -167,7 +167,7 @@ def fit(epochs, lr, model, train_loader, val_loader, _log, _run, opt_func=torch.
epochs=epochs
history = []
optimizer = opt_func(model.parameters(), lr)
with mlflow.start_run():
with mlflow.start_run() as run:
for epoch in range(epochs):
for batch in train_loader:
@ -187,17 +187,17 @@ def fit(epochs, lr, model, train_loader, val_loader, _log, _run, opt_func=torch.
_run.info["epochs"] = epochs
signature = mlflow.models.signature.infer_signature(inputs_array)
#signature = mlflow.models.signature.infer_signature(inputs_array)
tracking_url_type_store = urlparse(mlflow.get_tracking_uri()).scheme
#tracking_url_type_store = urlparse(mlflow.get_tracking_uri()).scheme
input_example = [0.1, 0.1, 546.0, 555.223, 1., 1., 33.16376, 84.12426]
if tracking_url_type_store != "file":
mlflow.pytorch.log_model(model, "model", registered_model_name="s444354", signature=signature, input_example=input_example)
else:
mlflow.pytorch.log_model(model, "model", signature=signature, input_example=input_example)
mlflow.pytorch.save_model(model, "my_model", signature=signature, input_example=input_example)
#if tracking_url_type_store != "file":
#mlflow.pytorch.log_model(model, "model", registered_model_name="s444354", signature=signature, input_example=input_example)
#else:
#mlflow.pytorch.log_model(model, "model", signature=signature, input_example=input_example)
#mlflow.pytorch.save_model(model, "my_model", signature=signature, input_example=input_example)