Skip to content

Commit bd955fd

Browse files
Add CODE_OF_CONDUCT.md and update CONTRIBUTING.md
Signed-off-by: Keval Morabia <[email protected]>
1 parent 3708535 commit bd955fd

File tree

3 files changed

+184
-26
lines changed

3 files changed

+184
-26
lines changed

CODE_OF_CONDUCT.md

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
- Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
- The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported through GitHub's report functionality.
63+
64+
All complaints will be reviewed and investigated promptly and fairly by the
65+
administrators of this repository.
66+
67+
All community leaders are obligated to respect the privacy and security of the
68+
reporter of any incident.
69+
70+
## Enforcement Guidelines
71+
72+
Community leaders will follow these Community Impact Guidelines in determining
73+
the consequences for any action they deem in violation of this Code of Conduct:
74+
75+
### 1. Correction
76+
77+
**Community Impact**: Use of inappropriate language or other behavior deemed
78+
unprofessional or unwelcome in the community.
79+
80+
**Consequence**: A private, written warning from community leaders, providing
81+
clarity around the nature of the violation and an explanation of why the
82+
behavior was inappropriate. A public apology may be requested.
83+
84+
### 2. Warning
85+
86+
**Community Impact**: A violation through a single incident or series of
87+
actions.
88+
89+
**Consequence**: A warning with consequences for continued behavior. No
90+
interaction with the people involved, including unsolicited interaction with
91+
those enforcing the Code of Conduct, for a specified period of time. This
92+
includes avoiding interactions in community spaces as well as external channels
93+
like social media. Violating these terms may lead to a temporary or permanent
94+
ban.
95+
96+
### 3. Temporary Ban
97+
98+
**Community Impact**: A serious violation of community standards, including
99+
sustained inappropriate behavior.
100+
101+
**Consequence**: A temporary ban from any sort of interaction or public
102+
communication with the community for a specified period of time. No public or
103+
private interaction with the people involved, including unsolicited interaction
104+
with those enforcing the Code of Conduct, is allowed during this period.
105+
Violating these terms may lead to a permanent ban.
106+
107+
### 4. Permanent Ban
108+
109+
**Community Impact**: Demonstrating a pattern of violation of community
110+
standards, including sustained inappropriate behavior, harassment of an
111+
individual, or aggression toward or disparagement of classes of individuals.
112+
113+
**Consequence**: A permanent ban from any sort of public interaction within the
114+
community.
115+
116+
## Attribution
117+
118+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119+
version 2.1, available at
120+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121+
122+
Community Impact Guidelines were inspired by
123+
[Mozilla's code of conduct enforcement ladder][mozilla coc].
124+
125+
For answers to common questions about this code of conduct, see the FAQ at
126+
[https://www.contributor-covenant.org/faq][faq]. Translations are available at
127+
[https://www.contributor-covenant.org/translations][translations].
128+
129+
[faq]: https://www.contributor-covenant.org/faq
130+
[homepage]: https://www.contributor-covenant.org
131+
[mozilla coc]: https://github.com/mozilla/diversity
132+
[translations]: https://www.contributor-covenant.org/translations
133+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html

CONTRIBUTING.md

Lines changed: 49 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,63 @@
1-
# TensorRT Model Optimizer OSS Contribution Rules
1+
# Contributing to TensorRT Model Optimizer
22

3-
This readme provides guidelines for writing and contributing code to the this repository. Make sure
4-
that all `dev` optional requirements are installed with ModelOpt.
3+
Thanks for your interest in contributing to TensorRT Model Optimizer (ModelOpt)!
54

6-
## Code linting
5+
## 🛠️ Setting up your environment
76

8-
- All code (Python and C++) is auto-checked to adhere to the coding standards upon commit (see below for more info).
9-
- Check out [`.pre-commit-config.yaml`](.pre-commit-config.yaml) for detailed information about each tool.
10-
- If you would like to integrate the linting tools into your IDE, check out the
11-
documentation for the respective IDE, e.g., docs for [auto-formatting](https://code.visualstudio.com/docs/python/editing#_formatting) and
12-
[linting](https://code.visualstudio.com/docs/python/linting) in VSCode.
13-
- For VSCode, we also provide default workspace settings, see [here](./.vscode/settings.json) for detailed instructions.
7+
Ensure that TensorRT Model Optimizer (ModelOpt) is installed in editable mode and that all `dev` optional requirements are installed:
148

15-
## Pre-commit hooks
9+
```bash
10+
pip install -e ".[dev]"
11+
```
12+
13+
If you are working on features that require dependencies like TensorRT-LLM or Megatron-Core, consider using a docker container to simplify the setup process.
14+
See [docker README](./README.md#installation--docker) for more details.
15+
16+
## 🧹 Code linting and formatting
1617

17-
Please enable pre-commit hooks as follows to automatically check / fix code quality before issues committing:
18+
- All code (Python, C++, Markdown, etc.) is automatically checked to adhere to the coding standards upon commit (see below for more information).
19+
- See [`.pre-commit-config.yaml`](.pre-commit-config.yaml) for details about each tool.
20+
- For VSCode or Cursor, we provide default workspace settings to integrate the linting tools into your IDE: see [workspace settings](./.vscode/settings.json).
21+
22+
### Pre-commit hooks
23+
24+
Enable pre-commit hooks to automatically check and fix code quality before committing:
1825

1926
```bash
2027
pre-commit install
2128
```
2229

23-
If you simply want to add some temporary commit that skips the checks, you can use the `-n` flag during commit:
30+
If you want to make a temporary commit that skips checks, use the `-n` flag when committing:
2431

2532
```bash
2633
git commit -m "temporary commit" -n
2734
```
2835

29-
If you want to run the pre-commit hooks without committing, you can use the following command:
36+
To run the pre-commit hooks without committing, use:
3037

3138
```bash
3239
pre-commit run --all-files
3340
```
3441

42+
## 📝 Writing tests
43+
44+
We use [pytest](https://docs.pytest.org/) for all tests. The tests are organized into the following directories:
45+
46+
- `tests/unit`: Fast cpu-based unit tests for the core ModelOpt library. They should not take more than a few seconds to run.
47+
- `tests/gpu`: Fast GPU-based unit tests for the core ModelOpt library. In most cases, they should not take more than a few seconds to run.
48+
- `tests/examples`: Integration tests for ModelOpt examples. They should not take more than a few minutes to run. Please refer to [example test README](./tests/examples/README.md) for more details.
49+
50+
Please refer to [tox.ini](./tox.ini) for more details on how to run the tests and their dependencies.
51+
52+
### Code Coverage
53+
54+
For any new features / examples, make sure to they are covered by the tests and that the Codecov coverage check in your PR passes.
55+
3556
## Submitting your code
3657

37-
- Create a fork of the repository.
38-
- Rebase (not merge) your code to the most recent commit of the main branch. We want to ensure linear history,
39-
check [Merge vs Rebase](https://www.atlassian.com/git/tutorials/merging-vs-rebasing). Remember to test again after rebase.
58+
- If you are an external contributor, create a fork of the repository.
59+
- Rebase (not merge) your code to the most recent commit of the `main` branch. We want to ensure a linear history;
60+
see [Merge vs Rebase](https://www.atlassian.com/git/tutorials/merging-vs-rebasing). Remember to test again locally after rebasing to catch any new issues before pushing to your PR.
4061

4162
```bash
4263
git pull
@@ -45,21 +66,23 @@ git push origin <branch> --force-with-lease
4566
```
4667

4768
- When pushing the rebased (or any) branch, use `git push --force-with-lease` instead of `git push --force`.
48-
- Submit a pull request and assign at least two reviewers.
49-
- Since there is no CI/CD process in place yet, the PR will be accepted and the corresponding issue closed only after
50-
adequate testing has been completed, manually, by the developer and/or TensorRT engineer reviewing the code.
69+
- Submit a pull request and let auto-assigned reviewers (based on [CODEOWNERS](./.github/CODEOWNERS)) review your PR.
70+
- If any CI/CD checks fail, fix the issues and push again.
71+
- Once your PR is approved and all checks pass, one of the reviewers will merge the PR.
5172

52-
## Signing your work
73+
## ✍️ Signing your work
5374

5475
- We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original
5576
work, or you have rights to submit it under the same license, or a compatible license.
5677

57-
- Any contribution which contains commits that are not Signed-Off will not be accepted.
78+
- You need to sign-off your commits using an GPG / SSH key which is different than the one used for authentication. See [GitHub docs](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits) for more details.
79+
80+
- Any contribution which contains commits that are not Signed-Off will not be accepted.
5881

59-
- To sign off on a commit you simply use the `--signoff` (or `-s`) option when committing your changes:
82+
- To sign off on a commit you simply use the `--signoff --gpg-sign` (or `-s -S`) option when committing your changes:
6083

6184
```bash
62-
git commit -s -m "Add cool feature."
85+
git commit -s -S -m "Add cool feature."
6386
```
6487

6588
This will append the following to your commit message:
@@ -68,6 +91,8 @@ git push origin <branch> --force-with-lease
6891
Signed-off-by: Your Name <[email protected]>
6992
```
7093

94+
To enable this for committing in VSCode, you can enable `git.alwaysSignOff` and `git.enableCommitSigning` in your VSCode settings.
95+
7196
- Full text of the Developer Certificate of Origin (DCO):
7297

7398
```

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ docker run --gpus all -it --shm-size 20g --rm docker.io/library/modelopt_example
9696
python -c "import modelopt; print(modelopt.__version__)"
9797
```
9898

99-
Alternatively, you can install it from [NVIDIA PyPI](https://pypi.org/project/nvidia-modelopt/) without TRT-LLM etc.
99+
Alternatively, you can install it from [PyPI](https://pypi.org/project/nvidia-modelopt/) without TRT-LLM etc.
100100

101101
```bash
102102
pip install -U "nvidia-modelopt[all]"
@@ -105,7 +105,7 @@ pip install -U "nvidia-modelopt[all]"
105105
To install from source for local development, you can install it as follows:
106106

107107
```bash
108-
pip install -e ".[all]"
108+
pip install -e ".[dev]"
109109
```
110110

111111
When installing from source, please make sure to re-run the install command everytime you pull new changes in the repository so dependencies are also updated.

0 commit comments

Comments
 (0)