Skip to content

Commit

Permalink
Add pre-commit for auto files generation
Browse files Browse the repository at this point in the history
  • Loading branch information
satyaog committed Apr 25, 2023
1 parent b695374 commit df492b3
Show file tree
Hide file tree
Showing 10 changed files with 63 additions and 14 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint_docs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v1

- name: Install dependencies
run: python3 -m pip install -r docs/requirements.txt

- name: Run files generation tests
run: pre-commit run --all-files && [[ -z "$(git status -s)" ]]
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
repos:
- repo: local
hooks:
- id: preprocess-py
name: preprocess-py
entry: python3 docs/examples/preprocess.py
language: python
pass_filenames: false
7 changes: 5 additions & 2 deletions docs/examples/data/hf/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ Hugging Face Dataset

**Prerequisites**

Make sure to read the following sections of the documentation before using this example:
Make sure to read the following sections of the documentation before using this
example:

* :ref:`pytorch_setup`
* :ref:`001 - Single GPU Job`

The full source code for this example is available on `the mila-docs GitHub repository. <https://github.com/mila-iqia/mila-docs/tree/master/docs/examples/data/hf>`_
The full source code for this example is available on `the mila-docs GitHub
repository.
<https://github.com/mila-iqia/mila-docs/tree/master/docs/examples/data/hf>`_


**job.sh**
Expand Down
7 changes: 5 additions & 2 deletions docs/examples/data/hf/_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ Hugging Face Dataset

**Prerequisites**

Make sure to read the following sections of the documentation before using this example:
Make sure to read the following sections of the documentation before using this
example:

* :ref:`pytorch_setup`
* :ref:`001 - Single GPU Job`

The full source code for this example is available on `the mila-docs GitHub repository. <https://github.com/mila-iqia/mila-docs/tree/master/docs/examples/data/hf>`_
The full source code for this example is available on `the mila-docs GitHub
repository.
<https://github.com/mila-iqia/mila-docs/tree/master/docs/examples/data/hf>`_


**job.sh**
Expand Down
9 changes: 6 additions & 3 deletions docs/examples/data/torchvision/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ Torchvision

**Prerequisites**

Make sure to read the following sections of the documentation before using this example:
Make sure to read the following sections of the documentation before using this
example:

* :ref:`pytorch_setup`
* :ref:`001 - Single GPU Job`

The full source code for this example is available on `the mila-docs GitHub repository. <https://github.com/mila-iqia/mila-docs/tree/master/docs/examples/data/torchvision>`_
The full source code for this example is available on `the mila-docs GitHub
repository.
<https://github.com/mila-iqia/mila-docs/tree/master/docs/examples/data/torchvision>`_


**job.sh**
Expand Down Expand Up @@ -242,7 +245,7 @@ The full source code for this example is available on `the mila-docs GitHub repo
val_split_seed: int = 42,
):
- """Returns the training, validation, and test splits for CIFAR10.
+ """Returns the training, validation, and test splits for ImageNet.
+ """Returns the training, validation, and test splits for iNat.
NOTE: We don't use image transforms here for simplicity.
Having different transformations for train and validation would complicate things a bit.
Expand Down
7 changes: 5 additions & 2 deletions docs/examples/data/torchvision/_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ Torchvision

**Prerequisites**

Make sure to read the following sections of the documentation before using this example:
Make sure to read the following sections of the documentation before using this
example:

* :ref:`pytorch_setup`
* :ref:`001 - Single GPU Job`

The full source code for this example is available on `the mila-docs GitHub repository. <https://github.com/mila-iqia/mila-docs/tree/master/docs/examples/data/torchvision>`_
The full source code for this example is available on `the mila-docs GitHub
repository.
<https://github.com/mila-iqia/mila-docs/tree/master/docs/examples/data/torchvision>`_


**job.sh**
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/data/torchvision/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def make_datasets(
val_split: float = 0.1,
val_split_seed: int = 42,
):
"""Returns the training, validation, and test splits for ImageNet.
"""Returns the training, validation, and test splits for iNat.
NOTE: We don't use image transforms here for simplicity.
Having different transformations for train and validation would complicate things a bit.
Expand Down
7 changes: 5 additions & 2 deletions docs/examples/distributed/001_single_gpu/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@


**Prerequisites**
Make sure to read the following sections of the documentation before using this example:
Make sure to read the following sections of the documentation before using this
example:

* :ref:`pytorch_setup`

The full source code for this example is available on `the mila-docs GitHub repository. <https://github.com/mila-iqia/mila-docs/tree/master/docs/examples/distributed/001_single_gpu>`_
The full source code for this example is available on `the mila-docs GitHub
repository.
<https://github.com/mila-iqia/mila-docs/tree/pytorch_distributed_training_examples/docs/examples/distributed/001_single_gpu>`_

**job.sh**

Expand Down
7 changes: 5 additions & 2 deletions docs/examples/distributed/001_single_gpu/_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@


**Prerequisites**
Make sure to read the following sections of the documentation before using this example:
Make sure to read the following sections of the documentation before using this
example:

* :ref:`pytorch_setup`

The full source code for this example is available on `the mila-docs GitHub repository. <https://github.com/mila-iqia/mila-docs/tree/pytorch_distributed_training_examples/docs/examples/distributed/001_single_gpu>`_
The full source code for this example is available on `the mila-docs GitHub
repository.
<https://github.com/mila-iqia/mila-docs/tree/pytorch_distributed_training_examples/docs/examples/distributed/001_single_gpu>`_

**job.sh**

Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Python Packages
pre-commit
sphinx>=4.0.2

# Sphinx Extensions
Expand Down

0 comments on commit df492b3

Please sign in to comment.