{"id":19855192,"url":"https://github.com/leggedrobotics/plr-exercise","last_synced_at":"2025-05-02T01:30:44.879Z","repository":{"id":224968484,"uuid":"764559852","full_name":"leggedrobotics/plr-exercise","owner":"leggedrobotics","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-28T13:18:57.000Z","size":2500,"stargazers_count":8,"open_issues_count":4,"forks_count":33,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T20:46:32.315Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leggedrobotics.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-28T09:53:19.000Z","updated_at":"2024-10-09T16:56:10.000Z","dependencies_parsed_at":"2024-03-08T11:42:45.499Z","dependency_job_id":"b1074f28-26c1-4fcf-afb9-a568ff4953c5","html_url":"https://github.com/leggedrobotics/plr-exercise","commit_stats":null,"previous_names":["leggedrobotics/plr-exercise"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leggedrobotics%2Fplr-exercise","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leggedrobotics%2Fplr-exercise/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leggedrobotics%2Fplr-exercise/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leggedrobotics%2Fplr-exercise/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leggedrobotics","download_url":"https://codeload.github.com/leggedrobotics/plr-exercise/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251969274,"owners_count":21673183,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T14:11:59.993Z","updated_at":"2025-05-02T01:30:42.403Z","avatar_url":"https://github.com/leggedrobotics.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Best Practices for your ML-Project\n\n## Setting up a virtual environment\n[https://packaging.python.org/en/latest/guides/section-install/](https://packaging.python.org/en/latest/guides/section-install/)\n\n\nCreate folder to store virtual environments:\n```shell\nmkdir ~/venv\n```\n\nCreate the virtual environment:\n```shell\npython3 -m venv ~/venv/plr\n```\n\nTest the virtual environment\n```shell\nsource ~/venv/plr/bin/activate\nwhich python\n```\n\nAdd alias to .bashrc or .zshrc to easier source venv.\n```shell\ncode ~/.bashrc\n\n# Append the following and save file\n\nalias venv_plr=\"source ~/venv/plr/bin/activate\"\n```\n\n## Transforming scrips into a software project\nCreate a fork of the project on GitHub\n```shell\ncd ~/git\ngit clone git@github.com:leggedrobotics/plr-exercise.git\n```\n\nReplace `leggedrobotics` with your `username`.\n\nSmall notice you can clone a repo using ssh or https. \nI recommend to setup ssh-keys and always use ssh. \n\nThen go to the Github Settings to right:  \n![alt text](docs/repo.jpg)\n\n\nActivate under General the following Features:  \n![alt text](docs/features.jpg)\n\n### Submission instructions\nYou at first create a fork of the plr-exercise repository under your local GitHub username.  \nFor each task you create a branch called: `dev/task_X`  \nYou commit all the changes necessary for this task to this branch and push the changes to GitHub.  \nTo finish a task you create a pull request from `dev/task_X` to `main`. \nThe title of the pull request is the task description below.  \nDo not delete the branches after merging the PR.  \n\nTask Descriptions:\n- **Task 0:** Run train.py and create an issue and complain about your low test score.\n- **Task 1:** Improve the formatting using black\n- **Task 2:** Create a python package for your project\n- **Task 3:** Add a online logging framework\n- **Task 4:** Use optuna to perform a hyperparameter search\n- **Task 5:** Add docstrings to every file.\n\n\n### Overview\nYou are given the `train.py` script.\nTry to run the script: \n\n```shell\npython3 train.py\n```\n\nThe final test result will be printed to the command line:\n```shell\nTest set: Average loss: X.XXXX, Accuracy: XXXX/10000 (XX%)\n```\nCreate an issue on GitHub complaining about the low test result.\n\nWhile the file is very simple it has some problems with the formatting and also does not scale to a larger project. \n\n\n🚀🚀🚀 Let's improve this together! 🚀🚀🚀\n\n\n### Task 1\nYour first task is to install `black` and format the code. \nTake a look here: [https://github.com/psf/black](https://github.com/psf/black)\n\n```shell\npip3 install black\nblack --line-length 120 ~/git/plr-exercise\n```\nNow everything looks pretty.\n\n\n### Task 2\nYou have to correctly create a `setup.py`\nThen you can install the package as follows:\n\n```\ncd ~/git/plr-exercise\npip3 install -e ./\n```\n\nWe would like the repository structure to look as follows:\n\n```yaml\nproject_name:\n├──results:\t\n│    ├──YEAR_MONTH_DAY_TIME_experiment_name:\n│        ├──results.yml \n│        └──....\n│\n├──project_name:\n│    ├──models:\n│    |   ├──cnn.py\n│    |   └──__init__.py\n│    └──__init__.py   \n│        \n├──scripts:\n│    ├──train.py\n│    └──timeing.py \n│\n├──setup.py\n├──.gitignore\n├──README.md\n```\n\nHowever, we do not want to commit the files within the results folder.  \nCreate a `.gitignore` file and add all the files within the results to be ignored.\n\n### Task 3\nAdd wandb logger.\n\n```shell\npip3 install wandb\n```\nFollow the quickstart guide here: [https://docs.wandb.ai/quickstart](https://docs.wandb.ai/quickstart)  \nLog the training_loss, test_loss, and your code as an artificat.  \nCreate a PR with a screenshot of a run with the loss curve and the uploaded source code artifact.  \n\n\n### Task 4\nUse optuna to find the best learning rate and epoch.\n\n```shell\npip3 install optuna\n```\n\nThis may be a good starting point [https://optuna.org/#code_examples](https://optuna.org/#code_examples)\n\n```python\nimport optuna\n\ndef objective(trial):\n    x = trial.suggest_float('x', -10, 10)\n    return (x - 2) ** 2\n\nstudy = optuna.create_study()\nstudy.optimize(objective, n_trials=100)\n\nstudy.best_params  # E.g. {'x': 2.002108042}\n```\n\n### Task 5 \nAdd docstrings to all classes and functions: [https://peps.python.org/pep-0257/](https://peps.python.org/pep-0257/)  \nHere are some workflows by the RSL that may help you: [https://github.com/leggedrobotics/workflows](https://github.com/leggedrobotics/workflows)\n\n\n## Things we did not cover\n- Timing - check out the `timing.py` and try to understand why the times are different \n- Typing\n- GitHub Actions\n\n## Bonus points\n\nYou can get bonus points if you improve this version of this README by fixing errors or adding other usefull \"tasks\" below that you think will help others.\nThis may include: \n- Improved Reproducability\n- Visualization\n- Configuration with Hydra, OmegaConfiguration\n- Measuring the time\n\n## Other usefull tasks [Bonus Points]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleggedrobotics%2Fplr-exercise","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleggedrobotics%2Fplr-exercise","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleggedrobotics%2Fplr-exercise/lists"}