rm $ symbol from code block from contributing.md (#22057)
rm $ symbol from code block Removed the $ symbol from the code block to make copy-pasting easier.
This commit is contained in:
committed by
GitHub
parent
fdf8409656
commit
d0c19b3303
@@ -139,15 +139,15 @@ You'll need **[Python 3.7]((https://github.com/huggingface/transformers/blob/mai
|
|||||||
2. Clone your fork to your local disk, and add the base repository as a remote:
|
2. Clone your fork to your local disk, and add the base repository as a remote:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ git clone git@github.com:<your Github handle>/transformers.git
|
git clone git@github.com:<your Github handle>/transformers.git
|
||||||
$ cd transformers
|
cd transformers
|
||||||
$ git remote add upstream https://github.com/huggingface/transformers.git
|
git remote add upstream https://github.com/huggingface/transformers.git
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Create a new branch to hold your development changes:
|
3. Create a new branch to hold your development changes:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ git checkout -b a-descriptive-name-for-my-changes
|
git checkout -b a-descriptive-name-for-my-changes
|
||||||
```
|
```
|
||||||
|
|
||||||
🚨 **Do not** work on the `main` branch!
|
🚨 **Do not** work on the `main` branch!
|
||||||
@@ -155,7 +155,7 @@ You'll need **[Python 3.7]((https://github.com/huggingface/transformers/blob/mai
|
|||||||
4. Set up a development environment by running the following command in a virtual environment:
|
4. Set up a development environment by running the following command in a virtual environment:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ pip install -e ".[dev]"
|
pip install -e ".[dev]"
|
||||||
```
|
```
|
||||||
|
|
||||||
If 🤗 Transformers was already installed in the virtual environment, remove
|
If 🤗 Transformers was already installed in the virtual environment, remove
|
||||||
@@ -176,7 +176,7 @@ You'll need **[Python 3.7]((https://github.com/huggingface/transformers/blob/mai
|
|||||||
passes. Run the tests impacted by your changes like this:
|
passes. Run the tests impacted by your changes like this:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ pytest tests/<TEST_TO_RUN>.py
|
pytest tests/<TEST_TO_RUN>.py
|
||||||
```
|
```
|
||||||
|
|
||||||
For more information about tests, check out the
|
For more information about tests, check out the
|
||||||
@@ -187,7 +187,7 @@ You'll need **[Python 3.7]((https://github.com/huggingface/transformers/blob/mai
|
|||||||
that can't be automated in one go with:
|
that can't be automated in one go with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ make fixup
|
make fixup
|
||||||
```
|
```
|
||||||
|
|
||||||
This target is also optimized to only work with files modified by the PR you're working on.
|
This target is also optimized to only work with files modified by the PR you're working on.
|
||||||
@@ -196,21 +196,21 @@ You'll need **[Python 3.7]((https://github.com/huggingface/transformers/blob/mai
|
|||||||
style corrections:
|
style corrections:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ make style
|
make style
|
||||||
```
|
```
|
||||||
|
|
||||||
🤗 Transformers also uses `ruff` and a few custom scripts to check for coding mistakes. Quality
|
🤗 Transformers also uses `ruff` and a few custom scripts to check for coding mistakes. Quality
|
||||||
controls are run by the CI, but you can run the same checks with:
|
controls are run by the CI, but you can run the same checks with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ make quality
|
make quality
|
||||||
```
|
```
|
||||||
|
|
||||||
Finally, we have a lot of scripts to make sure we didn't forget to update
|
Finally, we have a lot of scripts to make sure we didn't forget to update
|
||||||
some files when adding a new model. You can run these scripts with:
|
some files when adding a new model. You can run these scripts with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ make repo-consistency
|
make repo-consistency
|
||||||
```
|
```
|
||||||
|
|
||||||
To learn more about those checks and how to fix any issues with them, check out the
|
To learn more about those checks and how to fix any issues with them, check out the
|
||||||
@@ -220,13 +220,13 @@ You'll need **[Python 3.7]((https://github.com/huggingface/transformers/blob/mai
|
|||||||
make sure you install the documentation builder:
|
make sure you install the documentation builder:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ pip install ".[docs]"
|
pip install ".[docs]"
|
||||||
```
|
```
|
||||||
|
|
||||||
Run the following command from the root of the repository:
|
Run the following command from the root of the repository:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ doc-builder build transformers docs/source/en --build_dir ~/tmp/test-build
|
doc-builder build transformers docs/source/en --build_dir ~/tmp/test-build
|
||||||
```
|
```
|
||||||
|
|
||||||
This will build the documentation in the `~/tmp/test-build` folder where you can inspect the generated
|
This will build the documentation in the `~/tmp/test-build` folder where you can inspect the generated
|
||||||
@@ -236,8 +236,8 @@ You'll need **[Python 3.7]((https://github.com/huggingface/transformers/blob/mai
|
|||||||
record your changes locally with `git commit`:
|
record your changes locally with `git commit`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ git add modified_file.py
|
git add modified_file.py
|
||||||
$ git commit
|
git commit
|
||||||
```
|
```
|
||||||
|
|
||||||
Please remember to write [good commit
|
Please remember to write [good commit
|
||||||
@@ -247,14 +247,14 @@ You'll need **[Python 3.7]((https://github.com/huggingface/transformers/blob/mai
|
|||||||
repository, rebase your branch on `upstream/branch` *before* you open a pull request or if requested by a maintainer:
|
repository, rebase your branch on `upstream/branch` *before* you open a pull request or if requested by a maintainer:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ git fetch upstream
|
git fetch upstream
|
||||||
$ git rebase upstream/main
|
git rebase upstream/main
|
||||||
```
|
```
|
||||||
|
|
||||||
Push your changes to your branch:
|
Push your changes to your branch:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ git push -u origin a-descriptive-name-for-my-changes
|
git push -u origin a-descriptive-name-for-my-changes
|
||||||
```
|
```
|
||||||
|
|
||||||
If you've already opened a pull request, you'll need to force push with the `--force` flag. Otherwise, if the pull request hasn't been opened yet, you can just push your changes normally.
|
If you've already opened a pull request, you'll need to force push with the `--force` flag. Otherwise, if the pull request hasn't been opened yet, you can just push your changes normally.
|
||||||
@@ -307,14 +307,14 @@ We like `pytest` and `pytest-xdist` because it's faster. From the root of the
|
|||||||
repository, specify a *path to a subfolder or a test file* to run the test.
|
repository, specify a *path to a subfolder or a test file* to run the test.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ python -m pytest -n auto --dist=loadfile -s -v ./tests/models/my_new_model
|
python -m pytest -n auto --dist=loadfile -s -v ./tests/models/my_new_model
|
||||||
```
|
```
|
||||||
|
|
||||||
Similarly, for the `examples` directory, specify a *path to a subfolder or test file* to run the test. For example, the following command tests the text classification subfolder in the PyTorch `examples` directory:
|
Similarly, for the `examples` directory, specify a *path to a subfolder or test file* to run the test. For example, the following command tests the text classification subfolder in the PyTorch `examples` directory:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ pip install -r examples/xxx/requirements.txt # only needed the first time
|
pip install -r examples/xxx/requirements.txt # only needed the first time
|
||||||
$ python -m pytest -n auto --dist=loadfile -s -v ./examples/pytorch/text-classification
|
python -m pytest -n auto --dist=loadfile -s -v ./examples/pytorch/text-classification
|
||||||
```
|
```
|
||||||
|
|
||||||
In fact, this is actually how our `make test` and `make test-examples` commands are implemented (not including the `pip install`)!
|
In fact, this is actually how our `make test` and `make test-examples` commands are implemented (not including the `pip install`)!
|
||||||
@@ -333,8 +333,8 @@ Remember to specify a *path to a subfolder or a test file* to run the test. Othe
|
|||||||
</Tip>
|
</Tip>
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ RUN_SLOW=yes python -m pytest -n auto --dist=loadfile -s -v ./tests/models/my_new_model
|
RUN_SLOW=yes python -m pytest -n auto --dist=loadfile -s -v ./tests/models/my_new_model
|
||||||
$ RUN_SLOW=yes python -m pytest -n auto --dist=loadfile -s -v ./examples/pytorch/text-classification
|
RUN_SLOW=yes python -m pytest -n auto --dist=loadfile -s -v ./examples/pytorch/text-classification
|
||||||
```
|
```
|
||||||
|
|
||||||
Like the slow tests, there are other environment variables available which not enabled by default during testing:
|
Like the slow tests, there are other environment variables available which not enabled by default during testing:
|
||||||
@@ -351,8 +351,8 @@ This means `unittest` is fully supported. Here's how to run tests with
|
|||||||
`unittest`:
|
`unittest`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ python -m unittest discover -s tests -t . -v
|
python -m unittest discover -s tests -t . -v
|
||||||
$ python -m unittest discover -s examples -t examples -v
|
python -m unittest discover -s examples -t examples -v
|
||||||
```
|
```
|
||||||
|
|
||||||
### Style guide
|
### Style guide
|
||||||
@@ -386,8 +386,8 @@ When updating the main branch of a forked repository, please follow these steps
|
|||||||
2. If a PR is absolutely necessary, use the following steps after checking out your branch:
|
2. If a PR is absolutely necessary, use the following steps after checking out your branch:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ git checkout -b your-branch-for-syncing
|
git checkout -b your-branch-for-syncing
|
||||||
$ git pull --squash --no-commit upstream main
|
git pull --squash --no-commit upstream main
|
||||||
$ git commit -m '<your message without GitHub references>'
|
git commit -m '<your message without GitHub references>'
|
||||||
$ git push --set-upstream origin your-branch-for-syncing
|
git push --set-upstream origin your-branch-for-syncing
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user