From 7fb69aa41413082893fe7c530e88083acafee993 Mon Sep 17 00:00:00 2001 From: quandanrepo <45804868+quandanrepo@users.noreply.github.com> Date: Sat, 19 Aug 2023 13:42:57 +0100 Subject: [PATCH 1/6] Create cml.yml --- .github/workflows/cml.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/cml.yml diff --git a/.github/workflows/cml.yml b/.github/workflows/cml.yml new file mode 100644 index 00000000..e00a6501 --- /dev/null +++ b/.github/workflows/cml.yml @@ -0,0 +1,24 @@ +name: model-training +on: + push: + branches: + - mlmodel +jobs: + run: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - uses: iterative/setup-cml@v1 + - name: Train model + env: + REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + pip install -r requirements.txt + ls + cd model_data/simulation_system + python3 training.py --train-filepath ./model_build_data/change_data/rdsap_full/train_validation_data.parquet --test-filepath ./model_build_data/change_data/rdsap_full/test_data.parquet + + cd model_directory/RDSAP_CHANGE + cat model_registry.csv >> report.md + From 7f543bf9e15dc25d3d173dd7b6599e73c7d629a5 Mon Sep 17 00:00:00 2001 From: quandanrepo <45804868+quandanrepo@users.noreply.github.com> Date: Sat, 19 Aug 2023 13:44:43 +0100 Subject: [PATCH 2/6] Update cml.yml --- .github/workflows/cml.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cml.yml b/.github/workflows/cml.yml index e00a6501..0c28589d 100644 --- a/.github/workflows/cml.yml +++ b/.github/workflows/cml.yml @@ -14,9 +14,9 @@ jobs: env: REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - pip install -r requirements.txt ls - cd model_data/simulation_system + cd model_data/simulation_system + pip install -r requirements.txt python3 training.py --train-filepath ./model_build_data/change_data/rdsap_full/train_validation_data.parquet --test-filepath ./model_build_data/change_data/rdsap_full/test_data.parquet cd model_directory/RDSAP_CHANGE From 0c7f0f5568ddb3d93692369ae534f1cdbff6c8ac Mon Sep 17 00:00:00 2001 From: quandanrepo <45804868+quandanrepo@users.noreply.github.com> Date: Sat, 19 Aug 2023 13:49:59 +0100 Subject: [PATCH 3/6] Update training.py --- model_data/simulation_system/training.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/model_data/simulation_system/training.py b/model_data/simulation_system/training.py index 358abb41..0656b427 100644 --- a/model_data/simulation_system/training.py +++ b/model_data/simulation_system/training.py @@ -1,6 +1,6 @@ import argparse -import boto3 +# import boto3 import os from pathlib import Path from datetime import datetime @@ -178,4 +178,4 @@ if __name__ == "__main__": test_filepath=args.test_filepath, target_column=args.target_column, model_type=args.model_type - ) \ No newline at end of file + ) From 261a811955ea6c510f165e5c6030f7f5bca413c6 Mon Sep 17 00:00:00 2001 From: quandanrepo <45804868+quandanrepo@users.noreply.github.com> Date: Sat, 19 Aug 2023 14:00:31 +0100 Subject: [PATCH 4/6] Update cml.yml --- .github/workflows/cml.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cml.yml b/.github/workflows/cml.yml index 0c28589d..b264d857 100644 --- a/.github/workflows/cml.yml +++ b/.github/workflows/cml.yml @@ -20,5 +20,8 @@ jobs: python3 training.py --train-filepath ./model_build_data/change_data/rdsap_full/train_validation_data.parquet --test-filepath ./model_build_data/change_data/rdsap_full/test_data.parquet cd model_directory/RDSAP_CHANGE + cat "## MODEL METRICS from registry" > report.md cat model_registry.csv >> report.md + + cml comment create report.md From f2eab51ff4b0c5104f34267a2dbd6c820a580594 Mon Sep 17 00:00:00 2001 From: quandanrepo <45804868+quandanrepo@users.noreply.github.com> Date: Sat, 19 Aug 2023 14:01:13 +0100 Subject: [PATCH 5/6] Update training.py --- model_data/simulation_system/training.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model_data/simulation_system/training.py b/model_data/simulation_system/training.py index 0656b427..2050bda0 100644 --- a/model_data/simulation_system/training.py +++ b/model_data/simulation_system/training.py @@ -127,7 +127,7 @@ def training( logger.info("--- Optimising model for deployment ---") deployment_model_path = model.optimise_model_for_deployment(deployment_path= output_base / DEPLOYMENT_FOLDER) - logger.info("Optimised version of best model can be found at: {deployment_model_path}") + logger.info(f"Optimised version of best model can be found at: {deployment_model_path}") # TODO: Need a model registry - for now have this as a CSV # Save this in the model directory From 229c452ff4f30c9698b3d1937dfe0b2f5de11ce1 Mon Sep 17 00:00:00 2001 From: quandanrepo <45804868+quandanrepo@users.noreply.github.com> Date: Sat, 19 Aug 2023 14:09:12 +0100 Subject: [PATCH 6/6] Update cml.yml --- .github/workflows/cml.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cml.yml b/.github/workflows/cml.yml index b264d857..20f95dc6 100644 --- a/.github/workflows/cml.yml +++ b/.github/workflows/cml.yml @@ -20,7 +20,7 @@ jobs: python3 training.py --train-filepath ./model_build_data/change_data/rdsap_full/train_validation_data.parquet --test-filepath ./model_build_data/change_data/rdsap_full/test_data.parquet cd model_directory/RDSAP_CHANGE - cat "## MODEL METRICS from registry" > report.md + echo "## MODEL METRICS from registry" > report.md cat model_registry.csv >> report.md cml comment create report.md