mirror of
https://github.com/NVIDIA/Model-Optimizer.git
synced 2026-10-02 03:14:52 +08:00
Add CODE_OF_CONDUCT.md and update CONTRIBUTING.md
Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,133 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||
identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
- Demonstrating empathy and kindness toward other people
|
||||
- Being respectful of differing opinions, viewpoints, and experiences
|
||||
- Giving and gracefully accepting constructive feedback
|
||||
- Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
- Focusing on what is best not just for us as individuals, but for the overall
|
||||
community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
- The use of sexualized language or imagery, and sexual attention or advances of
|
||||
any kind
|
||||
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information, such as a physical or email address,
|
||||
without their explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported through GitHub's report functionality.
|
||||
|
||||
All complaints will be reviewed and investigated promptly and fairly by the
|
||||
administrators of this repository.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series of
|
||||
actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or permanent
|
||||
ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||
community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.1, available at
|
||||
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder][mozilla coc].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][faq]. Translations are available at
|
||||
[https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[faq]: https://www.contributor-covenant.org/faq
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[mozilla coc]: https://github.com/mozilla/diversity
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||
+49
-24
@@ -1,42 +1,63 @@
|
||||
# TensorRT Model Optimizer OSS Contribution Rules
|
||||
# Contributing to TensorRT Model Optimizer
|
||||
|
||||
This readme provides guidelines for writing and contributing code to the this repository. Make sure
|
||||
that all `dev` optional requirements are installed with ModelOpt.
|
||||
Thanks for your interest in contributing to TensorRT Model Optimizer (ModelOpt)!
|
||||
|
||||
## Code linting
|
||||
## 🛠️ Setting up your environment
|
||||
|
||||
- All code (Python and C++) is auto-checked to adhere to the coding standards upon commit (see below for more info).
|
||||
- Check out [`.pre-commit-config.yaml`](.pre-commit-config.yaml) for detailed information about each tool.
|
||||
- If you would like to integrate the linting tools into your IDE, check out the
|
||||
documentation for the respective IDE, e.g., docs for [auto-formatting](https://code.visualstudio.com/docs/python/editing#_formatting) and
|
||||
[linting](https://code.visualstudio.com/docs/python/linting) in VSCode.
|
||||
- For VSCode, we also provide default workspace settings, see [here](./.vscode/settings.json) for detailed instructions.
|
||||
Ensure that TensorRT Model Optimizer (ModelOpt) is installed in editable mode and that all `dev` optional requirements are installed:
|
||||
|
||||
## Pre-commit hooks
|
||||
```bash
|
||||
pip install -e ".[dev]"
|
||||
```
|
||||
|
||||
Please enable pre-commit hooks as follows to automatically check / fix code quality before issues committing:
|
||||
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.
|
||||
See [docker README](./README.md#installation--docker) for more details.
|
||||
|
||||
## 🧹 Code linting and formatting
|
||||
|
||||
- All code (Python, C++, Markdown, etc.) is automatically checked to adhere to the coding standards upon commit (see below for more information).
|
||||
- See [`.pre-commit-config.yaml`](.pre-commit-config.yaml) for details about each tool.
|
||||
- For VSCode or Cursor, we provide default workspace settings to integrate the linting tools into your IDE: see [workspace settings](./.vscode/settings.json).
|
||||
|
||||
### Pre-commit hooks
|
||||
|
||||
Enable pre-commit hooks to automatically check and fix code quality before committing:
|
||||
|
||||
```bash
|
||||
pre-commit install
|
||||
```
|
||||
|
||||
If you simply want to add some temporary commit that skips the checks, you can use the `-n` flag during commit:
|
||||
If you want to make a temporary commit that skips checks, use the `-n` flag when committing:
|
||||
|
||||
```bash
|
||||
git commit -m "temporary commit" -n
|
||||
```
|
||||
|
||||
If you want to run the pre-commit hooks without committing, you can use the following command:
|
||||
To run the pre-commit hooks without committing, use:
|
||||
|
||||
```bash
|
||||
pre-commit run --all-files
|
||||
```
|
||||
|
||||
## 📝 Writing tests
|
||||
|
||||
We use [pytest](https://docs.pytest.org/) for all tests. The tests are organized into the following directories:
|
||||
|
||||
- `tests/unit`: Fast cpu-based unit tests for the core ModelOpt library. They should not take more than a few seconds to run.
|
||||
- `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.
|
||||
- `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.
|
||||
|
||||
Please refer to [tox.ini](./tox.ini) for more details on how to run the tests and their dependencies.
|
||||
|
||||
### Code Coverage
|
||||
|
||||
For any new features / examples, make sure to they are covered by the tests and that the Codecov coverage check in your PR passes.
|
||||
|
||||
## Submitting your code
|
||||
|
||||
- Create a fork of the repository.
|
||||
- Rebase (not merge) your code to the most recent commit of the main branch. We want to ensure linear history,
|
||||
check [Merge vs Rebase](https://www.atlassian.com/git/tutorials/merging-vs-rebasing). Remember to test again after rebase.
|
||||
- If you are an external contributor, create a fork of the repository.
|
||||
- Rebase (not merge) your code to the most recent commit of the `main` branch. We want to ensure a linear history;
|
||||
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.
|
||||
|
||||
```bash
|
||||
git pull
|
||||
@@ -45,21 +66,23 @@ git push origin <branch> --force-with-lease
|
||||
```
|
||||
|
||||
- When pushing the rebased (or any) branch, use `git push --force-with-lease` instead of `git push --force`.
|
||||
- Submit a pull request and assign at least two reviewers.
|
||||
- Since there is no CI/CD process in place yet, the PR will be accepted and the corresponding issue closed only after
|
||||
adequate testing has been completed, manually, by the developer and/or TensorRT engineer reviewing the code.
|
||||
- Submit a pull request and let auto-assigned reviewers (based on [CODEOWNERS](./.github/CODEOWNERS)) review your PR.
|
||||
- If any CI/CD checks fail, fix the issues and push again.
|
||||
- Once your PR is approved and all checks pass, one of the reviewers will merge the PR.
|
||||
|
||||
## Signing your work
|
||||
## ✍️ Signing your work
|
||||
|
||||
- We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original
|
||||
work, or you have rights to submit it under the same license, or a compatible license.
|
||||
|
||||
- Any contribution which contains commits that are not Signed-Off will not be accepted.
|
||||
- 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.
|
||||
|
||||
- To sign off on a commit you simply use the `--signoff` (or `-s`) option when committing your changes:
|
||||
- Any contribution which contains commits that are not Signed-Off will not be accepted.
|
||||
|
||||
- To sign off on a commit you simply use the `--signoff --gpg-sign` (or `-s -S`) option when committing your changes:
|
||||
|
||||
```bash
|
||||
git commit -s -m "Add cool feature."
|
||||
git commit -s -S -m "Add cool feature."
|
||||
```
|
||||
|
||||
This will append the following to your commit message:
|
||||
@@ -68,6 +91,8 @@ git push origin <branch> --force-with-lease
|
||||
Signed-off-by: Your Name <your@email.com>
|
||||
```
|
||||
|
||||
To enable this for committing in VSCode, you can enable `git.alwaysSignOff` and `git.enableCommitSigning` in your VSCode settings.
|
||||
|
||||
- Full text of the Developer Certificate of Origin (DCO):
|
||||
|
||||
```
|
||||
|
||||
@@ -96,7 +96,7 @@ docker run --gpus all -it --shm-size 20g --rm docker.io/library/modelopt_example
|
||||
python -c "import modelopt; print(modelopt.__version__)"
|
||||
```
|
||||
|
||||
Alternatively, you can install it from [NVIDIA PyPI](https://pypi.org/project/nvidia-modelopt/) without TRT-LLM etc.
|
||||
Alternatively, you can install it from [PyPI](https://pypi.org/project/nvidia-modelopt/) without TRT-LLM etc.
|
||||
|
||||
```bash
|
||||
pip install -U "nvidia-modelopt[all]"
|
||||
@@ -105,7 +105,7 @@ pip install -U "nvidia-modelopt[all]"
|
||||
To install from source for local development, you can install it as follows:
|
||||
|
||||
```bash
|
||||
pip install -e ".[all]"
|
||||
pip install -e ".[dev]"
|
||||
```
|
||||
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user