Add model registry
Some checks failed
s430705-training/pipeline/head There was a failure building this commit
Some checks failed
s430705-training/pipeline/head There was a failure building this commit
This commit is contained in:
parent
301151eaa8
commit
6549b4dc98
@ -17,6 +17,8 @@ pipeline {
|
|||||||
steps {
|
steps {
|
||||||
copyArtifacts fingerprintArtifacts: true, projectName: 's430705-create-dataset', selector: buildParameter('BUILD_SELECTOR')
|
copyArtifacts fingerprintArtifacts: true, projectName: 's430705-create-dataset', selector: buildParameter('BUILD_SELECTOR')
|
||||||
sh "rm -rf movies_imdb"
|
sh "rm -rf movies_imdb"
|
||||||
|
sh "python3 lab08_mfl.py"
|
||||||
|
sh "export MLFLOW_TRACKING_URI=http://172.17.0.1:5000"
|
||||||
sh "python3 lab08_mfl.py"
|
sh "python3 lab08_mfl.py"
|
||||||
sh "python3 lab06_training.py ${epochs}"
|
sh "python3 lab06_training.py ${epochs}"
|
||||||
}
|
}
|
||||||
|
12
lab08_mfl.py
12
lab08_mfl.py
@ -7,6 +7,10 @@ from sklearn.model_selection import train_test_split
|
|||||||
from tensorflow.keras.callbacks import EarlyStopping
|
from tensorflow.keras.callbacks import EarlyStopping
|
||||||
from tensorflow.keras.layers import Dense, Dropout
|
from tensorflow.keras.layers import Dense, Dropout
|
||||||
from tensorflow.keras.models import Sequential
|
from tensorflow.keras.models import Sequential
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
mlflow.set_experiment("s430705")
|
||||||
|
mlflow.set_tracking_uri("http://172.17.0.1:5000")
|
||||||
|
|
||||||
|
|
||||||
def prepare_model(train_size_param, test_size_param, epochs, batch_size):
|
def prepare_model(train_size_param, test_size_param, epochs, batch_size):
|
||||||
@ -79,3 +83,11 @@ with mlflow.start_run():
|
|||||||
|
|
||||||
signature = mlflow.models.signature.infer_signature(X_train.values, model.predict(X_train.values))
|
signature = mlflow.models.signature.infer_signature(X_train.values, model.predict(X_train.values))
|
||||||
mlflow.keras.save_model(model, "movies_imdb", input_example=input_example, signature=signature)
|
mlflow.keras.save_model(model, "movies_imdb", input_example=input_example, signature=signature)
|
||||||
|
|
||||||
|
tracking_url_type_store = urlparse(mlflow.get_tracking_uri()).scheme
|
||||||
|
if tracking_url_type_store != "file":
|
||||||
|
mlflow.keras.log_model(model, "movies_imdb", registered_model_name="s430705", signature=signature,
|
||||||
|
input_example=input_example)
|
||||||
|
else:
|
||||||
|
mlflow.keras.log_model(model, "model_movies", signature=signature, input_example=input_example)
|
||||||
|
mlflow.keras.save_model(model, "movies_mdb", signature=signature, input_example=input_example)
|
||||||
|
Loading…
Reference in New Issue
Block a user