archive model

This commit is contained in:
Anna Nowak 2021-05-24 00:52:24 +02:00
parent fb163e5653
commit 7743059eb6
11 changed files with 50 additions and 10 deletions

2
.gitignore vendored
View File

@ -65,4 +65,4 @@ dev.csv
.venv/
model.h5
evaluation.png
mlruns/*
mlruns*

View File

@ -9,4 +9,5 @@ RUN pip3 install -r requirements.txt
COPY ["Zadanie 1.py", "."]
COPY ["stats.py", "."]
COPY ["train.py", "."]
COPY ["evaluate.py", "."]
COPY ["evaluate.py", "."]
COPY ["MLProject", "."]

View File

@ -1,6 +1,6 @@
pipeline {
agent {
docker { image 'adnovac/ium_s434760:1.2' }
docker { image 'adnovac/ium_s434760:3' }
}
parameters{
buildSelector(
@ -39,6 +39,7 @@ pipeline {
stage('archive artifacts') {
steps {
archiveArtifacts 'model.h5'
archiveArtifacts 'fifa_overall/**/*'
}
}
stage('send email') {

View File

@ -1,11 +1,11 @@
name: Fifa Players
name: fifa_players
docker_env:
image: docker.io/adnovac/ium_s434760:2.0
image: adnovac/ium_s434760
entry_points:
train:
parameters:
batch_size: {type: int, default: 15}
epochs: {type: int, default: 16}
command: "python train.py {batch_size} {epochs}"
evaluate:
command: "python evaluate.py"
command: "python3.8 train.py {batch_size} {epochs}"

20
fifa_overall/MLmodel Normal file
View File

@ -0,0 +1,20 @@
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.10
saved_input_example_info:
artifact_path: input_example.json
pandas_orient: split
type: dataframe
signature:
inputs: '[{"type": "tensor", "tensor-spec": {"dtype": "float64", "shape": [-1, 4]}}]'
outputs: '[{"type": "tensor", "tensor-spec": {"dtype": "float32", "shape": [-1,
1]}}]'
utc_time_created: '2021-05-23 19:48:30.385262'

10
fifa_overall/conda.yaml Normal file
View File

@ -0,0 +1,10 @@
channels:
- defaults
- conda-forge
dependencies:
- python=3.8.10
- pip
- pip:
- mlflow
- tensorflow==2.4.1
name: mlflow-env

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
{"columns": ["Age", "Nationality", "Position", "Club"], "data": [[0.38, 0.175, 1, 0.91846154]]}

View File

@ -37,5 +37,12 @@ history = model.fit(
batch_size=batch_size,
epochs=epochs,
)
model.save(model_name)
model.save(model_name)
signature = mlflow.models.signature.infer_signature(X, model.predict(X))
input_example = {
"Age": 0.38,
"Nationality": 0.175,
"Position": 1,
"Club" :0.91846154
}
mlflow.keras.save_model(model, "fifa_overall", signature=signature, input_example = input_example)