diff --git a/Jenkinsfile_predict b/Jenkinsfile_predict new file mode 100644 index 0000000..52d0db4 --- /dev/null +++ b/Jenkinsfile_predict @@ -0,0 +1,47 @@ +pipeline { + agent {docker { image 'snowycocoon/ium_434788:4'}} + parameters{ + buildSelector( + defaultSelector: lastSuccessful(), + description: 'Which build to use for copying artifacts', + name: 'WHICH_BUILD' + ) + } + + stages { + stage('copy artifacts') + { + steps + { + copyArtifacts(fingerprintArtifacts: true, projectName: 's434695-training/train', selector: buildParameter('WHICH_BUILD')) + } + } + stage('predict') + { + steps + { + catchError { + sh 'rm -r my_model' + sh 'python3.8 Zadanie_09_MLflow_Predict.py ${BATCH_SIZE} ${EPOCHS}' + } + } + } + } + + post { + success { + mail body: 'SUCCESS', + subject: 's434788 mlflow predict', + to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' + } + unstable { + mail body: 'UNSTABLE', subject: 's434788 mlflow predict', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' + } + failure { + mail body: 'FAILURE', subject: 's434788 mlflow predict', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' + } + changed { + mail body: 'CHANGED', subject: 's434788 mlflow predict', to: '26ab8f35.uam.onmicrosoft.com@emea.teams.ms' + } + } +} \ No newline at end of file diff --git a/Zadanie_09_MLflow_Predict.py b/Zadanie_09_MLflow_Predict.py new file mode 100644 index 0000000..d6d321a --- /dev/null +++ b/Zadanie_09_MLflow_Predict.py @@ -0,0 +1,7 @@ +import mlflow +import pandas as pd + +model = mlflow.keras.load_model("my_model") +data = pd.read_json('my_model\input_example.json', orient='index') +print(data) +print(model.predict(data)) \ No newline at end of file diff --git a/mlruns/0/1e5709985a4a4682ab319f0d3289099d/meta.yaml b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/meta.yaml new file mode 100644 index 0000000..ecf5ad2 --- /dev/null +++ b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/meta.yaml @@ -0,0 +1,15 @@ +artifact_uri: file:///C:/Users/domstr2/Desktop/Git%20Repositories/ium_434788/mlruns/0/1e5709985a4a4682ab319f0d3289099d/artifacts +end_time: 1621792438671 +entry_point_name: '' +experiment_id: '0' +lifecycle_stage: active +name: '' +run_id: 1e5709985a4a4682ab319f0d3289099d +run_uuid: 1e5709985a4a4682ab319f0d3289099d +source_name: '' +source_type: 4 +source_version: '' +start_time: 1621792431816 +status: 3 +tags: [] +user_id: domstr2 diff --git a/mlruns/0/1e5709985a4a4682ab319f0d3289099d/metrics/Accuracy b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/metrics/Accuracy new file mode 100644 index 0000000..bcb057f --- /dev/null +++ b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/metrics/Accuracy @@ -0,0 +1 @@ +1621792435688 1.0 0 diff --git a/mlruns/0/1e5709985a4a4682ab319f0d3289099d/params/batch_size b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/params/batch_size new file mode 100644 index 0000000..19c7bdb --- /dev/null +++ b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/params/batch_size @@ -0,0 +1 @@ +16 \ No newline at end of file diff --git a/mlruns/0/1e5709985a4a4682ab319f0d3289099d/params/epochs b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/params/epochs new file mode 100644 index 0000000..3f10ffe --- /dev/null +++ b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/params/epochs @@ -0,0 +1 @@ +15 \ No newline at end of file diff --git a/mlruns/0/1e5709985a4a4682ab319f0d3289099d/tags/mlflow.source.git.commit b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/tags/mlflow.source.git.commit new file mode 100644 index 0000000..65a670a --- /dev/null +++ b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/tags/mlflow.source.git.commit @@ -0,0 +1 @@ +6757e5b025505bf24aebc3f63982f0ad32995de3 \ No newline at end of file diff --git a/mlruns/0/1e5709985a4a4682ab319f0d3289099d/tags/mlflow.source.name b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/tags/mlflow.source.name new file mode 100644 index 0000000..f34ec76 --- /dev/null +++ b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/tags/mlflow.source.name @@ -0,0 +1 @@ +c:/Users/domstr2/Desktop/Git Repositories/ium_434788/Zadanie_08_and_09_MLflow.py \ No newline at end of file diff --git a/mlruns/0/1e5709985a4a4682ab319f0d3289099d/tags/mlflow.source.type b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/tags/mlflow.source.type new file mode 100644 index 0000000..0c2c1fe --- /dev/null +++ b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/tags/mlflow.source.type @@ -0,0 +1 @@ +LOCAL \ No newline at end of file diff --git a/mlruns/0/1e5709985a4a4682ab319f0d3289099d/tags/mlflow.user b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/tags/mlflow.user new file mode 100644 index 0000000..313bd69 --- /dev/null +++ b/mlruns/0/1e5709985a4a4682ab319f0d3289099d/tags/mlflow.user @@ -0,0 +1 @@ +domstr2 \ No newline at end of file diff --git a/my_model/MLmodel b/my_model/MLmodel new file mode 100644 index 0000000..26fb65b --- /dev/null +++ b/my_model/MLmodel @@ -0,0 +1,19 @@ +flavors: + keras: + data: data + keras_module: tensorflow.keras + keras_version: 2.4.0 + save_format: tf + python_function: + data: data + env: conda.yaml + loader_module: mlflow.keras + python_version: 3.8.5 +saved_input_example_info: + artifact_path: input_example.json + format: tf-serving + type: ndarray +signature: + inputs: '[{"type": "tensor", "tensor-spec": {"dtype": "float64", "shape": [-1, 14]}}]' + outputs: '[{"type": "tensor", "tensor-spec": {"dtype": "int32", "shape": [-1]}}]' +utc_time_created: '2021-05-23 17:53:55.693430' diff --git a/my_model/conda.yaml b/my_model/conda.yaml new file mode 100644 index 0000000..3fa4018 --- /dev/null +++ b/my_model/conda.yaml @@ -0,0 +1,10 @@ +channels: +- defaults +- conda-forge +dependencies: +- python=3.8.5 +- pip +- pip: + - mlflow + - tensorflow==2.4.1 +name: mlflow-env diff --git a/my_model/data/keras_module.txt b/my_model/data/keras_module.txt new file mode 100644 index 0000000..2c73dfd --- /dev/null +++ b/my_model/data/keras_module.txt @@ -0,0 +1 @@ +tensorflow.keras \ No newline at end of file diff --git a/my_model/data/model/saved_model.pb b/my_model/data/model/saved_model.pb new file mode 100644 index 0000000..2318a75 Binary files /dev/null and b/my_model/data/model/saved_model.pb differ diff --git a/my_model/data/model/variables/variables.data-00000-of-00001 b/my_model/data/model/variables/variables.data-00000-of-00001 new file mode 100644 index 0000000..167e235 Binary files /dev/null and b/my_model/data/model/variables/variables.data-00000-of-00001 differ diff --git a/my_model/data/model/variables/variables.index b/my_model/data/model/variables/variables.index new file mode 100644 index 0000000..5740461 Binary files /dev/null and b/my_model/data/model/variables/variables.index differ diff --git a/my_model/data/save_format.txt b/my_model/data/save_format.txt new file mode 100644 index 0000000..439ab29 --- /dev/null +++ b/my_model/data/save_format.txt @@ -0,0 +1 @@ +tf \ No newline at end of file diff --git a/my_model/input_example.json b/my_model/input_example.json new file mode 100644 index 0000000..ce5d56b --- /dev/null +++ b/my_model/input_example.json @@ -0,0 +1 @@ +{"inputs": [-0.011282211362261343, 0.6825528426633746, -0.8779676567417312, 0.25625952402130414, 0.0325916986923591, 0.1075920895847071, -0.19667888586283722, 0.6801776123326557, -0.13679826698989028, -0.6382195990287619, -0.8663788579309919, -0.787822640922809, -0.7744150275178463, -0.0063619093376772375]} \ No newline at end of file