prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  bug with OneCycleLR on Apple Silicone 
  ### Guidelines
  
  **NOTE:** Issues are for bugs and feature requests only. If you have a question about using Pyro or general modeling questions, please post it on the [forum](https://forum.pyro.ai/).
  
  If you would like to address any minor bugs in the documentation or source, please feel free to contribute a Pull Request without creating an issue first. 
  
  Please tag the issue appropriately in the title e.g. [bug], [feature request], [discussion], etc.
  
  Please provide the following details:
  --------------------------------------------------------------------------------------------------
  ### Issue Description
  Provide a brief description of the issue.
  
  ### Environment
  For any bugs, please provide the following:
   - OS and python version.
   - PyTorch version, or if relevant, output of `pip freeze`.
   - Pyro version: output of `python -c 'import pyro; print pyro.__version__'`
  
  ### Code Snippet
  Provide any relevant code snippets and commands run to replicate the issue.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `pyro/optim/pytorch_optimizers.py`
  Content:
  ```
  1 # Copyright (c) 2017-2019 Uber Technologies, Inc.
  2 # SPDX-License-Identifier: Apache-2.0
  3 
  4 import torch
  5 
  6 from pyro.optim import PyroOptim
  7 from pyro.optim.lr_scheduler import PyroLRScheduler
  8 
  9 __all__ = []
  10 # Programmatically load all optimizers from PyTorch.
  11 for _name, _Optim in torch.optim.__dict__.items():
  12     if not isinstance(_Optim, type):
  13         continue
  14     if not issubclass(_Optim, torch.optim.Optimizer):
  15         continue
  16     if _Optim is torch.optim.Optimizer:
  17         continue
  18     if _Optim is torch.optim.LBFGS:
  19         # XXX LBFGS is not supported for SVI yet
  20         continue
  21 
  22     _PyroOptim = (
  23         lambda _Optim: lambda optim_args, clip_args=None: PyroOptim(
  24             _Optim, optim_args, clip_args
  25         )
  26     )(_Optim)
  27     _PyroOptim.__name__ = _name
  28     _PyroOptim.__doc__ = "Wraps :class:`torch.optim.{}` with :class:`~pyro.optim.optim.PyroOptim`.".format(
  29         _name
  30     )
  31 
  32     locals()[_name] = _PyroOptim
  33     __all__.append(_name)
  34     del _PyroOptim
  35 
  36 # Load all schedulers from PyTorch
  37 for _name, _Optim in torch.optim.lr_scheduler.__dict__.items():
  38     if not isinstance(_Optim, type):
  39         continue
  40     if (
  41         not issubclass(_Optim, torch.optim.lr_scheduler._LRScheduler)
  42         and _name != "ReduceLROnPlateau"
  43     ):
  44         continue
  45     if _Optim is torch.optim.Optimizer:
  46         continue
  47 
  48     _PyroOptim = (
  49         lambda _Optim: lambda optim_args, clip_args=None: PyroLRScheduler(
  50             _Optim, optim_args, clip_args
  51         )
  52     )(_Optim)
  53     _PyroOptim.__name__ = _name
  54     _PyroOptim.__doc__ = (
  55         "Wraps :class:`torch.optim.{}` with ".format(_name)
  56         + ":class:`~pyro.optim.lr_scheduler.PyroLRScheduler`."
  57     )
  58 
  59     locals()[_name] = _PyroOptim
  60     __all__.append(_name)
  61     del _PyroOptim
  62
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/pyro/optim/pytorch_optimizers.py b/pyro/optim/pytorch_optimizers.py
  --- a/pyro/optim/pytorch_optimizers.py
  +++ b/pyro/optim/pytorch_optimizers.py
  @@ -34,13 +34,16 @@
       del _PyroOptim
   
   # Load all schedulers from PyTorch
  +# breaking change in torch >= 1.14: LRScheduler is new base class
  +if hasattr(torch.optim.lr_scheduler, "LRScheduler"):
  +    _torch_scheduler_base = torch.optim.lr_scheduler.LRScheduler
  +else:  # for torch < 1.13, _LRScheduler is base class
  +    _torch_scheduler_base = torch.optim.lr_scheduler._LRScheduler
  +
   for _name, _Optim in torch.optim.lr_scheduler.__dict__.items():
       if not isinstance(_Optim, type):
           continue
  -    if (
  -        not issubclass(_Optim, torch.optim.lr_scheduler._LRScheduler)
  -        and _name != "ReduceLROnPlateau"
  -    ):
  +    if not issubclass(_Optim, _torch_scheduler_base) and _name != "ReduceLROnPlateau":
           continue
       if _Optim is torch.optim.Optimizer:
           continue
  
verification_info: {"golden_diff": "diff --git a/pyro/optim/pytorch_optimizers.py b/pyro/optim/pytorch_optimizers.py\n--- a/pyro/optim/pytorch_optimizers.py\n+++ b/pyro/optim/pytorch_optimizers.py\n@@ -34,13 +34,16 @@\n     del _PyroOptim\n \n # Load all schedulers from PyTorch\n+# breaking change in torch >= 1.14: LRScheduler is new base class\n+if hasattr(torch.optim.lr_scheduler, \"LRScheduler\"):\n+    _torch_scheduler_base = torch.optim.lr_scheduler.LRScheduler\n+else:  # for torch < 1.13, _LRScheduler is base class\n+    _torch_scheduler_base = torch.optim.lr_scheduler._LRScheduler\n+\n for _name, _Optim in torch.optim.lr_scheduler.__dict__.items():\n     if not isinstance(_Optim, type):\n         continue\n-    if (\n-        not issubclass(_Optim, torch.optim.lr_scheduler._LRScheduler)\n-        and _name != \"ReduceLROnPlateau\"\n-    ):\n+    if not issubclass(_Optim, _torch_scheduler_base) and _name != \"ReduceLROnPlateau\":\n         continue\n     if _Optim is torch.optim.Optimizer:\n         continue\n", "issue": "bug with OneCycleLR on Apple Silicone \n### Guidelines\r\n\r\n**NOTE:** Issues are for bugs and feature requests only. If you have a question about using Pyro or general modeling questions, please post it on the [forum](https://forum.pyro.ai/).\r\n\r\nIf you would like to address any minor bugs in the documentation or source, please feel free to contribute a Pull Request without creating an issue first. \r\n\r\nPlease tag the issue appropriately in the title e.g. [bug], [feature request], [discussion], etc.\r\n\r\nPlease provide the following details:\r\n--------------------------------------------------------------------------------------------------\r\n### Issue Description\r\nProvide a brief description of the issue.\r\n\r\n### Environment\r\nFor any bugs, please provide the following:\r\n - OS and python version.\r\n - PyTorch version, or if relevant, output of `pip freeze`.\r\n - Pyro version: output of `python -c 'import pyro; print pyro.__version__'`\r\n\r\n### Code Snippet\r\nProvide any relevant code snippets and commands run to replicate the issue.\r\n\n", "before_files": [{"content": "# Copyright (c) 2017-2019 Uber Technologies, Inc.\n# SPDX-License-Identifier: Apache-2.0\n\nimport torch\n\nfrom pyro.optim import PyroOptim\nfrom pyro.optim.lr_scheduler import PyroLRScheduler\n\n__all__ = []\n# Programmatically load all optimizers from PyTorch.\nfor _name, _Optim in torch.optim.__dict__.items():\n    if not isinstance(_Optim, type):\n        continue\n    if not issubclass(_Optim, torch.optim.Optimizer):\n        continue\n    if _Optim is torch.optim.Optimizer:\n        continue\n    if _Optim is torch.optim.LBFGS:\n        # XXX LBFGS is not supported for SVI yet\n        continue\n\n    _PyroOptim = (\n        lambda _Optim: lambda optim_args, clip_args=None: PyroOptim(\n            _Optim, optim_args, clip_args\n        )\n    )(_Optim)\n    _PyroOptim.__name__ = _name\n    _PyroOptim.__doc__ = \"Wraps :class:`torch.optim.{}` with :class:`~pyro.optim.optim.PyroOptim`.\".format(\n        _name\n    )\n\n    locals()[_name] = _PyroOptim\n    __all__.append(_name)\n    del _PyroOptim\n\n# Load all schedulers from PyTorch\nfor _name, _Optim in torch.optim.lr_scheduler.__dict__.items():\n    if not isinstance(_Optim, type):\n        continue\n    if (\n        not issubclass(_Optim, torch.optim.lr_scheduler._LRScheduler)\n        and _name != \"ReduceLROnPlateau\"\n    ):\n        continue\n    if _Optim is torch.optim.Optimizer:\n        continue\n\n    _PyroOptim = (\n        lambda _Optim: lambda optim_args, clip_args=None: PyroLRScheduler(\n            _Optim, optim_args, clip_args\n        )\n    )(_Optim)\n    _PyroOptim.__name__ = _name\n    _PyroOptim.__doc__ = (\n        \"Wraps :class:`torch.optim.{}` with \".format(_name)\n        + \":class:`~pyro.optim.lr_scheduler.PyroLRScheduler`.\"\n    )\n\n    locals()[_name] = _PyroOptim\n    __all__.append(_name)\n    del _PyroOptim\n", "path": "pyro/optim/pytorch_optimizers.py"}], "after_files": [{"content": "# Copyright (c) 2017-2019 Uber Technologies, Inc.\n# SPDX-License-Identifier: Apache-2.0\n\nimport torch\n\nfrom pyro.optim import PyroOptim\nfrom pyro.optim.lr_scheduler import PyroLRScheduler\n\n__all__ = []\n# Programmatically load all optimizers from PyTorch.\nfor _name, _Optim in torch.optim.__dict__.items():\n    if not isinstance(_Optim, type):\n        continue\n    if not issubclass(_Optim, torch.optim.Optimizer):\n        continue\n    if _Optim is torch.optim.Optimizer:\n        continue\n    if _Optim is torch.optim.LBFGS:\n        # XXX LBFGS is not supported for SVI yet\n        continue\n\n    _PyroOptim = (\n        lambda _Optim: lambda optim_args, clip_args=None: PyroOptim(\n            _Optim, optim_args, clip_args\n        )\n    )(_Optim)\n    _PyroOptim.__name__ = _name\n    _PyroOptim.__doc__ = \"Wraps :class:`torch.optim.{}` with :class:`~pyro.optim.optim.PyroOptim`.\".format(\n        _name\n    )\n\n    locals()[_name] = _PyroOptim\n    __all__.append(_name)\n    del _PyroOptim\n\n# Load all schedulers from PyTorch\n# breaking change in torch >= 1.14: LRScheduler is new base class\nif hasattr(torch.optim.lr_scheduler, \"LRScheduler\"):\n    _torch_scheduler_base = torch.optim.lr_scheduler.LRScheduler\nelse:  # for torch < 1.13, _LRScheduler is base class\n    _torch_scheduler_base = torch.optim.lr_scheduler._LRScheduler\n\nfor _name, _Optim in torch.optim.lr_scheduler.__dict__.items():\n    if not isinstance(_Optim, type):\n        continue\n    if not issubclass(_Optim, _torch_scheduler_base) and _name != \"ReduceLROnPlateau\":\n        continue\n    if _Optim is torch.optim.Optimizer:\n        continue\n\n    _PyroOptim = (\n        lambda _Optim: lambda optim_args, clip_args=None: PyroLRScheduler(\n            _Optim, optim_args, clip_args\n        )\n    )(_Optim)\n    _PyroOptim.__name__ = _name\n    _PyroOptim.__doc__ = (\n        \"Wraps :class:`torch.optim.{}` with \".format(_name)\n        + \":class:`~pyro.optim.lr_scheduler.PyroLRScheduler`.\"\n    )\n\n    locals()[_name] = _PyroOptim\n    __all__.append(_name)\n    del _PyroOptim\n", "path": "pyro/optim/pytorch_optimizers.py"}]}