prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  an error importing AMP in fairscale when using a Pytorch version less than 1.6
  ## 🐛 Bug
  
  <!-- A clear and concise description of what the bug is. -->
  
  ## Command
  
  ## To Reproduce
  
  <img width="737" alt="Screenshot 2020-11-23 at 08 21 28" src="https://user-images.githubusercontent.com/12861981/99949945-c2f11300-2d73-11eb-87f2-17a02e64da75.png">
  
  
  Steps to reproduce the behavior:
  
  <!-- If you were running a command, post the exact command that you were running -->
  
  1.
  2.
  3.
  
  <!-- If you have a code sample, error messages, stack traces, please provide it here as well -->
  
  ## Expected behavior
  
  <!-- A clear and concise description of what you expected to happen. -->
  
  ## Environment
  
  Please copy and paste the output from the
  environment collection script from PyTorch
  (or fill out the checklist below manually).
  
  You can run the script with:
  ```
  # For security purposes, please check the contents of collect_env.py before running it.
  python -m torch.utils.collect_env
  ```
  
   - PyTorch Version (e.g., 1.0):
   - OS (e.g., Linux):
   - How you installed PyTorch (`conda`, `pip`, source):
   - Build command you used (if compiling from source):
   - Python version:
   - CUDA/cuDNN version:
   - GPU models and configuration:
   - Any other relevant information:
  
  ## Additional context
  
  <!-- Add any other context about the problem here. -->
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `fairscale/optim/__init__.py`
  Content:
  ```
  1 # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
  2 #
  3 # This source code is licensed under the BSD license found in the
  4 # LICENSE file in the root directory of this source tree.
  5 
  6 """
  7 :mod:`fairscale.optim` is a package implementing various torch optimization algorithms.
  8 """
  9 
  10 try:
  11     from .adam import Adam, Precision
  12 except ImportError:  # pragma: no cover
  13     pass  # pragma: no cover
  14 from .adascale import AdaScale
  15 from .grad_scaler import GradScaler
  16 from .oss import OSS
  17
  ```
  --- 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/fairscale/optim/__init__.py b/fairscale/optim/__init__.py
  --- a/fairscale/optim/__init__.py
  +++ b/fairscale/optim/__init__.py
  @@ -6,11 +6,16 @@
   """
   :mod:`fairscale.optim` is a package implementing various torch optimization algorithms.
   """
  +import logging
  +
  +from .adascale import AdaScale
  +from .oss import OSS
   
   try:
       from .adam import Adam, Precision
   except ImportError:  # pragma: no cover
       pass  # pragma: no cover
  -from .adascale import AdaScale
  -from .grad_scaler import GradScaler
  -from .oss import OSS
  +try:
  +    from .grad_scaler import GradScaler
  +except ImportError:
  +    logging.warning("Torch AMP is not available on this platform")
  
verification_info: {"golden_diff": "diff --git a/fairscale/optim/__init__.py b/fairscale/optim/__init__.py\n--- a/fairscale/optim/__init__.py\n+++ b/fairscale/optim/__init__.py\n@@ -6,11 +6,16 @@\n \"\"\"\n :mod:`fairscale.optim` is a package implementing various torch optimization algorithms.\n \"\"\"\n+import logging\n+\n+from .adascale import AdaScale\n+from .oss import OSS\n \n try:\n     from .adam import Adam, Precision\n except ImportError:  # pragma: no cover\n     pass  # pragma: no cover\n-from .adascale import AdaScale\n-from .grad_scaler import GradScaler\n-from .oss import OSS\n+try:\n+    from .grad_scaler import GradScaler\n+except ImportError:\n+    logging.warning(\"Torch AMP is not available on this platform\")\n", "issue": "an error importing AMP in fairscale when using a Pytorch version less than 1.6\n## \ud83d\udc1b Bug\r\n\r\n<!-- A clear and concise description of what the bug is. -->\r\n\r\n## Command\r\n\r\n## To Reproduce\r\n\r\n<img width=\"737\" alt=\"Screenshot 2020-11-23 at 08 21 28\" src=\"https://user-images.githubusercontent.com/12861981/99949945-c2f11300-2d73-11eb-87f2-17a02e64da75.png\">\r\n\r\n\r\nSteps to reproduce the behavior:\r\n\r\n<!-- If you were running a command, post the exact command that you were running -->\r\n\r\n1.\r\n2.\r\n3.\r\n\r\n<!-- If you have a code sample, error messages, stack traces, please provide it here as well -->\r\n\r\n## Expected behavior\r\n\r\n<!-- A clear and concise description of what you expected to happen. -->\r\n\r\n## Environment\r\n\r\nPlease copy and paste the output from the\r\nenvironment collection script from PyTorch\r\n(or fill out the checklist below manually).\r\n\r\nYou can run the script with:\r\n```\r\n# For security purposes, please check the contents of collect_env.py before running it.\r\npython -m torch.utils.collect_env\r\n```\r\n\r\n - PyTorch Version (e.g., 1.0):\r\n - OS (e.g., Linux):\r\n - How you installed PyTorch (`conda`, `pip`, source):\r\n - Build command you used (if compiling from source):\r\n - Python version:\r\n - CUDA/cuDNN version:\r\n - GPU models and configuration:\r\n - Any other relevant information:\r\n\r\n## Additional context\r\n\r\n<!-- Add any other context about the problem here. -->\r\n\n", "before_files": [{"content": "# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.\n#\n# This source code is licensed under the BSD license found in the\n# LICENSE file in the root directory of this source tree.\n\n\"\"\"\n:mod:`fairscale.optim` is a package implementing various torch optimization algorithms.\n\"\"\"\n\ntry:\n    from .adam import Adam, Precision\nexcept ImportError:  # pragma: no cover\n    pass  # pragma: no cover\nfrom .adascale import AdaScale\nfrom .grad_scaler import GradScaler\nfrom .oss import OSS\n", "path": "fairscale/optim/__init__.py"}], "after_files": [{"content": "# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.\n#\n# This source code is licensed under the BSD license found in the\n# LICENSE file in the root directory of this source tree.\n\n\"\"\"\n:mod:`fairscale.optim` is a package implementing various torch optimization algorithms.\n\"\"\"\nimport logging\n\nfrom .adascale import AdaScale\nfrom .oss import OSS\n\ntry:\n    from .adam import Adam, Precision\nexcept ImportError:  # pragma: no cover\n    pass  # pragma: no cover\ntry:\n    from .grad_scaler import GradScaler\nexcept ImportError:\n    logging.warning(\"Torch AMP is not available on this platform\")\n", "path": "fairscale/optim/__init__.py"}]}