Fix mlflow

This commit is contained in:
Wojciech Lidwin 2023-05-12 15:47:59 +02:00
parent 6918c0b7e8
commit cf74d8cc1c
2 changed files with 5 additions and 3 deletions

View File

@ -29,7 +29,7 @@ node {
testImage.inside{
copyArtifacts filter: 'baltimore_train.csv', projectName: 's487197-create-dataset'
sh "python3 ium_sacred.py -epochs $EPOCHS -lr $LR -validation_split $VALIDATION_SPLIT"
archiveArtifacts artifacts: 'baltimore.zip'
archiveArtifacts artifacts: 'baltimore.zip', 'mlflow_model.pth'
stage('Buil'){
build job: 's487197-evaluation.eg/master', parameters: [string(name: 'build', value: "${currentBuild.number}")], wait:false
}

View File

@ -72,12 +72,14 @@ def train_model():
signature = mlflow.models.signature.infer_signature(train_x, model.predict(x_test))
if tracking_url_type_store != "file":
mlflow.sklearn.log_model(model, "wines-model", registered_model_name="ElasticnetWineModel", signature=signature)
mlflow.sklearn.log_model(mlf_model, "baltimore_model", registered_model_name="BaltimoreModel", signature=signature)
else:
mlflow.sklearn.log_model(model, "model", signature=signature)
mlflow.sklearn.log_model(mlf_model, "model", signature=signature)
hist = pd.DataFrame(history.history)
hist['epoch'] = history.epoch
mlflow.sklearn.save_model(mlf_model, "mlflow_model.pth")
model.save('baltimore_model')
shutil.make_archive('baltimore', 'zip', 'baltimore_model')