From fcf2fc5183521b6428903ef901643373f99d3eac Mon Sep 17 00:00:00 2001 From: Owen Hua Date: Thu, 9 Mar 2023 17:53:46 -0800 Subject: [PATCH 1/7] modify forest depth --- .github/workflows/cml.yaml | 19 +++++++++++++++++++ train.py | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/cml.yaml diff --git a/.github/workflows/cml.yaml b/.github/workflows/cml.yaml new file mode 100644 index 000000000..e91c61511 --- /dev/null +++ b/.github/workflows/cml.yaml @@ -0,0 +1,19 @@ +name: CML +on: [push] +jobs: + train-and-report: + runs-on: ubuntu-latest + container: docker://ghcr.io/iterative/cml:0-dvc2-base1 + steps: + - uses: actions/checkout@v3 + - name: Train model + env: + REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + pip install -r requirements.txt + python train.py # generate plot.png + + # Create CML report + cat metrics.txt >> report.md + echo '![](./plot.png "Confusion Matrix")' >> report.md + cml comment create report.md diff --git a/train.py b/train.py index 415d9a9f9..f44634667 100644 --- a/train.py +++ b/train.py @@ -12,7 +12,7 @@ y_test = np.genfromtxt("data/test_labels.csv") # Fit a model -depth = 2 +depth = 5 clf = RandomForestClassifier(max_depth=depth) clf.fit(X_train, y_train) From 03e30e4f88be9738fc6e5d48e0e6a27c20ca43a6 Mon Sep 17 00:00:00 2001 From: Owen Hua Date: Thu, 9 Mar 2023 18:02:13 -0800 Subject: [PATCH 2/7] modify token --- .github/workflows/cml.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cml.yaml b/.github/workflows/cml.yaml index e91c61511..651af0c68 100644 --- a/.github/workflows/cml.yaml +++ b/.github/workflows/cml.yaml @@ -8,7 +8,7 @@ jobs: - uses: actions/checkout@v3 - name: Train model env: - REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} run: | pip install -r requirements.txt python train.py # generate plot.png From 317d2aa197412f38fdbc2cf040462ff5ea315e1c Mon Sep 17 00:00:00 2001 From: Owen Hua Date: Thu, 9 Mar 2023 18:22:44 -0800 Subject: [PATCH 3/7] self hosted runner --- .github/workflows/cml.yaml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cml.yaml b/.github/workflows/cml.yaml index 651af0c68..25a4fb0ab 100644 --- a/.github/workflows/cml.yaml +++ b/.github/workflows/cml.yaml @@ -1,9 +1,24 @@ name: CML on: [push] jobs: - train-and-report: + launch-runner: runs-on: ubuntu-latest - container: docker://ghcr.io/iterative/cml:0-dvc2-base1 + steps: + - uses: iterative/setup-cml@v1 + - uses: actions/checkout@v3 + - name: Deploy runner on EC2 + env: + REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + run: | + train-and-report: + needs: launch-runner + runs-on: [self-hosted, cml-gpu] + timeout-minutes: 50400 # 35 days + container: + image: docker://iterativeai/cml:0-dvc2-base1-gpu + options: --gpus all steps: - uses: actions/checkout@v3 - name: Train model From a973fd488287ad021b2d70e81642787111fa952d Mon Sep 17 00:00:00 2001 From: Owen Hua Date: Fri, 10 Mar 2023 10:40:41 -0800 Subject: [PATCH 4/7] test --- .github/workflows/cml.yaml | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/.github/workflows/cml.yaml b/.github/workflows/cml.yaml index 25a4fb0ab..30e129243 100644 --- a/.github/workflows/cml.yaml +++ b/.github/workflows/cml.yaml @@ -1,29 +1,14 @@ name: CML on: [push] jobs: - launch-runner: - runs-on: ubuntu-latest - steps: - - uses: iterative/setup-cml@v1 - - uses: actions/checkout@v3 - - name: Deploy runner on EC2 - env: - REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - run: | train-and-report: - needs: launch-runner - runs-on: [self-hosted, cml-gpu] - timeout-minutes: 50400 # 35 days - container: - image: docker://iterativeai/cml:0-dvc2-base1-gpu - options: --gpus all + runs-on: ubuntu-latest + container: docker://ghcr.io/iterative/cml:0-dvc2-base1 steps: - uses: actions/checkout@v3 - name: Train model env: - REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | pip install -r requirements.txt python train.py # generate plot.png @@ -31,4 +16,4 @@ jobs: # Create CML report cat metrics.txt >> report.md echo '![](./plot.png "Confusion Matrix")' >> report.md - cml comment create report.md + cml comment create report.md \ No newline at end of file From fd5053e8d07648d2c21392b4c29aa9375ca55b2d Mon Sep 17 00:00:00 2001 From: Owen Hua Date: Fri, 10 Mar 2023 10:43:31 -0800 Subject: [PATCH 5/7] test --- .github/workflows/cml.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cml.yaml b/.github/workflows/cml.yaml index 30e129243..61a9d95a5 100644 --- a/.github/workflows/cml.yaml +++ b/.github/workflows/cml.yaml @@ -8,7 +8,7 @@ jobs: - uses: actions/checkout@v3 - name: Train model env: - REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} run: | pip install -r requirements.txt python train.py # generate plot.png From 2a1ce701a7f7a3af4c98300bc0c0fa15d17510be Mon Sep 17 00:00:00 2001 From: Owen Hua Date: Fri, 10 Mar 2023 11:07:55 -0800 Subject: [PATCH 6/7] test --- .github/workflows/cml.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cml.yaml b/.github/workflows/cml.yaml index 61a9d95a5..4351e68a4 100644 --- a/.github/workflows/cml.yaml +++ b/.github/workflows/cml.yaml @@ -8,7 +8,7 @@ jobs: - uses: actions/checkout@v3 - name: Train model env: - REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN2 }} run: | pip install -r requirements.txt python train.py # generate plot.png @@ -16,4 +16,4 @@ jobs: # Create CML report cat metrics.txt >> report.md echo '![](./plot.png "Confusion Matrix")' >> report.md - cml comment create report.md \ No newline at end of file + cml comment create report.md From 9a07343b528872b6c9ef3d9fbd2fb63e0b7e34d6 Mon Sep 17 00:00:00 2001 From: Owen Hua Date: Fri, 10 Mar 2023 11:15:14 -0800 Subject: [PATCH 7/7] test --- .github/workflows/cml.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cml.yaml b/.github/workflows/cml.yaml index 4351e68a4..651af0c68 100644 --- a/.github/workflows/cml.yaml +++ b/.github/workflows/cml.yaml @@ -8,7 +8,7 @@ jobs: - uses: actions/checkout@v3 - name: Train model env: - REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN2 }} + REPO_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} run: | pip install -r requirements.txt python train.py # generate plot.png