MLmodel file
All checks were successful
s426206-evaluation/pipeline/head This commit looks good
s426206-training/pipeline/head This commit looks good

This commit is contained in:
Jan Nowak 2021-05-23 12:22:05 +02:00
parent 5f107e11fb
commit ace49e0c42
2 changed files with 7 additions and 4 deletions

View File

@ -33,6 +33,7 @@ pipeline {
img.inside {
sh 'chmod +x dlgssdpytorch.py'
sh 'python3 ./dlgssdpytorch.py $PARAMETRY'
sh 'rm -rf my_model'
sh 'chmod +x train_mlflow.py'
//sh 'chmod +x generate_MLmodel.py'
//sh 'python3 ./generate_MLmodel.py'
@ -46,7 +47,7 @@ pipeline {
stage('end') {
steps {
//Zarchiwizuj wynik
archiveArtifacts 'model.pt, my_runs/**/*'
archiveArtifacts 'model.pt, my_runs/**/*, my_model/**/*'
}
}

View File

@ -10,7 +10,6 @@ import mlflow.pytorch
from urllib.parse import urlparse
from mlflow.models.signature import infer_signature
class LayerLinearRegression(nn.Module):
def __init__(self):
super().__init__()
@ -27,6 +26,7 @@ parser.add_argument('-e', '--epochs', type=int, default=100, help="Liczba epok",
args = parser.parse_args()
if __name__ == "__main__":
lr = args.lr
n_epochs = args.epochs
mlflow.set_experiment("s426206")
@ -133,7 +133,9 @@ if __name__ == "__main__":
tracking_url_type_store = urlparse(mlflow.get_tracking_uri()).scheme
# print(tracking_url_type_store)
# Model registry does not work with file store
if tracking_url_type_store != "file":
mlflow.sklearn.log_model(model, "model", registered_model_name="s426206", signature=siganture, input_example=input_example)
mlflow.pytorch.log_model(model, "model", registered_model_name="s426206", signature=siganture, input_example=input_example)
else:
mlflow.sklearn.log_model(model, "model", signature=siganture, input_example=input_example)
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)