Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,7 @@ repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.13
hooks:
# Run the linter
- id: ruff-check
types_or: [python, pyi]
# TODO: Enable when black and ruff format converge
# Run the formatter
# - id: ruff-format
# types_or: [python, pyi]

- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
- id: ruff-format
types_or: [python, pyi, jupyter]
6 changes: 3 additions & 3 deletions docker/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ def check_package(package_name, expected_version=None):
old_version = version
version = version.split("+")[0]
print(f"Transformed version: {old_version} -> {version}")
assert (
version == expected_version
), f"Version mismatch for package {package_name}: got {version} but expected {expected_version}"
assert version == expected_version, (
f"Version mismatch for package {package_name}: got {version} but expected {expected_version}"
)


if __name__ == "__main__":
Expand Down
5 changes: 3 additions & 2 deletions examples/cifar10_qat/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,9 @@ def __init__(
replace_stride_with_dilation = [False, False, False]
if len(replace_stride_with_dilation) != 3:
raise ValueError(
"replace_stride_with_dilation should be None "
"or a 3-element tuple, got {}".format(replace_stride_with_dilation)
"replace_stride_with_dilation should be None or a 3-element tuple, got {}".format(
replace_stride_with_dilation
)
)
self.groups = groups
self.base_width = width_per_group
Expand Down
16 changes: 8 additions & 8 deletions examples/mnist/mnist_with_clearml_logger.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""
MNIST example with training and validation monitoring using ClearML.
MNIST example with training and validation monitoring using ClearML.

Requirements:
ClearML: `pip install clearml`
Requirements:
ClearML: `pip install clearml`

Usage:
Usage:

Run the example:
```bash
python mnist_with_clearml_logger.py
```
Run the example:
```bash
python mnist_with_clearml_logger.py
```
"""

from argparse import ArgumentParser
Expand Down
16 changes: 8 additions & 8 deletions examples/mnist/mnist_with_neptune_logger.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""
MNIST example with training and validation monitoring using Neptune.
MNIST example with training and validation monitoring using Neptune.

Requirements:
Neptune: `pip install neptune`
Requirements:
Neptune: `pip install neptune`

Usage:
Usage:

Run the example:
```bash
python mnist_with_neptune_logger.py
```
Run the example:
```bash
python mnist_with_neptune_logger.py
```

"""

Expand Down
28 changes: 14 additions & 14 deletions examples/mnist/mnist_with_tensorboard.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
"""
MNIST example with training and validation monitoring using Tensorboard.
Requirements:
TensorboardX (https://github.com/lanpa/tensorboard-pytorch): `pip install tensorboardX`
or PyTorch >= 1.2 which supports Tensorboard
Tensorboard: `pip install tensorflow` (or just install tensorboard without the rest of tensorflow)
Usage:
Start tensorboard:
```bash
tensorboard --logdir=/tmp/tensorboard_logs/
```
Run the example:
```bash
python mnist_with_tensorboard.py --log_dir=/tmp/tensorboard_logs
```
MNIST example with training and validation monitoring using Tensorboard.
Requirements:
TensorboardX (https://github.com/lanpa/tensorboard-pytorch): `pip install tensorboardX`
or PyTorch >= 1.2 which supports Tensorboard
Tensorboard: `pip install tensorflow` (or just install tensorboard without the rest of tensorflow)
Usage:
Start tensorboard:
```bash
tensorboard --logdir=/tmp/tensorboard_logs/
```
Run the example:
```bash
python mnist_with_tensorboard.py --log_dir=/tmp/tensorboard_logs
```
"""

from argparse import ArgumentParser
Expand Down
26 changes: 13 additions & 13 deletions examples/mnist/mnist_with_tensorboard_logger.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
"""
MNIST example with training and validation monitoring using TensorboardX and Tensorboard.
MNIST example with training and validation monitoring using TensorboardX and Tensorboard.

Requirements:
Optionally TensorboardX (https://github.com/lanpa/tensorboard-pytorch): `pip install tensorboardX`
Tensorboard: `pip install tensorflow` (or just install tensorboard without the rest of tensorflow)
Requirements:
Optionally TensorboardX (https://github.com/lanpa/tensorboard-pytorch): `pip install tensorboardX`
Tensorboard: `pip install tensorflow` (or just install tensorboard without the rest of tensorflow)

Usage:
Usage:

Start tensorboard:
```bash
tensorboard --logdir=/tmp/tensorboard_logs/
```
Start tensorboard:
```bash
tensorboard --logdir=/tmp/tensorboard_logs/
```

Run the example:
```bash
python mnist_with_tensorboard_logger.py --log_dir=/tmp/tensorboard_logs
```
Run the example:
```bash
python mnist_with_tensorboard_logger.py --log_dir=/tmp/tensorboard_logs
```
"""

import sys
Expand Down
28 changes: 14 additions & 14 deletions examples/mnist/mnist_with_tensorboard_on_tpu.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
"""
MNIST example with training and validation monitoring using Tensorboard on TPU
Requirements:
- PyTorch >= 1.5
- PyTorch XLA >= 1.5
- Tensorboard: `pip install tensorflow` (or just install tensorboard without the rest of tensorflow)
Usage:
Start tensorboard:
```bash
tensorboard --logdir=/tmp/tensorboard_logs/
```
Run the example:
```bash
python mnist_with_tensorboard_on_tpu.py --log_dir=/tmp/tensorboard_logs
```
MNIST example with training and validation monitoring using Tensorboard on TPU
Requirements:
- PyTorch >= 1.5
- PyTorch XLA >= 1.5
- Tensorboard: `pip install tensorflow` (or just install tensorboard without the rest of tensorflow)
Usage:
Start tensorboard:
```bash
tensorboard --logdir=/tmp/tensorboard_logs/
```
Run the example:
```bash
python mnist_with_tensorboard_on_tpu.py --log_dir=/tmp/tensorboard_logs
```
"""

from argparse import ArgumentParser
Expand Down
26 changes: 13 additions & 13 deletions examples/mnist/mnist_with_visdom_logger.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
"""
MNIST example with training and validation monitoring using Visdom.
MNIST example with training and validation monitoring using Visdom.

Requirements:
Visdom (https://github.com/facebookresearch/visdom.git):
`pip install git+https://github.com/facebookresearch/visdom.git`
Requirements:
Visdom (https://github.com/facebookresearch/visdom.git):
`pip install git+https://github.com/facebookresearch/visdom.git`

Usage:
Usage:

Start visdom server:
```bash
visdom -logging_level 30
```
Start visdom server:
```bash
visdom -logging_level 30
```

Run the example:
```bash
python mnist_with_visdom_logger.py
```
Run the example:
```bash
python mnist_with_visdom_logger.py
```
"""

from argparse import ArgumentParser
Expand Down
20 changes: 10 additions & 10 deletions examples/mnist/mnist_with_wandb_logger.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
"""
MNIST example with training and validation monitoring using Weights & Biases
MNIST example with training and validation monitoring using Weights & Biases

Requirements:
Weights & Biases: `pip install wandb`
Requirements:
Weights & Biases: `pip install wandb`

Usage:
Usage:

Make sure you are logged into Weights & Biases (use the `wandb` command).
Make sure you are logged into Weights & Biases (use the `wandb` command).

Run the example:
```bash
python mnist_with_wandb_logger.py
```
Run the example:
```bash
python mnist_with_wandb_logger.py
```

Go to https://wandb.com and explore your experiment.
Go to https://wandb.com and explore your experiment.
"""

from argparse import ArgumentParser
Expand Down
6 changes: 4 additions & 2 deletions examples/notebooks/Cifar100_bench_amp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"import torch\n",
"import torchvision\n",
"import ignite\n",
"\n",
"torch.__version__, torchvision.__version__, ignite.__version__"
]
},
Expand All @@ -87,8 +88,8 @@
"outputs": [],
"source": [
"!git clone https://github.com/pytorch/ignite.git /tmp/ignite\n",
"scriptspath=\"/tmp/ignite/examples/cifar100_amp_benchmark/\"\n",
"setup=f\"cd {scriptspath} && export PYTHONPATH=$PWD:$PYTHONPATH\""
"scriptspath = \"/tmp/ignite/examples/cifar100_amp_benchmark/\"\n",
"setup = f\"cd {scriptspath} && export PYTHONPATH=$PWD:$PYTHONPATH\""
]
},
{
Expand All @@ -105,6 +106,7 @@
"outputs": [],
"source": [
"from torchvision.datasets.cifar import CIFAR100\n",
"\n",
"CIFAR100(root=\"/tmp/cifar100/\", train=True, download=True)"
]
},
Expand Down
Loading
Loading