|
| 1 | +# Contributing to TRAK |
| 2 | + |
| 3 | +Thanks for your interest in contributing to TRAK! We welcome any sort of |
| 4 | +feedback---bug fixes, questions, extensions, etc. |
| 5 | + |
| 6 | +## Extending TRAK |
| 7 | + |
| 8 | +If you have extended TRAK to your own task (e.g., by subclassing |
| 9 | +`AbstractModelOutput` or `AbstractGradientComputer`), you can make a pull |
| 10 | +request to add your extension to the `trak/contrib` directory. Then, users |
| 11 | +can use your extension by importing it from `trak.contrib`. Below, we provide |
| 12 | +guidelines for how to structure your extension. |
| 13 | + |
| 14 | +1. Create a new directory in `trak/contrib` for your extension. For example, |
| 15 | + if you are extending TRAK to work with diffusion models, you might create |
| 16 | + a directory called `diffusion_models`. |
| 17 | + |
| 18 | +2. Create a `README.md` file in your new directory. This file should contain |
| 19 | + a description of your extension and a brief example of how to use it. |
| 20 | + |
| 21 | +3. Add all modules that implement your extension. |
| 22 | + |
| 23 | +4. If your extension requires any dependencies that are not already listed in |
| 24 | + `setup.py`, add an entry to the `extras_require` dictionary in `setup.py`. |
| 25 | + For example, if your extension requires `diffusers`, you might add the |
| 26 | + following: `'diffusion_models': ['diffusers']`. Then, users can install your |
| 27 | + extension's dependencies with `pip install traker[diffusion_models]`. Do |
| 28 | + **not** add the dependencies to the `install_requires` list in `setup.py`. |
| 29 | + |
| 30 | +5. Add any tests in a subdirectory of `tests/contrib` matching the name of your |
| 31 | + extension's directory. For example, if your extension is in |
| 32 | + `trak/contrib/diffusion_models`, add tests in |
| 33 | + `tests/contrib/diffusion_models`. At a minimum, submit an integration test |
| 34 | + that demonstrates how to use your extension. Ideally, also submit unit tests |
| 35 | + that verify that your extension works as expected. |
| 36 | + |
| 37 | +6. Once you are done, make a pull request to add your extension to TRAK. |
| 38 | + |
| 39 | +## Bugs |
| 40 | + |
| 41 | +If you observe a bug, make an issue with a code snippet that reproduces the |
| 42 | +undesired behavior. Feel free to make pull requests that address the bug (see |
| 43 | +below). |
| 44 | + |
| 45 | +## Bug fixes |
| 46 | + |
| 47 | +If you observe a bug, and you know how to fix it, feel free to make a pull |
| 48 | +request that fixes the bug. Please include a unit test that demonstrates the |
| 49 | +bug and verifies that your fix works. Additionally, please run the existing |
| 50 | +tests to ensure that your fix does not break any existing functionality. You can |
| 51 | +install the test dependencies with `pip install traker[tests]`. |
| 52 | + |
| 53 | +Note that some of the tests are compute-intensive and may require a GPU to run. |
| 54 | +So long as your fix does not interact at all with the functionality being tested |
| 55 | +by these tests, you can skip them by running `pytest -m "not cuda"`. |
0 commit comments