internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: pytorch/ignite

Issue:
Automatic jupyter environment detection
## 🚀 Feature

Running code from jupyter (Colab or whatever), one have to add the argument `start_method="fork"` in order to launch a parallel run.

https://github.com/pytorch/ignite/blob/4a243a1b1045ddd1ca8c70afe153b1b208777213/ignite/distributed/launcher.py#L114

An idea would be to detect if a jupyter environment is used and automatically add the `start_method` value if necessary.

EDIT:
this is already done for XLA : 
https://github.com/pytorch/ignite/blob/4a243a1b1045ddd1ca8c70afe153b1b208777213/ignite/distributed/comp_models/xla.py#L121-L122

The idea is to override "start_method" here:
https://github.com/pytorch/ignite/blob/4a243a1b1045ddd1ca8c70afe153b1b208777213/ignite/distributed/comp_models/native.py#L375 
if we can detect Jupyter related environment variables.


Discussion:
Hey @sdesrozis . I would like to work on this issue.
@Chandan-h-509 Thank you for the help !

Resolving patch:
diff --git a/ignite/distributed/comp_models/native.py b/ignite/distributed/comp_models/native.py
--- a/ignite/distributed/comp_models/native.py
+++ b/ignite/distributed/comp_models/native.py
@@ -372,7 +372,14 @@ def spawn(  # type: ignore[override]
             start_processes = mp.spawn
             # start_method and start_processes in pytorch >= 1.5
             if LooseVersion(torch.__version__) >= LooseVersion("1.5.0"):
-                spawn_kwargs["start_method"] = kwargs.get("start_method", "spawn")
+                import builtins
+
+                if "__IPYTHON__" in builtins.__dict__:
+                    # use fork in jupyter
+                    default_start_method = "fork"
+                else:
+                    default_start_method = "spawn"
+                spawn_kwargs["start_method"] = kwargs.get("start_method", default_start_method)
                 start_processes = mp.start_processes
 
             if init_method in [None, "env://"]:
diff --git a/ignite/distributed/launcher.py b/ignite/distributed/launcher.py
--- a/ignite/distributed/launcher.py
+++ b/ignite/distributed/launcher.py
@@ -111,13 +111,6 @@ def training(local_rank, config, **kwargs):
             with idist.Parallel(backend=backend, init_method='tcp://10.1.1.20:23456', nproc_per_node=4) as parallel:
                 parallel.run(training, config, a=1, b=2)
 
-        Running the code from Jupyter
-
-        .. code-block:: python
-
-            with idist.Parallel(backend=backend, nproc_per_node=4, start_method="fork") as parallel:
-                parallel.run(training, config, a=1, b=2)
-
 
         3) Single node, Multi-TPU training launched with `python`
 


Test patch:
Repository: pytorch/ignite

Issue:
Improve doc examples rendering
Currently we are rendering our examples in the docs like this https://pytorch.org/ignite/generated/ignite.engine.engine.Engine.html#ignite.engine.engine.Engine which is not very neat.
What we want to do is to find a better way to make it more good looking, and update our docs examples

