Repository: mosaicml/composer

Issue:
Fix typehints for python < 3.9
[PEP 585](https://peps.python.org/pep-0585/) introduces typehint generics for python 3.9. To remain backwards-compatible with python < 3.9, `from __future__ import annotations` must be executed, or otherwise typehints must be specified in a backwards-compatible way (e.g. in quotes). I think the simplest solution is to add the `from __future__ import annotations` call to the relevant files.

** Environment **
- Image: [nvcr.io/nvidia/pytorch:22.03-py3](https://docs.nvidia.com/deeplearning/frameworks/pytorch-release-notes/rel_22-03.html#rel_22-03)
- OS: Ubuntu 20.04
- Hardware: N/A
- Python 3.8.12

** To reproduce

Steps to reproduce the behavior:

1. `pip install git+https://github.com/mosaicml/composer.git@a264ae95a5a9658e1f82206cf99158281c6dd8ca` (commit a264ae95a5a9658e1f82206cf99158281c6dd8ca)
2. `from composer.functional import cutmix_batch`

## Expected behavior

`cutmix_batch` imports successfully.

## Actual behavior

```
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jacob.schmidt/Projects/photosynthetic/venv/lib/python3.8/site-packages/composer/__init__.py", line 3, in <module>
    from composer import algorithms as algorithms
  File "/Users/jacob.schmidt/Projects/photosynthetic/venv/lib/python3.8/site-packages/composer/algorithms/__init__.py", line 39, in <module>
    from composer.algorithms.algorithm_hparams import AlgorithmHparams
  File "/Users/jacob.schmidt/Projects/photosynthetic/venv/lib/python3.8/site-packages/composer/algorithms/algorithm_hparams.py", line 13, in <module>
    from composer.core.algorithm import Algorithm
  File "/Users/jacob.schmidt/Projects/photosynthetic/venv/lib/python3.8/site-packages/composer/core/__init__.py", line 13, in <module>
    from composer.core.engine import Engine as Engine
  File "/Users/jacob.schmidt/Projects/photosynthetic/venv/lib/python3.8/site-packages/composer/core/engine.py", line 74, in <module>
    from composer.profiler import ProfilerAction
  File "/Users/jacob.schmidt/Projects/photosynthetic/venv/lib/python3.8/site-packages/composer/profiler/__init__.py", line 17, in <module>
    from composer.profiler.dataloader_profiler import DataLoaderProfiler
  File "/Users/jacob.schmidt/Projects/photosynthetic/venv/lib/python3.8/site-packages/composer/profiler/dataloader_profiler.py", line 10, in <module>
    from composer.datasets.dataloader import WrappedDataLoader
  File "/Users/jacob.schmidt/Projects/photosynthetic/venv/lib/python3.8/site-packages/composer/datasets/__init__.py", line 17, in <module>
    from composer.datasets.ade20k import ADE20kDatasetHparams, ADE20kWebDatasetHparams
  File "/Users/jacob.schmidt/Projects/photosynthetic/venv/lib/python3.8/site-packages/composer/datasets/ade20k.py", line 24, in <module>
    from composer.datasets.imagenet import IMAGENET_CHANNEL_MEAN, IMAGENET_CHANNEL_STD
  File "/Users/jacob.schmidt/Projects/photosynthetic/venv/lib/python3.8/site-packages/composer/datasets/imagenet.py", line 24, in <module>
    from composer.datasets.ffcv_utils import write_ffcv_dataset
  File "/Users/jacob.schmidt/Projects/photosynthetic/venv/lib/python3.8/site-packages/composer/datasets/ffcv_utils.py", line 9, in <module>
    from composer.datasets.webdataset_utils import init_webdataset_meta
  File "/Users/jacob.schmidt/Projects/photosynthetic/venv/lib/python3.8/site-packages/composer/datasets/webdataset_utils.py", line 190, in <module>
    cache_verbose: bool = False) -> Tuple[WebDataset, dict]:
NameError: name 'WebDataset' is not defined
```

Here, `webdataset` is a `dev` dependency and shouldn't need to be installed to run the code.


Discussion:
Thanks for catching this @schmidt-jake , we'll push a fix. Additionally, we should check why our Python 3.8 tests are not catching this error. cc: @bandish-shah @ravi-mosaicml 

Resolving patch:
diff --git a/composer/datasets/webdataset_utils.py b/composer/datasets/webdataset_utils.py
--- a/composer/datasets/webdataset_utils.py
+++ b/composer/datasets/webdataset_utils.py
@@ -1,3 +1,7 @@
+# Copyright 2021 MosaicML. All Rights Reserved.
+
+from __future__ import annotations
+
 import json
 import logging
 import math


Test patch: