From b684f29029fa8f043aaef871d6c77a1be5c0b7fc Mon Sep 17 00:00:00 2001 From: Jeremy Pinto Date: Wed, 14 Aug 2024 10:41:32 -0400 Subject: [PATCH 01/26] Add easy-install option for cookiecutter --- README.md | 223 +++++---------------------------------- scripts/README.new.md | 196 ++++++++++++++++++++++++++++++++++ scripts/quick_install.sh | 36 +++++++ 3 files changed, 258 insertions(+), 197 deletions(-) create mode 100644 scripts/README.new.md create mode 100644 scripts/quick_install.sh diff --git a/README.md b/README.md index f554816..3a5fa05 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,22 @@ # AMLRT Cookiecutter - Initialize a new project + +## Automatic Install (recommended) + +For convenience, you can run: + + bash <(curl -s https://raw.githubusercontent.com/mila-iqia/cookiecutter-pyml/main/scripts/quick_install.sh) --project-name my_new_project + +replace `my_new_project` with the name of your project (the default value is `amlrt_project`). This will clone and setup the cookiecutter for you in the newly created folder `my_new_project`. + +Once done, go to the [First Commit](#first-commit) section and follow the instructions. + +Note: if the `my_new_project` folder already exists, the installation will not proceed. + +## Manual Install + +Note: Skip to next section if you used the automatic install + First, git clone this project template locally. git clone https://github.com/mila-iqia/cookiecutter-pyml.git @@ -21,12 +38,17 @@ Now, initialize the repository with git: git init -And perform the first commit: +You can now replace this README.md file with the standard README file for a project. + mv scripts/README.md.example README.md + +# First Commit + +To perform your first commit: git add . git commit -m 'first commit' -Go on github and follow the instructions to create a new project. +Next, go on github and follow the instructions to create a new project. When done, do not add any file, and follow the instructions to link your local git to the remote project, which should look like this: (PS: these instructions are reported here for your convenience. @@ -43,199 +65,6 @@ suggest to delete this section ("AMLRT Cookiecutter - Initialize a new project") and all you need from now on is just to git clone from the repository you just pushed, i.e., `git@github.com:${GITHUB_USERNAME}/${PROJECT_NAME}.git`). -# amlrt_project (change this name to the name of your project) - -Replace this line with a short description about your project! - -## Instructions to setup the project - -### Install the dependencies: -First, activate a virtual environment (recommended). -Install the package in `editable` mode so you can modify the source directly: - - pip install -e . - -To add new dependencies, simply add them to the setup.py. - -### Setup pre-commit hooks: -These hooks will: -* validate flake8 before any commit -* check that jupyter notebook outputs have been stripped - - cd .git/hooks/ && ln -s ../../hooks/pre-commit . - -### Setup Continuous Integration - -Continuous integration will run the following: -- Unit tests under `tests`. -- End-to-end test under `exmaples/local`. -- `flake8` to check the code syntax. -- Checks on documentation presence and format (using `sphinx`). - -We support the GitHub Actions for running CI. - -Github actions are already configured in `.github/workflows/tests.yml`. -Github actions are already enabled by default when using Github, so, when -pushing to github, they will be executed automatically for pull requests to -`main` and to `develop`. - -## Running the code - -### Run the tests -Just run (from the root folder): - - pytest - -### Run the code/examples. -Note that the code should already compile at this point. - -Running examples can be found under the `examples` folder. - -In particular, you will find examples for: -* local machine (e.g., your laptop). -* a slurm cluster. - -For both these cases, there is the possibility to run with or without Orion. -(Orion is a hyper-parameter search tool - see https://github.com/Epistimio/orion - -that is already configured in this project) - -In any case, the run script will take multiple config files as arguments (`--configs`). -This is because the config files will be merged together thanks to OmegaConf (the latter -takes precedence). -Note the param `--cli-config-params` can also be used, at CLI time, to modify/add more parameters. - -### Loggers -Currently, Tensorboard, Comet and Aims are supported. -For Comet, you will have to specify the key and the project. -This can be done in several way (see the Comet-ML docs); a quick way is to set the env variables: -``` -COMET_WORKSPACE=... -COMET_PROJECT_NAME=... -COMET_API_KEY=... -``` - -#### Run locally - -For example, to run on your local machine without Orion: - - cd examples/local - sh run.sh - -This will run a simple MLP on a simple toy task: sum 5 float numbers. -You should see an almost perfect loss of 0 after a few epochs. - -Note you have a new `output` folder which contains models and a summary of results: -* best_model: the best model checkpoint during training -* last_model: the last model checkpoint during training -* lightning_logs: contains the tensorboard logs. - -To view tensorboard logs, simply run: - - tensorboard --logdir output - -#### Run on a remote cluster (with Slurm) - -First, bring you project on the cluster (assuming you didn't create your -project directly there). To do so, simply login on the cluster and git -clone your project: - - git clone git@github.com:${GITHUB_USERNAME}/${PROJECT_NAME}.git - -Then activate your virtual env, and install the dependencies: - - cd amlrt_project - pip install -e . - -To run with Slurm, just: - - cd examples/slurm - sh run.sh - -Check the log to see that you got an almost perfect loss (i.e., 0). - -#### Measure GPU time (and others) on the Mila cluster - -You can track down the GPU time (and other resources) of your jobs by -associating a tag to the job (when using `sbatch`). -To associate a tag to a job, replace `my_tag` with a proper tag, -and uncomment the line (i.e., remove one #) from the line: - - ##SBATCH --wckey=my_tag - -This line is inside the file `examples/slurm_mila/to_submit.sh`. - -To get a sumary for a particular tag, just run: - - sacct --allusers --wckeys=my_tag --format=JobID,JobName,Start,Elapsed -X -P --delimiter=',' - -(again, remember to change `my_tag` into the real tag name) - -#### GPU profiling on the Mila cluster - -It can be useful to monitor and profile how you utilise your GPU (usage, memory, etc.). For the -time being, you can only monitor your profiling in real-time from the Mila cluster, i.e. while your -experiments are running. To monitor your GPU, you need to setup port-forwarding on the host your -experiments are running on. This can be done in the following way: - -Once you have launched your job on the mila cluster, open the log for your current experiment: - -`head logs/amlrt_project__.err` - -You should see printed in the first few lines the hostname of your machine, e.g., - -``` -INFO:amlrt_project.utils.logging_utils:Experiment info: -hostname: leto35 -git code hash: a51bfc5447d188bd6d31fac3afbd5757650ef524 -data folder: ../data -data folder (abs): /network/tmp1/bronzimi/20191105_cookiecutter/amlrt_project/examples/data -``` - -In a separate shell on your local computer, run the following command: - -`ssh -L 19999:.server.mila.quebec:19999 @login.server.mila.quebec -p 2222` - -where `` is your user name on the Mila cluster and `` is the name of the machine your job is currenty running on (`leto35` in our example). You can then navigate your local browser to `http://localhost:19999/` to view the ressources being used on the cluster and monitor your job. You should see something like this: - -![image](https://user-images.githubusercontent.com/18450628/88088807-fe2acd80-cb58-11ea-8ab2-bd090e8a826c.png) -{%- endif %} - -#### Run with Orion on the Slurm cluster - -This example will run orion for 2 trials (see the orion config file). -To do so, go into `examples/slurm_orion`. -Here you can find the orion config file (`orion_config.yaml`), as well as the config -file (`config.yaml`) for your project (that contains the hyper-parameters). - -In general, you will want to run Orion in parallel over N slurm jobs. -To do so, simply run `sh run.sh` N times. - -When Orion has completed the trials, you will find the orion db file. - -You will also find the output of your experiments in `orion_working_dir`, which -will contain a folder for every trial. -Inside these folders, you can find the models (the best one and the last one), the config file with -the hyper-parameters for this trial, and the log file. - -You can check orion status with the following commands: -(to be run from `examples/slurm_orion`) - - export ORION_DB_ADDRESS='orion_db.pkl' - export ORION_DB_TYPE='pickleddb' - orion status - orion info --name my_exp - -### Building docs: - -Documentation is built using sphinx. It will automatically document all functions based on docstrings. -To automatically generate docs for your project, navigate to the `docs` folder and build the documentation: - - cd docs - make html - -To view the docs locally, open `docs/_build/html/index.html` in your browser. - - -## YOUR PROJECT README: +Once you have successfully completed these steps, you can remove this README.md and update it with the template README provided. Adapt it to your needs: -* __TODO__ + mv scripts/README.new.md README.md \ No newline at end of file diff --git a/scripts/README.new.md b/scripts/README.new.md new file mode 100644 index 0000000..a869664 --- /dev/null +++ b/scripts/README.new.md @@ -0,0 +1,196 @@ +# amlrt_project (change this name to the name of your project) + +Replace this line with a short description about your project! + +## Instructions to setup the project + +### Install the dependencies: +First, activate a virtual environment (recommended). +Install the package in `editable` mode so you can modify the source directly: + + pip install -e . + +To add new dependencies, simply add them to the setup.py. + +### Setup pre-commit hooks: +These hooks will: +* validate flake8 before any commit +* check that jupyter notebook outputs have been stripped + + cd .git/hooks/ && ln -s ../../hooks/pre-commit . + +### Setup Continuous Integration + +Continuous integration will run the following: +- Unit tests under `tests`. +- End-to-end test under `exmaples/local`. +- `flake8` to check the code syntax. +- Checks on documentation presence and format (using `sphinx`). + +We support the GitHub Actions for running CI. + +Github actions are already configured in `.github/workflows/tests.yml`. +Github actions are already enabled by default when using Github, so, when +pushing to github, they will be executed automatically for pull requests to +`main` and to `develop`. + +## Running the code + +### Run the tests +Just run (from the root folder): + + pytest + +### Run the code/examples. +Note that the code should already compile at this point. + +Running examples can be found under the `examples` folder. + +In particular, you will find examples for: +* local machine (e.g., your laptop). +* a slurm cluster. + +For both these cases, there is the possibility to run with or without Orion. +(Orion is a hyper-parameter search tool - see https://github.com/Epistimio/orion - +that is already configured in this project) + +In any case, the run script will take multiple config files as arguments (`--configs`). +This is because the config files will be merged together thanks to OmegaConf (the latter +takes precedence). +Note the param `--cli-config-params` can also be used, at CLI time, to modify/add more parameters. + +### Loggers +Currently, Tensorboard, Comet and Aims are supported. +For Comet, you will have to specify the key and the project. +This can be done in several way (see the Comet-ML docs); a quick way is to set the env variables: +``` +COMET_WORKSPACE=... +COMET_PROJECT_NAME=... +COMET_API_KEY=... +``` + +#### Run locally + +For example, to run on your local machine without Orion: + + cd examples/local + sh run.sh + +This will run a simple MLP on a simple toy task: sum 5 float numbers. +You should see an almost perfect loss of 0 after a few epochs. + +Note you have a new `output` folder which contains models and a summary of results: +* best_model: the best model checkpoint during training +* last_model: the last model checkpoint during training +* lightning_logs: contains the tensorboard logs. + +To view tensorboard logs, simply run: + + tensorboard --logdir output + +#### Run on a remote cluster (with Slurm) + +First, bring you project on the cluster (assuming you didn't create your +project directly there). To do so, simply login on the cluster and git +clone your project: + + git clone git@github.com:${GITHUB_USERNAME}/${PROJECT_NAME}.git + +Then activate your virtual env, and install the dependencies: + + cd amlrt_project + pip install -e . + +To run with Slurm, just: + + cd examples/slurm + sh run.sh + +Check the log to see that you got an almost perfect loss (i.e., 0). + +#### Measure GPU time (and others) on the Mila cluster + +You can track down the GPU time (and other resources) of your jobs by +associating a tag to the job (when using `sbatch`). +To associate a tag to a job, replace `my_tag` with a proper tag, +and uncomment the line (i.e., remove one #) from the line: + + ##SBATCH --wckey=my_tag + +This line is inside the file `examples/slurm_mila/to_submit.sh`. + +To get a sumary for a particular tag, just run: + + sacct --allusers --wckeys=my_tag --format=JobID,JobName,Start,Elapsed -X -P --delimiter=',' + +(again, remember to change `my_tag` into the real tag name) + +#### GPU profiling on the Mila cluster + +It can be useful to monitor and profile how you utilise your GPU (usage, memory, etc.). For the +time being, you can only monitor your profiling in real-time from the Mila cluster, i.e. while your +experiments are running. To monitor your GPU, you need to setup port-forwarding on the host your +experiments are running on. This can be done in the following way: + +Once you have launched your job on the mila cluster, open the log for your current experiment: + +`head logs/amlrt_project__.err` + +You should see printed in the first few lines the hostname of your machine, e.g., + +``` +INFO:amlrt_project.utils.logging_utils:Experiment info: +hostname: leto35 +git code hash: a51bfc5447d188bd6d31fac3afbd5757650ef524 +data folder: ../data +data folder (abs): /network/tmp1/bronzimi/20191105_cookiecutter/amlrt_project/examples/data +``` + +In a separate shell on your local computer, run the following command: + +`ssh -L 19999:.server.mila.quebec:19999 @login.server.mila.quebec -p 2222` + +where `` is your user name on the Mila cluster and `` is the name of the machine your job is currenty running on (`leto35` in our example). You can then navigate your local browser to `http://localhost:19999/` to view the ressources being used on the cluster and monitor your job. You should see something like this: + +![image](https://user-images.githubusercontent.com/18450628/88088807-fe2acd80-cb58-11ea-8ab2-bd090e8a826c.png) +{%- endif %} + +#### Run with Orion on the Slurm cluster + +This example will run orion for 2 trials (see the orion config file). +To do so, go into `examples/slurm_orion`. +Here you can find the orion config file (`orion_config.yaml`), as well as the config +file (`config.yaml`) for your project (that contains the hyper-parameters). + +In general, you will want to run Orion in parallel over N slurm jobs. +To do so, simply run `sh run.sh` N times. + +When Orion has completed the trials, you will find the orion db file. + +You will also find the output of your experiments in `orion_working_dir`, which +will contain a folder for every trial. +Inside these folders, you can find the models (the best one and the last one), the config file with +the hyper-parameters for this trial, and the log file. + +You can check orion status with the following commands: +(to be run from `examples/slurm_orion`) + + export ORION_DB_ADDRESS='orion_db.pkl' + export ORION_DB_TYPE='pickleddb' + orion status + orion info --name my_exp + +### Building docs: + +Documentation is built using sphinx. It will automatically document all functions based on docstrings. +To automatically generate docs for your project, navigate to the `docs` folder and build the documentation: + + cd docs + make html + +To view the docs locally, open `docs/_build/html/index.html` in your browser. + + +## YOUR PROJECT README: + +* __TODO__ \ No newline at end of file diff --git a/scripts/quick_install.sh b/scripts/quick_install.sh new file mode 100644 index 0000000..641757a --- /dev/null +++ b/scripts/quick_install.sh @@ -0,0 +1,36 @@ +# This script is used to quickly install the cookiecutter-pyml template +set -e + +# Default value for project_name +project_name="amlrt_project" + +# Parse command-line arguments +while [[ "$#" -gt 0 ]]; do + case $1 in + --project-name) project_name="$2"; shift ;; + *) echo "Unknown parameter passed: $1"; exit 1 ;; + esac + shift +done + +# Use the project_name variable +echo "Cloning cookie-cutter to: $project_name..." +git clone https://github.com/mila-iqia/cookiecutter-pyml.git $project_name + +# Remove the .git folder and reinitialize it +echo "Initializing the git repository..." +cd $project_name +rm -fr .git +git init + +# Replace the README.md file +ls scripts +mv scripts/README.new.md README.md + +echo "Done! You can now visit your project by navigating to it:" +echo "cd $project_name" + +echo "Remember to point it to your github repository:" +echo "git remote add origin git@github.com:\${GITHUB_USERNAME}/\${PROJECT_NAME}.git" +echo "" +echo "For more information, please visit https://github.com/mila-iqia/cookiecutter-pyml" \ No newline at end of file From 7bc86b6cf5cc0d3fb2177856987e246f3fa16411 Mon Sep 17 00:00:00 2001 From: Jeremy Pinto Date: Wed, 14 Aug 2024 10:49:18 -0400 Subject: [PATCH 02/26] remove unused command --- scripts/quick_install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/quick_install.sh b/scripts/quick_install.sh index 641757a..94c5c36 100644 --- a/scripts/quick_install.sh +++ b/scripts/quick_install.sh @@ -24,7 +24,6 @@ rm -fr .git git init # Replace the README.md file -ls scripts mv scripts/README.new.md README.md echo "Done! You can now visit your project by navigating to it:" From 8e1a5da7b5d27ef6eb049d9ed8089865a58bfdf2 Mon Sep 17 00:00:00 2001 From: Jeremy Pinto Date: Thu, 15 Aug 2024 10:27:53 -0400 Subject: [PATCH 03/26] point to interim branch for development --- scripts/quick_install.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/quick_install.sh b/scripts/quick_install.sh index 94c5c36..6968baa 100644 --- a/scripts/quick_install.sh +++ b/scripts/quick_install.sh @@ -15,7 +15,10 @@ done # Use the project_name variable echo "Cloning cookie-cutter to: $project_name..." -git clone https://github.com/mila-iqia/cookiecutter-pyml.git $project_name + +# TODO: Before merging, revert back to installing from main branch +# git clone https://github.com/mila-iqia/cookiecutter-pyml.git $project_name +git clone --branch instal-script https://github.com/mila-iqia/cookiecutter-pyml.git $project_name # Remove the .git folder and reinitialize it echo "Initializing the git repository..." @@ -32,4 +35,4 @@ echo "cd $project_name" echo "Remember to point it to your github repository:" echo "git remote add origin git@github.com:\${GITHUB_USERNAME}/\${PROJECT_NAME}.git" echo "" -echo "For more information, please visit https://github.com/mila-iqia/cookiecutter-pyml" \ No newline at end of file +echo "For more information, please visit https://github.com/mila-iqia/cookiecutter-pyml" From bae84ec5de0f7ed3c56ab8783e95e7a386702b4d Mon Sep 17 00:00:00 2001 From: Jeremy Pinto Date: Thu, 15 Aug 2024 10:53:56 -0400 Subject: [PATCH 04/26] point to development branch (#125) --- scripts/quick_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/quick_install.sh b/scripts/quick_install.sh index 6968baa..b8940d1 100644 --- a/scripts/quick_install.sh +++ b/scripts/quick_install.sh @@ -18,7 +18,7 @@ echo "Cloning cookie-cutter to: $project_name..." # TODO: Before merging, revert back to installing from main branch # git clone https://github.com/mila-iqia/cookiecutter-pyml.git $project_name -git clone --branch instal-script https://github.com/mila-iqia/cookiecutter-pyml.git $project_name +git clone --branch development https://github.com/mila-iqia/cookiecutter-pyml.git $project_name # Remove the .git folder and reinitialize it echo "Initializing the git repository..." From b529cd17b26c222e93bf4d4a7a24d10172af6c9d Mon Sep 17 00:00:00 2001 From: Jeremy Pinto Date: Thu, 15 Aug 2024 12:16:24 -0400 Subject: [PATCH 05/26] add sed command for find/replacing amlrt_project to --- scripts/quick_install.sh | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/scripts/quick_install.sh b/scripts/quick_install.sh index b8940d1..7327877 100644 --- a/scripts/quick_install.sh +++ b/scripts/quick_install.sh @@ -4,6 +4,35 @@ set -e # Default value for project_name project_name="amlrt_project" + +replace_project_name() { + # Replace all instances of amlrt_project with the project name and rename the root folder + local project_name="$1" + + # Check if the OS is macOS or Linux + if [[ "$OSTYPE" == "darwin"* ]]; then + # macOS + + # Replace all instances of amlrt_project with the project name + find . -type f -exec grep -l 'amlrt_project' {} \; | xargs sed -i '' 's/amlrt_project/'"$project_name"'/g' + + # Rename root folder + mv amlrt_project "$project_name" + elif [[ "$OSTYPE" == "linux-gnu"* ]]; then + # Linux + + # Replace all instances of amlrt_project with the project name + find . -type f -exec grep -l 'amlrt_project' {} \; | xargs sed -i 's/amlrt_project/'"$project_name"'/g' + + # Rename root folder + mv amlrt_project "$project_name" + else + echo "Unsupported OS: $OSTYPE" + echo "Your OS is not yet supported. You will have to manually replace all instances of amlrt_project with your project name." + fi +} + + # Parse command-line arguments while [[ "$#" -gt 0 ]]; do case $1 in @@ -26,12 +55,17 @@ cd $project_name rm -fr .git git init +replace_project_name $project_name + # Replace the README.md file mv scripts/README.new.md README.md +echo "" echo "Done! You can now visit your project by navigating to it:" -echo "cd $project_name" +echo "" +echo " cd $project_name" +echo "" echo "Remember to point it to your github repository:" echo "git remote add origin git@github.com:\${GITHUB_USERNAME}/\${PROJECT_NAME}.git" echo "" From 9e58fd84e9ed05dfbbb759816e8bf851f4a11fbc Mon Sep 17 00:00:00 2001 From: Jeremy Pinto Date: Thu, 15 Aug 2024 12:16:31 -0400 Subject: [PATCH 06/26] rename entry points --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 47b80df..918f5e0 100644 --- a/setup.py +++ b/setup.py @@ -34,9 +34,9 @@ entry_points={ 'console_scripts': [ # TODO: change amlrt- prefix, placeholder for now. - 'amlrt-train=amlrt_project.train:main', - 'amlrt-eval=amlrt_project.evaluate:main', - 'merge-configs=amlrt_project.utils.config_utils:main' + 'amlrt_project_train=other_cool_project.train:main', + 'amlrt_project_eval=other_cool_project.evaluate:main', + 'amlrt_project_merge_configs=other_cool_project.utils.config_utils:main' ], } ) From 598c64eedeaebab5ec792fa81a87aba6873cd314 Mon Sep 17 00:00:00 2001 From: Jeremy Pinto Date: Thu, 15 Aug 2024 12:22:16 -0400 Subject: [PATCH 07/26] point to current branch --- scripts/quick_install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/quick_install.sh b/scripts/quick_install.sh index 7327877..f40416b 100644 --- a/scripts/quick_install.sh +++ b/scripts/quick_install.sh @@ -47,7 +47,8 @@ echo "Cloning cookie-cutter to: $project_name..." # TODO: Before merging, revert back to installing from main branch # git clone https://github.com/mila-iqia/cookiecutter-pyml.git $project_name -git clone --branch development https://github.com/mila-iqia/cookiecutter-pyml.git $project_name +# git clone --branch development https://github.com/mila-iqia/cookiecutter-pyml.git $project_name +git clone --branch change-project-name https://github.com/mila-iqia/cookiecutter-pyml.git $project_name # Remove the .git folder and reinitialize it echo "Initializing the git repository..." From 64042fe9cbf5fac82920deeca22d5049fe4b5e36 Mon Sep 17 00:00:00 2001 From: Jeremy Pinto Date: Thu, 15 Aug 2024 12:22:27 -0400 Subject: [PATCH 08/26] change entry point names globally --- examples/local/run.sh | 4 ++-- examples/local_orion/run.sh | 4 ++-- examples/slurm/to_submit.sh | 2 +- examples/slurm_orion/to_submit.sh | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/local/run.sh b/examples/local/run.sh index 9ad11bc..34e988f 100644 --- a/examples/local/run.sh +++ b/examples/local/run.sh @@ -1,3 +1,3 @@ set -e -amlrt-train --data ../data --output output --config ../config.yaml config.yaml --start-from-scratch -amlrt-eval --data ../data --config ../config.yaml config.yaml --ckpt-path output/best_model/model.ckpt +amlrt_project_train --data ../data --output output --config ../config.yaml config.yaml --start-from-scratch +amlrt_project_eval --data ../data --config ../config.yaml config.yaml --ckpt-path output/best_model/model.ckpt diff --git a/examples/local_orion/run.sh b/examples/local_orion/run.sh index a86d49b..4f35338 100644 --- a/examples/local_orion/run.sh +++ b/examples/local_orion/run.sh @@ -2,8 +2,8 @@ set -e export ORION_DB_ADDRESS='orion_db.pkl' export ORION_DB_TYPE='pickleddb' -merge-configs --config ../config.yaml config.yaml --merged-config-file merged_config.yaml -orion -vvv -v hunt --config orion_config.yaml amlrt-train --data ../data \ +amlrt_project_merge_configs --config ../config.yaml config.yaml --merged-config-file merged_config.yaml +orion -vvv -v hunt --config orion_config.yaml amlrt_project_train --data ../data \ --config merged_config.yaml --disable-progressbar \ --output '{exp.working_dir}/{trial.id}/' \ --log '{exp.working_dir}/{trial.id}/exp.log' diff --git a/examples/slurm/to_submit.sh b/examples/slurm/to_submit.sh index b5c88ef..b27e68e 100644 --- a/examples/slurm/to_submit.sh +++ b/examples/slurm/to_submit.sh @@ -27,4 +27,4 @@ export MLFLOW_TRACKING_URI='mlruns' -amlrt-train --data ../data --output output --config ../config.yaml config.yaml --tmp-folder ${SLURM_TMPDIR} --disable-progressbar +amlrt_project_train --data ../data --output output --config ../config.yaml config.yaml --tmp-folder ${SLURM_TMPDIR} --disable-progressbar diff --git a/examples/slurm_orion/to_submit.sh b/examples/slurm_orion/to_submit.sh index 6337bbd..65d7925 100644 --- a/examples/slurm_orion/to_submit.sh +++ b/examples/slurm_orion/to_submit.sh @@ -25,9 +25,9 @@ export ORION_DB_ADDRESS='orion_db.pkl' export ORION_DB_TYPE='pickleddb' -merge-configs --config ../config.yaml config.yaml --merged-config-file merged_config.yaml +amlrt_project_merge_configs --config ../config.yaml config.yaml --merged-config-file merged_config.yaml orion -v hunt --config orion_config.yaml \ - amlrt-train --data ../data --config merged_config.yaml --disable-progressbar \ + amlrt_project_train --data ../data --config merged_config.yaml --disable-progressbar \ --output '{exp.working_dir}/{trial.id}/' \ --log '{exp.working_dir}/{trial.id}/exp.log' \ --tmp-folder ${SLURM_TMPDIR}/{trial.id} From 5ebc218220c7b748f50dcd9ecf82de815c63b9a8 Mon Sep 17 00:00:00 2001 From: Jeremy Pinto Date: Thu, 15 Aug 2024 12:27:11 -0400 Subject: [PATCH 09/26] fix: update setup.py to point to proper name --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 918f5e0..f237117 100644 --- a/setup.py +++ b/setup.py @@ -34,9 +34,9 @@ entry_points={ 'console_scripts': [ # TODO: change amlrt- prefix, placeholder for now. - 'amlrt_project_train=other_cool_project.train:main', - 'amlrt_project_eval=other_cool_project.evaluate:main', - 'amlrt_project_merge_configs=other_cool_project.utils.config_utils:main' + 'amlrt_project_train=amlrt_project.train:main', + 'amlrt_project_eval=amlrt_project.evaluate:main', + 'amlrt_project_merge_configs=amlrt_project.utils.config_utils:main' ], } ) From 05beb02d721658fe3c0e9ddd1df61a59d6dac196 Mon Sep 17 00:00:00 2001 From: Jeremy Pinto Date: Thu, 15 Aug 2024 12:27:47 -0400 Subject: [PATCH 10/26] remove comment --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index f237117..2993125 100644 --- a/setup.py +++ b/setup.py @@ -33,7 +33,6 @@ ], entry_points={ 'console_scripts': [ - # TODO: change amlrt- prefix, placeholder for now. 'amlrt_project_train=amlrt_project.train:main', 'amlrt_project_eval=amlrt_project.evaluate:main', 'amlrt_project_merge_configs=amlrt_project.utils.config_utils:main' From 952228471b729e4a6780317e9053bf20bac1a199 Mon Sep 17 00:00:00 2001 From: Mirko Bronzi Date: Tue, 10 Sep 2024 10:38:43 -0400 Subject: [PATCH 11/26] removed hardcoded params for best checkpoint --- amlrt_project/train.py | 7 ++++--- examples/config.yaml | 6 ++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/amlrt_project/train.py b/amlrt_project/train.py index 8579478..47ebc75 100644 --- a/amlrt_project/train.py +++ b/amlrt_project/train.py @@ -161,14 +161,15 @@ def train_impl(model, datamodule, output, hyper_params, use_progress_bar, check_and_log_hp(['max_epoch'], hyper_params) best_model_path = os.path.join(output, BEST_MODEL_NAME) + best_checkpoint_params = hyper_params['best_checkpoint'] best_checkpoint_callback = ModelCheckpoint( dirpath=best_model_path, filename='model', save_top_k=1, verbose=use_progress_bar, - monitor="val_loss", - mode="min", - every_n_epochs=1, + monitor=best_checkpoint_params['metric'], + mode=best_checkpoint_params['mode'], + every_n_epochs=best_checkpoint_params['every_n_epochs'] ) last_model_path = os.path.join(output, LAST_MODEL_NAME) diff --git a/examples/config.yaml b/examples/config.yaml index c3fcf64..6359ae1 100644 --- a/examples/config.yaml +++ b/examples/config.yaml @@ -27,3 +27,9 @@ early_stopping: metric: val_loss mode: min patience: 3 + +# best checkpoint params +best_checkpoint: + metric: val_loss + mode: min + every_n_epochs: 1 \ No newline at end of file From 728d1de891d5c49a2b0e30cc484c803eb265bf82 Mon Sep 17 00:00:00 2001 From: Mirko Bronzi Date: Tue, 10 Sep 2024 10:48:18 -0400 Subject: [PATCH 12/26] centralized the definition of the metric/mode --- examples/config.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/config.yaml b/examples/config.yaml index 6359ae1..97556dc 100644 --- a/examples/config.yaml +++ b/examples/config.yaml @@ -22,14 +22,20 @@ hidden_dim: 256 num_classes: 10 architecture: simple_mlp +# here wew centralize the metric and the mode to use in both early stopping and +# best checkpoint selection. If instead you want to use different metric/mode, +# remove this section and define them directly in the early_stopping / best_checkpoint blocks. +metric_to_use: 'val_loss' +mode_to_use: 'min' + # early stopping early_stopping: - metric: val_loss - mode: min + metric: ${metric_to_use} + mode: ${mode_to_use} patience: 3 # best checkpoint params best_checkpoint: - metric: val_loss - mode: min + metric: ${metric_to_use} + mode: ${mode_to_use} every_n_epochs: 1 \ No newline at end of file From 1d5a928286643d8735ddc023cf186dea29e0bffa Mon Sep 17 00:00:00 2001 From: Mirko Bronzi Date: Tue, 10 Sep 2024 13:32:55 -0400 Subject: [PATCH 13/26] split end2end tests into 2 components --- .github/workflows/ci.yml | 7 +++++-- .../end2end_pytorch/{run.sh => run_orion.sh} | 17 ----------------- tests/end2end_pytorch/run_single.sh | 19 +++++++++++++++++++ 3 files changed, 24 insertions(+), 19 deletions(-) rename tests/end2end_pytorch/{run.sh => run_orion.sh} (62%) create mode 100755 tests/end2end_pytorch/run_single.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1d3e96..973b2c6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,9 +30,12 @@ jobs: - name: unit tests run: | pytest --cov=amlrt-project - - name: pytorch-end2end + - name: pytorch-end2end-single run: | - ./tests/end2end_pytorch/run.sh + ./tests/end2end_pytorch/run_single.sh + - name: pytorch-end2end-orion + run: | + ./tests/end2end_pytorch/run_orion.sh - name: type checking run: | pytype amlrt_project/ diff --git a/tests/end2end_pytorch/run.sh b/tests/end2end_pytorch/run_orion.sh similarity index 62% rename from tests/end2end_pytorch/run.sh rename to tests/end2end_pytorch/run_orion.sh index 247c2b1..963cce3 100755 --- a/tests/end2end_pytorch/run.sh +++ b/tests/end2end_pytorch/run_orion.sh @@ -2,23 +2,6 @@ set -e # go to the examples folder and run the example -cd $GITHUB_WORKSPACE/examples/local -sh run.sh -mv output output_OLD -# re-run the example to check reproducibility -sh run.sh -# check results are the same -echo "results are:" -cat output*/results.txt -DIFF_LINES=`cat output*/results.txt | uniq | wc -l` -if [ ${DIFF_LINES} -gt 1 ]; then - echo "ERROR: two identical runs produced different output results - review seed implementation" - exit 1 -else - echo "PASS: two identical runs produced the same output results." -fi - -# run Orion cd $GITHUB_WORKSPACE/examples/local_orion sh run.sh mv orion_working_dir orion_working_dir_OLD diff --git a/tests/end2end_pytorch/run_single.sh b/tests/end2end_pytorch/run_single.sh new file mode 100755 index 0000000..c364273 --- /dev/null +++ b/tests/end2end_pytorch/run_single.sh @@ -0,0 +1,19 @@ +# exit at the first error +set -e + +# go to the examples folder and run the example +cd $GITHUB_WORKSPACE/examples/local +sh run.sh +mv output output_OLD +# re-run the example to check reproducibility +sh run.sh +# check results are the same +echo "results are:" +cat output*/results.txt +DIFF_LINES=`cat output*/results.txt | uniq | wc -l` +if [ ${DIFF_LINES} -gt 1 ]; then + echo "ERROR: two identical runs produced different output results - review seed implementation" + exit 1 +else + echo "PASS: two identical runs produced the same output results." +fi \ No newline at end of file From 1686aa75e43272a3f82ac6b0bc6f9c62601c4fd6 Mon Sep 17 00:00:00 2001 From: Mirko Bronzi Date: Tue, 10 Sep 2024 16:24:03 -0400 Subject: [PATCH 14/26] added test on eval results --- examples/local/eval.sh | 1 + examples/local/run.sh | 2 -- tests/end2end_pytorch/run_single.sh | 13 +++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 examples/local/eval.sh diff --git a/examples/local/eval.sh b/examples/local/eval.sh new file mode 100644 index 0000000..e632675 --- /dev/null +++ b/examples/local/eval.sh @@ -0,0 +1 @@ +amlrt-eval --data ../data --config ../config.yaml config.yaml --ckpt-path output/best_model/model.ckpt diff --git a/examples/local/run.sh b/examples/local/run.sh index 9ad11bc..251ee1f 100644 --- a/examples/local/run.sh +++ b/examples/local/run.sh @@ -1,3 +1 @@ -set -e amlrt-train --data ../data --output output --config ../config.yaml config.yaml --start-from-scratch -amlrt-eval --data ../data --config ../config.yaml config.yaml --ckpt-path output/best_model/model.ckpt diff --git a/tests/end2end_pytorch/run_single.sh b/tests/end2end_pytorch/run_single.sh index c364273..9923e40 100755 --- a/tests/end2end_pytorch/run_single.sh +++ b/tests/end2end_pytorch/run_single.sh @@ -16,4 +16,17 @@ if [ ${DIFF_LINES} -gt 1 ]; then exit 1 else echo "PASS: two identical runs produced the same output results." +fi + +# now run eval and store the results on valid in a variable +EVAL_RESULT=`sh run.sh | grep "Validation Metrics"` +CLEANED_RESULT=`echo $EVAL_RESULT | sed 's/.*: //g' | sed 's/}.*//g'` +TRAIN_RESULT=`cat output/results.txt` + +# Compare the two values, formatted to 5 decimal places +if ! [ "$(printf "%.5f" "$EVAL_RESULT")" = "$(printf "%.5f" "$TRAIN_RESULT")" ]; then + echo "results are NOT equal up to 5 decimal places." + exit 1 +else + echo "results are equal." fi \ No newline at end of file From 6d65a72098c448b9ab57194f2251df69fd2c66d3 Mon Sep 17 00:00:00 2001 From: Mirko Bronzi Date: Tue, 10 Sep 2024 16:29:52 -0400 Subject: [PATCH 15/26] fixed bug in result eval in test script --- tests/end2end_pytorch/run_single.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/end2end_pytorch/run_single.sh b/tests/end2end_pytorch/run_single.sh index 9923e40..9ef14d0 100755 --- a/tests/end2end_pytorch/run_single.sh +++ b/tests/end2end_pytorch/run_single.sh @@ -20,11 +20,13 @@ fi # now run eval and store the results on valid in a variable EVAL_RESULT=`sh run.sh | grep "Validation Metrics"` -CLEANED_RESULT=`echo $EVAL_RESULT | sed 's/.*: //g' | sed 's/}.*//g'` +CLEANED_EVAL_RESULT=`echo $EVAL_RESULT | sed 's/.*: //g' | sed 's/}.*//g'` TRAIN_RESULT=`cat output/results.txt` +echo "train results: ${TRAIN_RESULT} / eval results: ${CLEANED_EVAL_RESULT}" + # Compare the two values, formatted to 5 decimal places -if ! [ "$(printf "%.5f" "$EVAL_RESULT")" = "$(printf "%.5f" "$TRAIN_RESULT")" ]; then +if ! [ "$(printf "%.5f" "$CLEANED_EVAL_RESULT")" = "$(printf "%.5f" "$TRAIN_RESULT")" ]; then echo "results are NOT equal up to 5 decimal places." exit 1 else From 7d1819f7496c098b95fe6740e313efa6197c899a Mon Sep 17 00:00:00 2001 From: Mirko Bronzi Date: Tue, 10 Sep 2024 16:42:52 -0400 Subject: [PATCH 16/26] debugging --- tests/end2end_pytorch/run_single.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/end2end_pytorch/run_single.sh b/tests/end2end_pytorch/run_single.sh index 9ef14d0..31c727d 100755 --- a/tests/end2end_pytorch/run_single.sh +++ b/tests/end2end_pytorch/run_single.sh @@ -20,15 +20,15 @@ fi # now run eval and store the results on valid in a variable EVAL_RESULT=`sh run.sh | grep "Validation Metrics"` -CLEANED_EVAL_RESULT=`echo $EVAL_RESULT | sed 's/.*: //g' | sed 's/}.*//g'` -TRAIN_RESULT=`cat output/results.txt` +#CLEANED_EVAL_RESULT=`echo $EVAL_RESULT | sed 's/.*: //g' | sed 's/}.*//g'` +#TRAIN_RESULT=`cat output/results.txt` -echo "train results: ${TRAIN_RESULT} / eval results: ${CLEANED_EVAL_RESULT}" +#echo "train results: ${TRAIN_RESULT} / eval results: ${CLEANED_EVAL_RESULT}" # Compare the two values, formatted to 5 decimal places -if ! [ "$(printf "%.5f" "$CLEANED_EVAL_RESULT")" = "$(printf "%.5f" "$TRAIN_RESULT")" ]; then - echo "results are NOT equal up to 5 decimal places." - exit 1 -else - echo "results are equal." -fi \ No newline at end of file +#if ! [ "$(printf "%.5f" "$CLEANED_EVAL_RESULT")" = "$(printf "%.5f" "$TRAIN_RESULT")" ]; then +# echo "results are NOT equal up to 5 decimal places." +# exit 1 +#else +# echo "results are equal." +#fi \ No newline at end of file From ba3572736aa51bf12f97b86c7c772c129f55572b Mon Sep 17 00:00:00 2001 From: Mirko Bronzi Date: Tue, 10 Sep 2024 16:47:40 -0400 Subject: [PATCH 17/26] continuing debugging --- tests/end2end_pytorch/run_single.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/end2end_pytorch/run_single.sh b/tests/end2end_pytorch/run_single.sh index 31c727d..25e9ae9 100755 --- a/tests/end2end_pytorch/run_single.sh +++ b/tests/end2end_pytorch/run_single.sh @@ -19,16 +19,16 @@ else fi # now run eval and store the results on valid in a variable -EVAL_RESULT=`sh run.sh | grep "Validation Metrics"` -#CLEANED_EVAL_RESULT=`echo $EVAL_RESULT | sed 's/.*: //g' | sed 's/}.*//g'` -#TRAIN_RESULT=`cat output/results.txt` +EVAL_RESULT=`sh eval.sh | grep "Validation Metrics"` +CLEANED_EVAL_RESULT=`echo $EVAL_RESULT | sed 's/.*: //g' | sed 's/}.*//g'` +TRAIN_RESULT=`cat output/results.txt` -#echo "train results: ${TRAIN_RESULT} / eval results: ${CLEANED_EVAL_RESULT}" +echo "train results: ${TRAIN_RESULT} / eval results: ${CLEANED_EVAL_RESULT}" # Compare the two values, formatted to 5 decimal places -#if ! [ "$(printf "%.5f" "$CLEANED_EVAL_RESULT")" = "$(printf "%.5f" "$TRAIN_RESULT")" ]; then -# echo "results are NOT equal up to 5 decimal places." -# exit 1 -#else -# echo "results are equal." -#fi \ No newline at end of file +if ! [ "$(printf "%.5f" "$CLEANED_EVAL_RESULT")" = "$(printf "%.5f" "$TRAIN_RESULT")" ]; then + echo "results are NOT equal up to 5 decimal places." + exit 1 +else + echo "results are equal." +fi \ No newline at end of file From 2a5ab241146cc0b13ccb865109b110a0a92e27eb Mon Sep 17 00:00:00 2001 From: Mirko Bronzi Date: Tue, 10 Sep 2024 16:52:51 -0400 Subject: [PATCH 18/26] fixed parsing bug --- tests/end2end_pytorch/run_single.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/end2end_pytorch/run_single.sh b/tests/end2end_pytorch/run_single.sh index 25e9ae9..4303d28 100755 --- a/tests/end2end_pytorch/run_single.sh +++ b/tests/end2end_pytorch/run_single.sh @@ -22,11 +22,12 @@ fi EVAL_RESULT=`sh eval.sh | grep "Validation Metrics"` CLEANED_EVAL_RESULT=`echo $EVAL_RESULT | sed 's/.*: //g' | sed 's/}.*//g'` TRAIN_RESULT=`cat output/results.txt` +CLEANED_TRAIN_RESULT=`echo TRAIN_RESULT | sed 's/.*: //g'` -echo "train results: ${TRAIN_RESULT} / eval results: ${CLEANED_EVAL_RESULT}" +echo "train results: ${CLEANED_TRAIN_RESULT} / eval results: ${CLEANED_EVAL_RESULT}" # Compare the two values, formatted to 5 decimal places -if ! [ "$(printf "%.5f" "$CLEANED_EVAL_RESULT")" = "$(printf "%.5f" "$TRAIN_RESULT")" ]; then +if ! [ "$(printf "%.5f" "$CLEANED_EVAL_RESULT")" = "$(printf "%.5f" "$CLEANED_TRAIN_RESULT")" ]; then echo "results are NOT equal up to 5 decimal places." exit 1 else From 175d7195b6a09632994b9456bf1fef20a5957b9f Mon Sep 17 00:00:00 2001 From: Mirko Bronzi Date: Tue, 10 Sep 2024 16:55:07 -0400 Subject: [PATCH 19/26] running the single experiment for 2 epochs --- examples/local/config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/local/config.yaml b/examples/local/config.yaml index 38b0ec8..20b8fd0 100644 --- a/examples/local/config.yaml +++ b/examples/local/config.yaml @@ -1,2 +1,5 @@ +# note how this param is overriding the parent config one (check folder above) +max_epoch: 2 + # architecture hidden_dim: 256 From 8ce0f983c149623a47ced7fabff020319ca2fedc Mon Sep 17 00:00:00 2001 From: Mirko Bronzi Date: Tue, 10 Sep 2024 17:00:00 -0400 Subject: [PATCH 20/26] another parser bug --- tests/end2end_pytorch/run_single.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/end2end_pytorch/run_single.sh b/tests/end2end_pytorch/run_single.sh index 4303d28..c8ec7c9 100755 --- a/tests/end2end_pytorch/run_single.sh +++ b/tests/end2end_pytorch/run_single.sh @@ -22,7 +22,7 @@ fi EVAL_RESULT=`sh eval.sh | grep "Validation Metrics"` CLEANED_EVAL_RESULT=`echo $EVAL_RESULT | sed 's/.*: //g' | sed 's/}.*//g'` TRAIN_RESULT=`cat output/results.txt` -CLEANED_TRAIN_RESULT=`echo TRAIN_RESULT | sed 's/.*: //g'` +CLEANED_TRAIN_RESULT=`echo ${TRAIN_RESULT} | sed 's/.*: //g'` echo "train results: ${CLEANED_TRAIN_RESULT} / eval results: ${CLEANED_EVAL_RESULT}" From 6bca2faad096094023646ef1bd9d6bab7a128012 Mon Sep 17 00:00:00 2001 From: Mirko Bronzi Date: Wed, 11 Sep 2024 14:46:44 -0400 Subject: [PATCH 21/26] fix to address an update in develop --- examples/local/eval.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/local/eval.sh b/examples/local/eval.sh index e632675..8af79a6 100644 --- a/examples/local/eval.sh +++ b/examples/local/eval.sh @@ -1 +1 @@ -amlrt-eval --data ../data --config ../config.yaml config.yaml --ckpt-path output/best_model/model.ckpt +amlrt_project_eval --data ../data --config ../config.yaml config.yaml --ckpt-path output/best_model/model.ckpt From 26ed7a5ae30f6be927842338549c2357c9082603 Mon Sep 17 00:00:00 2001 From: Mirko Bronzi Date: Thu, 3 Oct 2024 12:19:23 -0400 Subject: [PATCH 22/26] switching to python 3.11 --- .github/workflows/ci.yml | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 973b2c6..a41f74b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: python-3.9 + - name: python-3.11 uses: actions/setup-python@v2 with: - python-version: 3.9 + python-version: 3.11 - name: linting checks run: | python -m pip install --upgrade pip diff --git a/setup.py b/setup.py index 2993125..74fadf2 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ name='amlrt_project', version='0.0.1', packages=find_packages(include=['amlrt_project', 'amlrt_project.*']), - python_requires='>=3.9', + python_requires='>=3.11', install_requires=[ 'aim==3.18.1; os_name!="nt"', 'comet-ml==3.39.3', From 6943e6e04251324542d8a3fa97e85c3044f8a6d9 Mon Sep 17 00:00:00 2001 From: Mirko Bronzi Date: Thu, 3 Oct 2024 12:20:29 -0400 Subject: [PATCH 23/26] fixed version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 74fadf2..8633a97 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='amlrt_project', - version='0.0.1', + version='3.2.0', packages=find_packages(include=['amlrt_project', 'amlrt_project.*']), python_requires='>=3.11', install_requires=[ From f6760df9447c54292647b93260d95ec75ec2cc37 Mon Sep 17 00:00:00 2001 From: Mirko Bronzi Date: Thu, 3 Oct 2024 16:57:44 -0400 Subject: [PATCH 24/26] flake8 now does not run in .venv --- .flake8 | 3 ++- hooks/pre-commit | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index 469e681..56124f5 100644 --- a/.flake8 +++ b/.flake8 @@ -1,4 +1,5 @@ [flake8] max-line-length=100 ignore=W503,D104,D100,D401 -docstring-convention=google \ No newline at end of file +docstring-convention=google +exclude= .venv diff --git a/hooks/pre-commit b/hooks/pre-commit index 96715b2..2cac5c6 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -5,7 +5,8 @@ set -e # linting flake8 --ignore D . # Check everything but docstrings -flake8 --select D --exclude tests/ # Check only the docstrings +flake8 --select D . --exclude tests/,.venv # Check only the docstrings +exit isort --check . # Check imports # Raise error if any staged notebooks contain outputs From 518ffda2c05ba30f9b8ce5cbd72c17893d6b87b0 Mon Sep 17 00:00:00 2001 From: Mirko Bronzi Date: Thu, 3 Oct 2024 16:58:47 -0400 Subject: [PATCH 25/26] removed leftover exit command --- hooks/pre-commit | 1 - 1 file changed, 1 deletion(-) diff --git a/hooks/pre-commit b/hooks/pre-commit index 2cac5c6..b930ae1 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -6,7 +6,6 @@ set -e # linting flake8 --ignore D . # Check everything but docstrings flake8 --select D . --exclude tests/,.venv # Check only the docstrings -exit isort --check . # Check imports # Raise error if any staged notebooks contain outputs From af83f077cf83f4baa15da05aa463edf055199099 Mon Sep 17 00:00:00 2001 From: Jeremy Pinto Date: Thu, 10 Oct 2024 13:23:34 -0400 Subject: [PATCH 26/26] Minor fixes (#134) * Update branch references --- README.md | 4 ++-- scripts/quick_install.sh | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3a5fa05..4a0b853 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ For convenience, you can run: - bash <(curl -s https://raw.githubusercontent.com/mila-iqia/cookiecutter-pyml/main/scripts/quick_install.sh) --project-name my_new_project + bash <(curl -s https://raw.githubusercontent.com/mila-iqia/cookiecutter-pyml/master/scripts/quick_install.sh) --project-name my_new_project replace `my_new_project` with the name of your project (the default value is `amlrt_project`). This will clone and setup the cookiecutter for you in the newly created folder `my_new_project`. @@ -67,4 +67,4 @@ just pushed, i.e., `git@github.com:${GITHUB_USERNAME}/${PROJECT_NAME}.git`). Once you have successfully completed these steps, you can remove this README.md and update it with the template README provided. Adapt it to your needs: - mv scripts/README.new.md README.md \ No newline at end of file + mv scripts/README.new.md README.md diff --git a/scripts/quick_install.sh b/scripts/quick_install.sh index f40416b..8b54e94 100644 --- a/scripts/quick_install.sh +++ b/scripts/quick_install.sh @@ -45,10 +45,9 @@ done # Use the project_name variable echo "Cloning cookie-cutter to: $project_name..." -# TODO: Before merging, revert back to installing from main branch +# TODO: Once this has been properly merged to master, update ref to point to master # git clone https://github.com/mila-iqia/cookiecutter-pyml.git $project_name -# git clone --branch development https://github.com/mila-iqia/cookiecutter-pyml.git $project_name -git clone --branch change-project-name https://github.com/mila-iqia/cookiecutter-pyml.git $project_name +git clone --branch development https://github.com/mila-iqia/cookiecutter-pyml.git $project_name # Remove the .git folder and reinitialize it echo "Initializing the git repository..."