![image](https://user-images.githubusercontent.com/2459423/129027565-5363ac3b-03ec-4f72-a41e-c3d1441cc7f5.png)

- Replace "Examples" with some sphinx tag or something else, for example, like scikit-image does:

![image](https://user-images.githubusercontent.com/2459423/129027830-7c9a8295-78db-41f7-9f72-5dd71bce72d6.png)



Discussion:
Hi @KickItLikeShika, I'm interested in working on this issue! It would be my very first contribution.
Hi @Ketan-Kapse, thanks a lot for showing interest! You're welcome to send PRs to tackle this. The PR description gives some context about what should be done, also if needed help, you can ask in our Discord server https://discord.com/invite/djZtm3EmKj
Hi, I'm not clear about the suggested ways of improving the doc. Kindly guide me on this so that I can proceed ahead in improvising this.
Hi @FarehaNousheen, you can see here how we render examples https://github.com/pytorch/ignite/issues/2114, if you're familiar with Sphinx, we are using Sphinx to create our docs: https://www.sphinx-doc.org/en/master/. We would like to change the way we render our examples, we left a suggestions in the description of the issue, if you have another idea to render our docs we can discuss it here. 
For the idea in the description you can check how scikit-learn does that in their codebase, and replicate it here.

Resolving patch:
diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -57,6 +57,7 @@
     "sphinx.ext.napoleon",
     "sphinx.ext.viewcode",
     "sphinx.ext.autosectionlabel",
+    "sphinx_copybutton",
 ]
 
 # katex options
@@ -123,7 +124,7 @@
 html_static_path = ["_static", "_templates/_static"]
 
 html_context = {
-    "css_files": [
+    "extra_css_files": [
         # 'https://fonts.googleapis.com/css?family=Lato',
         # '_static/css/pytorch_theme.css'
         "_static/css/ignite_theme.css",


Test patch:
Repository: pytorch/ignite

Issue:
Fix NCCL warning caused by barrier if using `idist`
## 🚀 Feature

The following code will produce warnings with the latest PyTorch : 
```python
# python -u -m torch.distributed.run --nproc_per_node=2 main.py
import time
import ignite.distributed as idist

def training(local_rank, config, **kwargs):
    # ...
    time.sleep(0.1 * local_rank)
    print(idist.get_rank(), ": run with config:", config, "- backend=", idist.backend())
    # ...

    
if __name__ == "__main__":

    backend = "nccl"
    config = {}
    with idist.Parallel(backend=backend) as parallel:
        parallel.run(training, config, a=1, b=2)
```
Output:
```
[W ProcessGroupNCCL.cpp:1569] Rank 0 using best-guess GPU 0 to perform barrier as devices used by this process are currently unknown. This can potentially cause a hang if this rank to GPU mapping is incorrect.Specify device_ids in barrier() to force use of a particular device.
[W ProcessGroupNCCL.cpp:1569] Rank 1 using best-guess GPU 1 to perform barrier as devices used by this process are currently unknown. This can potentially cause a hang if this rank to GPU mapping is incorrect.Specify device_ids in barrier() to force use of a particular device.
2021-09-24 03:23:13,045 ignite.distributed.launcher.Parallel INFO: Initialized processing group with backend: 'nccl'
```

These NCCL warnings are caused by this code:
https://github.com/pytorch/ignite/blob/053411d73047e278f22008f9f0f1775d0e51dcd5/ignite/distributed/comp_models/native.py#L128-L129

Solutions:
- verify the API of `dist.barrier` and specify participating processes
- remove barrier and argue why



Discussion:

Resolving patch:
diff --git a/ignite/distributed/comp_models/native.py b/ignite/distributed/comp_models/native.py
--- a/ignite/distributed/comp_models/native.py
+++ b/ignite/distributed/comp_models/native.py
@@ -125,12 +125,20 @@ def _create_from_backend(
 
             dist.init_process_group(backend, init_method=init_method, **init_pg_kwargs)
 
-            # https://github.com/facebookresearch/maskrcnn-benchmark/issues/172
-            dist.barrier()
-
             if torch.cuda.is_available():
                 torch.cuda.set_device(self._local_rank)
 
+            # Call barrier after init_process_group as in
+            # https://github.com/facebookresearch/maskrcnn-benchmark/issues/172
+            # Define device ids for NCCL to avoid warnings
+            # [W ProcessGroupNCCL.cpp:1569] Rank 0 using best-guess GPU 0 to perform barrier as devices used by
+            # this process are currently unknown. This can potentially cause a hang if this rank to GPU mapping
+            # is incorrect.Specify device_ids in barrier() to force use of a particular device.
+            device_ids = None
+            if backend == dist.Backend.NCCL and LooseVersion(torch.__version__) >= LooseVersion("1.8.0"):
+                device_ids = [torch.cuda.current_device()]
+            dist.barrier(device_ids=device_ids)
+
             self._setup_attrs()
 
         def _init_from_context(self) -> None:


Test patch:
Repository: pytorch/ignite

Issue:
Fix NCCL warning caused by barrier if using `idist`
## 🚀 Feature

The following code will produce warnings with the latest PyTorch : 
```python
# python -u -m torch.distributed.run --nproc_per_node=2 main.py
import time
import ignite.distributed as idist

def training(local_rank, config, **kwargs):
    # ...
    time.sleep(0.1 * local_rank)
    print(idist.get_rank(), ": run with config:", config, "- backend=", idist.backend())
    # ...

    
if __name__ == "__main__":

    backend = "nccl"
    config = {}
    with idist.Parallel(backend=backend) as parallel:
        parallel.run(training, config, a=1, b=2)
```
Output:
```
[W ProcessGroupNCCL.cpp:1569] Rank 0 using best-guess GPU 0 to perform barrier as devices used by this process are currently unknown. This can potentially cause a hang if this rank to GPU mapping is incorrect.Specify device_ids in barrier() to force use of a particular device.
[W ProcessGroupNCCL.cpp:1569] Rank 1 using best-guess GPU 1 to perform barrier as devices used by this process are currently unknown. This can potentially cause a hang if this rank to GPU mapping is incorrect.Specify device_ids in barrier() to force use of a particular device.
2021-09-24 03:23:13,045 ignite.distributed.launcher.Parallel INFO: Initialized processing group with backend: 'nccl'
```

These NCCL warnings are caused by this code:
https://github.com/pytorch/ignite/blob/053411d73047e278f22008f9f0f1775d0e51dcd5/ignite/distributed/comp_models/native.py#L128-L129

Solutions:
- verify the API of `dist.barrier` and specify participating processes
- remove barrier and argue why



Discussion:

Resolving patch:
diff --git a/ignite/distributed/comp_models/native.py b/ignite/distributed/comp_models/native.py
--- a/ignite/distributed/comp_models/native.py
+++ b/ignite/distributed/comp_models/native.py
@@ -134,10 +134,12 @@ def _create_from_backend(
             # [W ProcessGroupNCCL.cpp:1569] Rank 0 using best-guess GPU 0 to perform barrier as devices used by
             # this process are currently unknown. This can potentially cause a hang if this rank to GPU mapping
             # is incorrect.Specify device_ids in barrier() to force use of a particular device.
-            device_ids = None
             if backend == dist.Backend.NCCL and LooseVersion(torch.__version__) >= LooseVersion("1.8.0"):
                 device_ids = [torch.cuda.current_device()]
-            dist.barrier(device_ids=device_ids)
+                dist.barrier(device_ids=device_ids)
+            else:
+                # For older versions there is no device_ids arg
+                dist.barrier()
 
             self._setup_attrs()
 


Test patch:
Repository: pytorch/ignite

Issue:
ClearrMLLogger freezes logging in distributed env
## 🐛 Bug description

Instantiating a `ClearMLLogger`instance in a distributed training freezes the logging of the subprocesses. The bug can be reproduced by executing the following script: https://github.com/H4dr1en/trains/commit/642c1130ad1f76db10ed9b8e1a4ff0fd7e45b3cc

I will open a PR to fix it.

## Environment

- PyTorch Version (e.g., 1.7.1):
- Ignite Version (e.g., 0.5.0):
- OS (e.g., Linux): linux
- How you installed Ignite (`conda`, `pip`, source): pip/source
- Python version: 3.8.5
- Any other relevant information:

ClearrMLLogger freezes logging in distributed env
## 🐛 Bug description

Instantiating a `ClearMLLogger`instance in a distributed training freezes the logging of the subprocesses. The bug can be reproduced by executing the following script: https://github.com/H4dr1en/trains/commit/642c1130ad1f76db10ed9b8e1a4ff0fd7e45b3cc

I will open a PR to fix it.

## Environment

- PyTorch Version (e.g., 1.7.1):
- Ignite Version (e.g., 0.5.0):
- OS (e.g., Linux): linux
- How you installed Ignite (`conda`, `pip`, source): pip/source
- Python version: 3.8.5
- Any other relevant information:



Discussion:

Resolving patch:
diff --git a/ignite/contrib/handlers/clearml_logger.py b/ignite/contrib/handlers/clearml_logger.py
--- a/ignite/contrib/handlers/clearml_logger.py
+++ b/ignite/contrib/handlers/clearml_logger.py
@@ -52,7 +52,8 @@ class ClearMLLogger(BaseLogger):
         kwargs: Keyword arguments accepted from
             `clearml.Task
             <https://clear.ml/docs/latest/docs/references/sdk/task#taskinit>`_.
-            All arguments are optional.
+            All arguments are optional. If a ClearML Task has already been created,
+            kwargs will be ignored and the current ClearML Task will be used.
 
     Examples:
         .. code-block:: python
@@ -147,12 +148,15 @@ def __setattr__(self, attr: str, val: Any) -> None:
 
             self._task = _Stub()
         else:
-            self._task = Task.init(
-                project_name=kwargs.get("project_name"),
-                task_name=kwargs.get("task_name"),
-                task_type=kwargs.get("task_type", Task.TaskTypes.training),
-                **experiment_kwargs,
-            )
+            # Try to retrieve current the ClearML Task before trying to create a new one
+            self._task = Task.current_task()
+            if self._task is None:
+                self._task = Task.init(
+                    project_name=kwargs.get("project_name"),
+                    task_name=kwargs.get("task_name"),
+                    task_type=kwargs.get("task_type", Task.TaskTypes.training),
+                    **experiment_kwargs,
+                )
 
         self.clearml_logger = self._task.get_logger()
 


Test patch:
Repository: pytorch/ignite

Issue:
Seemingly unnecessary dictionary comprehension in contrib's BaseOutputHandler
Hi,
`output_dict` is made sure to be a dictionary just above the line below. 

https://github.com/pytorch/ignite/blob/21a2ccc25dd7ff0aec5f1538387597cb093fe36e/ignite/contrib/handlers/base_logger.py#L108

So this line could be replaced with:

```python
metrics_state_attrs.update(output_dict) 
```
Seemingly unnecessary dictionary comprehension in contrib's BaseOutputHandler
Hi,
`output_dict` is made sure to be a dictionary just above the line below. 

https://github.com/pytorch/ignite/blob/21a2ccc25dd7ff0aec5f1538387597cb093fe36e/ignite/contrib/handlers/base_logger.py#L108

So this line could be replaced with:

```python
metrics_state_attrs.update(output_dict) 
```


Discussion:
Thanks for pointing out that, @sadra-barikbin !
Would you like to send a PR to fix that ?
Yes, sure!
Thanks for pointing out that, @sadra-barikbin !
Would you like to send a PR to fix that ?
Yes, sure!

Resolving patch:
diff --git a/ignite/contrib/handlers/base_logger.py b/ignite/contrib/handlers/base_logger.py
--- a/ignite/contrib/handlers/base_logger.py
+++ b/ignite/contrib/handlers/base_logger.py
@@ -105,7 +105,7 @@ def _setup_output_metrics_state_attrs(
             if not isinstance(output_dict, dict):
                 output_dict = {"output": output_dict}
 
-            metrics_state_attrs.update({name: value for name, value in output_dict.items()})
+            metrics_state_attrs.update(output_dict)
 
         if self.state_attributes is not None:
             metrics_state_attrs.update({name: getattr(engine.state, name, None) for name in self.state_attributes})


Test patch:
Repository: pytorch/ignite

Issue:
Fix docs building
## 📚 Documentation

Following https://github.com/pytorch/ignite/pull/2457 docs build is failing due to copying of orphaned defaults.rst file:

- https://github.com/pytorch/ignite/runs/5148163094?check_suite_focus=true
```
 Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/sphinx/config.py", line 328, in eval_config_file
    exec(code, namespace)
  File "/tmp/tmpy5n1diwnsphinxcontrib_versioning/f4ffa27253e329a9d29a679bcba4756f262bcc2d/docs/source/conf.py", line 74, in <module>
    shutil.copy(os.path.join(src_folder, "defaults.rst"), gen_folder)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/shutil.py", line 248, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpy5n1diwnsphinxcontrib_versioning/f4ffa27253e329a9d29a679bcba4756f262bcc2d/docs/source/defaults.rst'

Process Process-2:
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
    self.run()
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/multiprocessing/process.py", line 99, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/site-packages/sphinxcontrib/versioning/sphinx_.py", line 208, in _build
    raise SphinxError
sphinx.errors.SphinxError
=> sphinx-build failed for branch/tag: v0.4.8
Failure.
```

More details on how docs are built:

- https://github.com/pytorch/ignite/blob/master/.github/workflows/install_docs_deps.sh
- https://github.com/pytorch/ignite/blob/master/.github/workflows/build_docs.sh
- https://github.com/pytorch-ignite/sphinxcontrib-versioning

How everything is executed in the CI:
https://github.com/pytorch/ignite/blob/4c2b62bf17aabb998b189b2e39afd59928adf7c1/.github/workflows/docs.yml#L28-L32






Discussion:
Working on this

Resolving patch:
diff --git a/docs/source/conf.py b/docs/source/conf.py
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -68,10 +68,12 @@
 togglebutton_hint_hide = "Hide default setup"
 
 # Copy defaults.rst to source/generated to be discoverable in docstrings
-src_folder = os.path.dirname(__file__)
-gen_folder = os.path.join(src_folder, "generated")
-os.makedirs(gen_folder, exist_ok=True)
-shutil.copy(os.path.join(src_folder, "defaults.rst"), gen_folder)
+# Skip this step for previous versions of ignite
+if os.path.exists("defaults.rst"):
+    src_folder = os.path.dirname(__file__)
+    gen_folder = os.path.join(src_folder, "generated")
+    os.makedirs(gen_folder, exist_ok=True)
+    shutil.copy(os.path.join(src_folder, "defaults.rst"), gen_folder)
 
 # katex options
 katex_prerender = True


Test patch:
Repository: pytorch/ignite

Issue:
Bar format is `str` but should be  `Optional[str]` in ignite.contrib.handlers.tqdm_logger.ProgressBar
## 🐛 Bug description

`ignite.contrib.handlers.tqdm_logger.ProgressBar` can accept `None` in the `bar_format` initialization argument (as documented), but this is not reflected in the type annotation.

https://github.com/pytorch/ignite/blob/82a929d3e452ccaba8c7767148231e741b6335e5/ignite/contrib/handlers/tqdm_logger.py#L120


Discussion:
Thanks for catching that @yohan-pg , would you like to send a fix ?
So, it should be 
```
bar_format: Union[str, None] = "{desc}[{n_fmt}/{total_fmt}] {percentage:3.0f}%|{bar}{postfix} [{elapsed}<{remaining}]"
```
@vfdev-5 I would like to work on this fix
Thanks @Davidportlouis , assigned it to you

Resolving patch:
diff --git a/ignite/contrib/handlers/tqdm_logger.py b/ignite/contrib/handlers/tqdm_logger.py
--- a/ignite/contrib/handlers/tqdm_logger.py
+++ b/ignite/contrib/handlers/tqdm_logger.py
@@ -117,7 +117,9 @@ class ProgressBar(BaseLogger):
     def __init__(
         self,
         persist: bool = False,
-        bar_format: str = "{desc}[{n_fmt}/{total_fmt}] {percentage:3.0f}%|{bar}{postfix} [{elapsed}<{remaining}]",
+        bar_format: Union[
+            str, None
+        ] = "{desc}[{n_fmt}/{total_fmt}] {percentage:3.0f}%|{bar}{postfix} [{elapsed}<{remaining}]",
         **tqdm_kwargs: Any,
     ):
 


Test patch:
Repository: pytorch/ignite

Issue:
Code formatting issue with latest flake8

https://github.com/pytorch/ignite/runs/7781175697?check_suite_focus=true#step:11:84

```
Collecting flake8
  Downloading flake8-5.0.4-py2.py3-none-any.whl (61 kB)

+ flake8 ignite tests examples --config setup.cfg
ignite/metrics/psnr.py:12:121: E501 line too long (121 > 120 characters)
```


Discussion:
this https://github.com/psf/black/issues/1632 looks similar

But why does flake complain right now?
Looks like the very first line of the docstring has to respect the line length convention.

Resolving patch:
diff --git a/ignite/metrics/psnr.py b/ignite/metrics/psnr.py
--- a/ignite/metrics/psnr.py
+++ b/ignite/metrics/psnr.py
@@ -9,7 +9,8 @@
 
 
 class PSNR(Metric):
-    r"""Computes average `Peak signal-to-noise ratio (PSNR) <https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio>`_.
+    r"""Computes average
+    `Peak signal-to-noise ratio (PSNR) <https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio>`_.
 
     .. math::
         \text{PSNR}(I, J) = 10 * \log_{10}\left(\frac{ MAX_{I}^2 }{ \text{ MSE } }\right)
@@ -34,7 +35,8 @@ class PSNR(Metric):
         The output of the engine's ``process_function`` needs to be in format of
         ``(y_pred, y)`` or ``{'y_pred': y_pred, 'y': y, ...}``.
 
-        For more information on how metric works with :class:`~ignite.engine.engine.Engine`, visit :ref:`attach-engine`.
+        For more information on how metric works with :class:`~ignite.engine.engine.Engine`,
+        visit :ref:`attach-engine`.
 
         .. include:: defaults.rst
             :start-after: :orphan:


Test patch:
Repository: pytorch/ignite

Issue:
Typo in engine.__init__._prepare_batch docstring
`_prepare_batch` is being used for both training and evaluation:
https://github.com/pytorch/ignite/blob/e119a15dd4e366e240f7c412887b6bf717538370/ignite/engine/__init__.py#L33-L41


Discussion:

Resolving patch:
diff --git a/ignite/engine/__init__.py b/ignite/engine/__init__.py
--- a/ignite/engine/__init__.py
+++ b/ignite/engine/__init__.py
@@ -33,7 +33,7 @@
 def _prepare_batch(
     batch: Sequence[torch.Tensor], device: Optional[Union[str, torch.device]] = None, non_blocking: bool = False
 ) -> Tuple[Union[torch.Tensor, Sequence, Mapping, str, bytes], ...]:
-    """Prepare batch for training: pass to a device with options."""
+    """Prepare batch for training or evaluation: pass to a device with options."""
     x, y = batch
     return (
         convert_tensor(x, device=device, non_blocking=non_blocking),


Test patch:
Repository: pytorch/ignite

Issue:
Scheduled workflow failed
Oh no, something went wrong in the scheduled workflow **PyTorch version tests with commit 98844bf82b963a429d22b09f650cb0af2023bf20**.
Please look into it:

https://github.com/pytorch/ignite/actions/runs/2923090334

Feel free to close this if this was just a one-off error.



Discussion:
@puhuk this issue is related to your PR : https://github.com/pytorch/ignite/pull/2651
Please fix it.

Resolving patch:
diff --git a/ignite/metrics/gan/utils.py b/ignite/metrics/gan/utils.py
--- a/ignite/metrics/gan/utils.py
+++ b/ignite/metrics/gan/utils.py
@@ -19,12 +19,13 @@ class InceptionModel(torch.nn.Module):
 
     def __init__(self, return_features: bool, device: Union[str, torch.device] = "cpu") -> None:
         try:
+            import torchvision
             from torchvision import models
         except ImportError:
             raise RuntimeError("This module requires torchvision to be installed.")
         super(InceptionModel, self).__init__()
         self._device = device
-        if Version(torch.__version__) <= Version("1.7.0"):
+        if Version(torchvision.__version__) < Version("0.13.0"):
             model_kwargs = {"pretrained": True}
         else:
             model_kwargs = {"weights": models.Inception_V3_Weights.DEFAULT}


Test patch:
diff --git a/tests/ignite/handlers/test_state_param_scheduler.py b/tests/ignite/handlers/test_state_param_scheduler.py
--- a/tests/ignite/handlers/test_state_param_scheduler.py
+++ b/tests/ignite/handlers/test_state_param_scheduler.py
@@ -38,7 +38,7 @@
     },
 )
 
-if Version(torch.__version__) <= Version("1.7.0"):
+if Version(torch.__version__) < Version("1.9.0"):
     torch_testing_assert_close = torch.testing.assert_allclose
 else:
     torch_testing_assert_close = torch.testing.assert_close