From c4091e2f2a047717b61ff496dc88e1c6fd79d287 Mon Sep 17 00:00:00 2001 From: Chansung Park Date: Sun, 26 Jun 2022 12:44:45 +0000 Subject: [PATCH 1/6] update train.py to train_wandb.py --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a2d67da..4a658eb 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ $ dvc stage add -n train \ # if you want to use W&B for tracking training progress $ dvc stage add -n train \ -p train.train_size,train.batch_size,train.epoch,train.lr \ - -d pipeline/modeling.py -d pipeline/train.py -d data \ + -d pipeline/modeling.py -d pipeline/train_wandb.py -d data \ -o outputs/model \ python pipeline/train.py outputs/model ``` From 9be060bc50990dc505193f051c785dea0c6a2250 Mon Sep 17 00:00:00 2001 From: Chansung Park Date: Sun, 26 Jun 2022 12:49:01 +0000 Subject: [PATCH 2/6] switch train.py to train_wandb.py --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4a658eb..1d6a705 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ $ dvc stage add -n train \ -p train.train_size,train.batch_size,train.epoch,train.lr \ -d pipeline/modeling.py -d pipeline/train_wandb.py -d data \ -o outputs/model \ - python pipeline/train.py outputs/model + python pipeline/train_wandb.py outputs/model ``` 11. Run the following `dvc stage add` for evaluate stage ```bash From d2b9b032e1f1e3714560cdb5e8ac18babd731fc2 Mon Sep 17 00:00:00 2001 From: Chansung Park Date: Sun, 26 Jun 2022 13:44:16 +0000 Subject: [PATCH 3/6] add wandb dependency --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 7ca652f..cb329fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ dvc[gdrive]==2.10.2 +wandb==0.12.19 tensorflow==2.8 typer==0.4.1 docopt==0.6.2 From 9acb75d9fcfefb74f45cbfd24f6e0f09dab3459b Mon Sep 17 00:00:00 2001 From: Chansung Park Date: Sun, 26 Jun 2022 13:49:20 +0000 Subject: [PATCH 4/6] update jl-wandb to use inputs instead of env --- .github/actions/exp/jl-wandb/action.yml | 35 +++++++++++++++---------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/actions/exp/jl-wandb/action.yml b/.github/actions/exp/jl-wandb/action.yml index 4296546..5cf12e1 100644 --- a/.github/actions/exp/jl-wandb/action.yml +++ b/.github/actions/exp/jl-wandb/action.yml @@ -22,14 +22,14 @@ runs: steps: - name: prepare script env: - CUR_BRANCH: $CUR_BRANCH - CUR_PR_ID: $CUR_PR_ID - GDRIVE_CREDENTIAL: $GDRIVE_CREDENTIAL - GH_ACCESS_TOKEN: $GH_ACCESS_TOKEN - CLOUD_ID: $JARVISLABS_ID - CLOUD_AT: $JARVISLABS_ACCESS_TOKEN - WANDB_PROJECT: $WANDB_PROJECT - WANDB_API_KEY: $WANDB_API_KEY + CUR_BRANCH: ${{ inputs.CUR_BRANCH }} + CUR_PR_ID: ${{ inputs.CUR_PR_ID }} + GDRIVE_CREDENTIAL: ${{ inputs.GDRIVE_CREDENTIAL }} + GH_ACCESS_TOKEN: ${{ inputs.GH_ACCESS_TOKEN }} + CLOUD_ID: ${{ inputs.JARVISLABS_ID }} + CLOUD_AT: ${{ inputs.JARVISLABS_ACCESS_TOKEN }} + WANDB_PROJECT: ${{ inputs.WANDB_PROJECT }} + WANDB_API_KEY: ${{ inputs.WANDB_API_KEY }} run: | envsubst \ '$CUR_BRANCH, \ @@ -37,32 +37,39 @@ runs: $GDRIVE_CREDENTIAL, \ $GH_ACCESS_TOKEN, \ $CLOUD_ID, \ - $CLOUD_AT' \ - < scripts/js_exp_wandb.sh \ - > scripts/js_exp_wandb_tmp.sh + $CLOUD_AT, \ + $WANDB_PROJECT, \ + $WANDB_API_KEY' \ + < scripts/jl_exp_wandb.sh \ + > scripts/jl_exp_wandb_tmp.sh + shell: bash - name: install jarvislabs client run: | pip install typer pip install git+https://github.com/jarvislabsai/jlclient.git + shell: bash - name: add script to jarvislabs id: add_script run: | python clouds/jarvislabs.py \ script add \ - ${{ env.CLOUD_AT }} ${{ env.CLOUD_ID }} scripts/js_exp_wandb_tmp.sh \ + ${{ inputs.JARVISLABS_ACCESS_TOKEN }} ${{ inputs.JARVISLABS_ID }} scripts/jl_exp_wandb_tmp.sh \ > outputs.txt echo "::set-output name=script_id::$(cat outputs.txt)" + shell: bash - name: create vm on jarvislabs run: | python clouds/jarvislabs.py \ vm create \ - ${{ env.CLOUD_AT }} ${{ env.CLOUD_ID }} ${{ steps.add_script.outputs.script_id }} + ${{ inputs.JARVISLABS_ACCESS_TOKEN }} ${{ inputs.JARVISLABS_ID }} ${{ steps.add_script.outputs.script_id }} + shell: bash - name: remove script from jarvislabs run: | python clouds/jarvislabs.py \ script remove \ - ${{ env.CLOUD_AT }} ${{ env.CLOUD_ID }} ${{ steps.add_script.outputs.script_id }} \ No newline at end of file + ${{ inputs.JARVISLABS_ACCESS_TOKEN }} ${{ inputs.JARVISLABS_ID }} ${{ steps.add_script.outputs.script_id }} + shell: bash From e501fd2757212288155813d8610fca40c3af546d Mon Sep 17 00:00:00 2001 From: Chansung Park Date: Sun, 26 Jun 2022 13:54:01 +0000 Subject: [PATCH 5/6] update github comment --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d6a705..c4c9f8f 100644 --- a/README.md +++ b/README.md @@ -68,12 +68,13 @@ $ dvc stage add -n evaluate \ 18. Run `git add . && git commit -m "add initial pipeline run" && git push origin main` 19. Add access token and user email of [JarvisLabs.ai](https://jarvislabs.ai/) to GitHub Secret as `JARVISLABS_ACCESS_TOKEN` and `JARVISLABS_USER_EMAIL` 20. Add GitHub access token to GitHub Secret as `GH_ACCESS_TOKEN` -21. Create a PR and write `#train` as in comment (you have to be the onwer of the repo) +21. Create a PR and write `#train --with dvc` as in comment (you have to be the onwer of the repo) ### W&B Integration Setup 1. Add W&B's project name to GitHub Secret as `WANDB_PROJECT` 2. Add W&B's API KEY to GitHub Secret as `WANDB_API_KEY` +3. Use `#train --with wandb` instead of `#train --with dvc` ### HuggingFace Integration Setup From ae7798244f4b479579cc36098660f605a7c55e0e Mon Sep 17 00:00:00 2001 From: Chansung Park Date: Sun, 26 Jun 2022 13:56:51 +0000 Subject: [PATCH 6/6] update env to inputs --- .github/actions/exp/jl-dvc/action.yml | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/actions/exp/jl-dvc/action.yml b/.github/actions/exp/jl-dvc/action.yml index ceaacfa..595601f 100644 --- a/.github/actions/exp/jl-dvc/action.yml +++ b/.github/actions/exp/jl-dvc/action.yml @@ -17,14 +17,13 @@ runs: using: "composite" steps: - name: prepare script - if: steps.check.outputs.triggered == 'true' env: - CUR_BRANCH: ${{ steps.pr_data.outputs.branch }} - CUR_PR_ID: ${{ steps.pr_data.outputs.number }} - GDRIVE_CREDENTIAL: ${{ secrets.GDRIVE_CREDENTIAL }} - GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} - CLOUD_ID: ${{ env.JARVISLABS_ID }} - CLOUD_AT: ${{ env.JARVISLABS_ACCESS_TOKEN }} + CUR_BRANCH: ${{ inputs.CUR_BRANCH }} + CUR_PR_ID: ${{ inputs.CUR_PR_ID }} + GDRIVE_CREDENTIAL: ${{ inputs.GDRIVE_CREDENTIAL }} + GH_ACCESS_TOKEN: ${{ inputs.GH_ACCESS_TOKEN }} + CLOUD_ID: ${{ inputs.JARVISLABS_ID }} + CLOUD_AT: ${{ inputs.JARVISLABS_ACCESS_TOKEN }} run: | envsubst \ '$CUR_BRANCH, \ @@ -36,32 +35,28 @@ runs: < scripts/experiments.sh \ > scripts/experiments_tmp.sh - - name: install jarvislabs client - if: steps.check.outputs.triggered == 'true' + - name: install jarvislabs client run: | pip install typer pip install git+https://github.com/jarvislabsai/jlclient.git - name: add script to jarvislabs id: add_script - if: steps.check.outputs.triggered == 'true' run: | python clouds/jarvislabs.py \ script add \ - ${{ env.CLOUD_AT }} ${{ env.CLOUD_ID }} scripts/experiments_tmp.sh \ + ${{ inputs.JARVISLABS_ACCESS_TOKEN }} ${{ inputs.JARVISLABS_ID }} scripts/experiments_tmp.sh \ > outputs.txt echo "::set-output name=script_id::$(cat outputs.txt)" - name: create vm on jarvislabs - if: steps.check.outputs.triggered == 'true' run: | python clouds/jarvislabs.py \ vm create \ - ${{ env.CLOUD_AT }} ${{ env.CLOUD_ID }} ${{ steps.add_script.outputs.script_id }} + ${{ inputs.JARVISLABS_ACCESS_TOKEN }} ${{ inputs.JARVISLABS_ID }} ${{ steps.add_script.outputs.script_id }} - name: remove script from jarvislabs - if: steps.check.outputs.triggered == 'true' run: | python clouds/jarvislabs.py \ script remove \ - ${{ env.CLOUD_AT }} ${{ env.CLOUD_ID }} ${{ steps.add_script.outputs.script_id }} \ No newline at end of file + ${{ inputs.JARVISLABS_ACCESS_TOKEN }} ${{ inputs.JARVISLABS_ID }} ${{ steps.add_script.outputs.script_id }} \ No newline at end of file