From 9652f510203365c7f1639c68b3c948985e316d67 Mon Sep 17 00:00:00 2001 From: AdamOsiowy123 Date: Mon, 2 May 2022 18:49:07 +0200 Subject: [PATCH] train model --- Jenkins/Jenkinsfile.create_dataset | 2 +- Jenkins/Jenkinsfile.training | 9 ++++++--- Scripts/train_neural_network.py | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Jenkins/Jenkinsfile.create_dataset b/Jenkins/Jenkinsfile.create_dataset index bffb824..9bfb1f8 100644 --- a/Jenkins/Jenkinsfile.create_dataset +++ b/Jenkins/Jenkinsfile.create_dataset @@ -34,7 +34,7 @@ node { } } stage('Archive artifacts') { - archiveArtifacts "dataset.csv, train_data.csv, test_data.csv, dev_data.csv, neural_network_evaluation.txt" + archiveArtifacts "dataset.csv, train_data.csv, test_data.csv, dev_data.csv" } } } \ No newline at end of file diff --git a/Jenkins/Jenkinsfile.training b/Jenkins/Jenkinsfile.training index 68eaad0..cb35af0 100644 --- a/Jenkins/Jenkinsfile.training +++ b/Jenkins/Jenkinsfile.training @@ -14,14 +14,17 @@ node { ]) } stage('Copy artifacts') { - copyArtifacts filter: 'train_data.csv', fingerprintArtifacts: true, projectName: 's444452-create-dataset' - copyArtifacts filter: 'test_data.csv', fingerprintArtifacts: true, projectName: 's444452-create-dataset' - copyArtifacts filter: 'dev_data.csv', fingerprintArtifacts: true, projectName: 's444452-create-dataset' + copyArtifacts filter: 'train_data.csv', fingerprintArtifacts: true, projectName: 's444452-create-dataset' + copyArtifacts filter: 'test_data.csv', fingerprintArtifacts: true, projectName: 's444452-create-dataset' + copyArtifacts filter: 'dev_data.csv', fingerprintArtifacts: true, projectName: 's444452-create-dataset' } stage('Run script') { withEnv(["TRAIN_ARGS=${params.TRAIN_ARGS}"]) { sh "python3 Scripts/train_neural_network.py $TRAIN_ARGS" } } + stage('Archive artifacts') { + archiveArtifacts "neural_network_evaluation.txt, neural_network_model/**/*" + } } } \ No newline at end of file diff --git a/Scripts/train_neural_network.py b/Scripts/train_neural_network.py index 134b801..fc4b5fd 100644 --- a/Scripts/train_neural_network.py +++ b/Scripts/train_neural_network.py @@ -82,7 +82,7 @@ def main(): x_train, x_test, vocab_size = tokenize(pd.concat([x_train, x_test]), x_train, x_test, 100) model = get_model(50, vocab_size) train_model(model, x_train, y_train) - # save_model(model, abs_data_path, 'neural_network') + save_model(model, abs_data_path, 'neural_network_model') evaluate_and_save(model, x_test, y_test, abs_data_path)