We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
BlurPool has incorrect docstrings
BlurPool docstrings imply that parameters have default values, but I don't see those in the function signatures: https://github.com/mosaicml/composer/blob/dev/composer/algorithms/blurpool/blurpool.py#L96


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `composer/algorithms/blurpool/blurpool.py`
Content:
```
1 # Copyright 2021 MosaicML. All Rights Reserved.
2 
3 from __future__ import annotations
4 
5 import functools
6 import logging
7 from typing import Optional
8 
9 import numpy as np
10 import torch
11 
12 from composer.algorithms.blurpool.blurpool_layers import BlurConv2d, BlurMaxPool2d
13 from composer.core import Algorithm, Event, State
14 from composer.core.types import Optimizers
15 from composer.loggers import Logger
16 from composer.utils import module_surgery
17 
18 log = logging.getLogger(__name__)
19 
20 
21 def apply_blurpool(model: torch.nn.Module,
22                    replace_convs: bool = True,
23                    replace_maxpools: bool = True,
24                    blur_first: bool = True,
25                    optimizers: Optional[Optimizers] = None) -> torch.nn.Module:
26     """Add anti-aliasing filters to the strided :class:`torch.nn.Conv2d` and/or :class:`torch.nn.MaxPool2d` modules
27     within `model`.
28 
29     These filters increase invariance to small spatial shifts in the input
30     (`Zhang 2019 <http://proceedings.mlr.press/v97/zhang19a.html>`_).
31 
32     Args:
33         model (torch.nn.Module): the model to modify in-place
34         replace_convs (bool, optional): replace strided :class:`torch.nn.Conv2d` modules with
35             :class:`.BlurConv2d` modules. Default: ``True``.
36         replace_maxpools (bool, optional): replace eligible :class:`torch.nn.MaxPool2d` modules
37             with :class:`.BlurMaxPool2d` modules. Default: ``True``.
38         blur_first (bool, optional): for ``replace_convs``, blur input before the associated
39             convolution. When set to ``False``, the convolution is applied with
40             a stride of 1 before the blurring, resulting in significant
41             overhead (though more closely matching
42             `the paper <http://proceedings.mlr.press/v97/zhang19a.html>`_).
43             See :class:`.BlurConv2d` for further discussion. Default: ``True``.
44         optimizers (Optimizers, optional):  Existing optimizers bound to
45             ``model.parameters()``. All optimizers that have already been
46             constructed with ``model.parameters()`` must be specified here so
47             they will optimize the correct parameters.
48 
49             If the optimizer(s) are constructed *after* calling this function,
50             then it is safe to omit this parameter. These optimizers will see
51             the correct model parameters.
52 
53     Returns:
54         The modified model
55 
56     Example:
57         .. testcode::
58 
59             import composer.functional as cf
60             from torchvision import models
61             model = models.resnet50()
62             cf.apply_blurpool(model)
63     """
64     transforms = {}
65     if replace_maxpools:
66         transforms[torch.nn.MaxPool2d] = BlurMaxPool2d.from_maxpool2d
67     if replace_convs:
68         transforms[torch.nn.Conv2d] = functools.partial(
69             _maybe_replace_strided_conv2d,
70             blur_first=blur_first,
71         )
72     module_surgery.replace_module_classes(model, optimizers=optimizers, policies=transforms)
73     _log_surgery_result(model)
74 
75     return model
76 
77 
78 class BlurPool(Algorithm):
79     """`BlurPool <http://proceedings.mlr.press/v97/zhang19a.html>`_ adds anti-aliasing filters to convolutional layers
80     to increase accuracy and invariance to small shifts in the input.
81 
82     Runs on :attr:`~composer.core.event.Event.INIT`.
83 
84     Args:
85         replace_convs (bool): replace strided :class:`torch.nn.Conv2d` modules with
86             :class:`.BlurConv2d` modules. Default: ``True``.
87         replace_maxpools (bool): replace eligible :class:`torch.nn.MaxPool2d` modules
88             with :class:`.BlurMaxPool2d` modules. Default: ``True``.
89         blur_first (bool): when ``replace_convs`` is ``True``, blur input before the
90             associated convolution. When set to ``False``, the convolution is
91             applied with a stride of 1 before the blurring, resulting in
92             significant overhead (though more closely matching the paper).
93             See :class:`.BlurConv2d` for further discussion. Default: ``True``.
94     """
95 
96     def __init__(self, replace_convs: bool, replace_maxpools: bool, blur_first: bool) -> None:
97         self.replace_convs = replace_convs
98         self.replace_maxpools = replace_maxpools
99         self.blur_first = blur_first
100 
101         if self.replace_maxpools is False and \
102              self.replace_convs is False:
103             log.warning('Both replace_maxpool and replace_convs set to false '
104                         'BlurPool will not be modifying the model.')
105 
106     def match(self, event: Event, state: State) -> bool:
107         """Runs on :attr:`~composer.core.event.Event.INIT`.
108 
109         Args:
110             event (Event): The current event.
111             state (State): The current state.
112         Returns:
113             bool: True if this algorithm should run now.
114         """
115         return event == Event.INIT
116 
117     def apply(self, event: Event, state: State, logger: Logger) -> Optional[int]:
118         """Adds anti-aliasing filters to the maxpools and/or convolutions.
119 
120         Args:
121             event (Event): the current event
122             state (State): the current trainer state
123             logger (Logger): the training logger
124         """
125         assert state.model is not None
126 
127         apply_blurpool(state.model,
128                        optimizers=state.optimizers,
129                        replace_convs=self.replace_convs,
130                        replace_maxpools=self.replace_maxpools,
131                        blur_first=self.blur_first)
132         self._log_results(event, state, logger)
133 
134     def _log_results(self, event: Event, state: State, logger: Logger) -> None:
135         """Logs the result of BlurPool application, including the number of layers that have been replaced."""
136         assert state.model is not None
137 
138         num_blurpool_layers = module_surgery.count_module_instances(state.model, BlurMaxPool2d)
139         num_blurconv_layers = module_surgery.count_module_instances(state.model, BlurConv2d)
140 
141         # python logger
142         log.info(f'Applied BlurPool to model {state.model.__class__.__name__} '
143                  f'with replace_maxpools={self.replace_maxpools}, '
144                  f'replace_convs={self.replace_convs}. '
145                  f'Model now has {num_blurpool_layers} BlurMaxPool2d '
146                  f'and {num_blurconv_layers} BlurConv2D layers.')
147 
148         logger.data_fit({
149             'blurpool/num_blurpool_layers': num_blurpool_layers,
150             'blurpool/num_blurconv_layers': num_blurconv_layers,
151         })
152 
153 
154 def _log_surgery_result(model: torch.nn.Module):
155     num_blurpool_layers = module_surgery.count_module_instances(model, BlurMaxPool2d)
156     num_blurconv_layers = module_surgery.count_module_instances(model, BlurConv2d)
157     log.info(f'Applied BlurPool to model {model.__class__.__name__}. '
158              f'Model now has {num_blurpool_layers} BlurMaxPool2d '
159              f'and {num_blurconv_layers} BlurConv2D layers.')
160 
161 
162 def _maybe_replace_strided_conv2d(module: torch.nn.Conv2d, module_index: int, blur_first: bool):
163     if (np.max(module.stride) > 1 and module.in_channels >= 16):
164         return BlurConv2d.from_conv2d(module, module_index, blur_first=blur_first)
165     return None
166
```
--- 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()

```

diff --git a/composer/algorithms/blurpool/blurpool.py b/composer/algorithms/blurpool/blurpool.py
--- a/composer/algorithms/blurpool/blurpool.py
+++ b/composer/algorithms/blurpool/blurpool.py
@@ -93,7 +93,7 @@
             See :class:`.BlurConv2d` for further discussion. Default: ``True``.
     """
 
-    def __init__(self, replace_convs: bool, replace_maxpools: bool, blur_first: bool) -> None:
+    def __init__(self, replace_convs: bool = True, replace_maxpools: bool = True, blur_first: bool = True) -> None:
         self.replace_convs = replace_convs
         self.replace_maxpools = replace_maxpools
         self.blur_first = blur_first

{"golden_diff": "diff --git a/composer/algorithms/blurpool/blurpool.py b/composer/algorithms/blurpool/blurpool.py\n--- a/composer/algorithms/blurpool/blurpool.py\n+++ b/composer/algorithms/blurpool/blurpool.py\n@@ -93,7 +93,7 @@\n             See :class:`.BlurConv2d` for further discussion. Default: ``True``.\n     \"\"\"\n \n-    def __init__(self, replace_convs: bool, replace_maxpools: bool, blur_first: bool) -> None:\n+    def __init__(self, replace_convs: bool = True, replace_maxpools: bool = True, blur_first: bool = True) -> None:\n         self.replace_convs = replace_convs\n         self.replace_maxpools = replace_maxpools\n         self.blur_first = blur_first\n", "issue": "BlurPool has incorrect docstrings\nBlurPool docstrings imply that parameters have default values, but I don't see those in the function signatures: https://github.com/mosaicml/composer/blob/dev/composer/algorithms/blurpool/blurpool.py#L96\r\n\n", "before_files": [{"content": "# Copyright 2021 MosaicML. All Rights Reserved.\n\nfrom __future__ import annotations\n\nimport functools\nimport logging\nfrom typing import Optional\n\nimport numpy as np\nimport torch\n\nfrom composer.algorithms.blurpool.blurpool_layers import BlurConv2d, BlurMaxPool2d\nfrom composer.core import Algorithm, Event, State\nfrom composer.core.types import Optimizers\nfrom composer.loggers import Logger\nfrom composer.utils import module_surgery\n\nlog = logging.getLogger(__name__)\n\n\ndef apply_blurpool(model: torch.nn.Module,\n                   replace_convs: bool = True,\n                   replace_maxpools: bool = True,\n                   blur_first: bool = True,\n                   optimizers: Optional[Optimizers] = None) -> torch.nn.Module:\n    \"\"\"Add anti-aliasing filters to the strided :class:`torch.nn.Conv2d` and/or :class:`torch.nn.MaxPool2d` modules\n    within `model`.\n\n    These filters increase invariance to small spatial shifts in the input\n    (`Zhang 2019 <http://proceedings.mlr.press/v97/zhang19a.html>`_).\n\n    Args:\n        model (torch.nn.Module): the model to modify in-place\n        replace_convs (bool, optional): replace strided :class:`torch.nn.Conv2d` modules with\n            :class:`.BlurConv2d` modules. Default: ``True``.\n        replace_maxpools (bool, optional): replace eligible :class:`torch.nn.MaxPool2d` modules\n            with :class:`.BlurMaxPool2d` modules. Default: ``True``.\n        blur_first (bool, optional): for ``replace_convs``, blur input before the associated\n            convolution. When set to ``False``, the convolution is applied with\n            a stride of 1 before the blurring, resulting in significant\n            overhead (though more closely matching\n            `the paper <http://proceedings.mlr.press/v97/zhang19a.html>`_).\n            See :class:`.BlurConv2d` for further discussion. Default: ``True``.\n        optimizers (Optimizers, optional):  Existing optimizers bound to\n            ``model.parameters()``. All optimizers that have already been\n            constructed with ``model.parameters()`` must be specified here so\n            they will optimize the correct parameters.\n\n            If the optimizer(s) are constructed *after* calling this function,\n            then it is safe to omit this parameter. These optimizers will see\n            the correct model parameters.\n\n    Returns:\n        The modified model\n\n    Example:\n        .. testcode::\n\n            import composer.functional as cf\n            from torchvision import models\n            model = models.resnet50()\n            cf.apply_blurpool(model)\n    \"\"\"\n    transforms = {}\n    if replace_maxpools:\n        transforms[torch.nn.MaxPool2d] = BlurMaxPool2d.from_maxpool2d\n    if replace_convs:\n        transforms[torch.nn.Conv2d] = functools.partial(\n            _maybe_replace_strided_conv2d,\n            blur_first=blur_first,\n        )\n    module_surgery.replace_module_classes(model, optimizers=optimizers, policies=transforms)\n    _log_surgery_result(model)\n\n    return model\n\n\nclass BlurPool(Algorithm):\n    \"\"\"`BlurPool <http://proceedings.mlr.press/v97/zhang19a.html>`_ adds anti-aliasing filters to convolutional layers\n    to increase accuracy and invariance to small shifts in the input.\n\n    Runs on :attr:`~composer.core.event.Event.INIT`.\n\n    Args:\n        replace_convs (bool): replace strided :class:`torch.nn.Conv2d` modules with\n            :class:`.BlurConv2d` modules. Default: ``True``.\n        replace_maxpools (bool): replace eligible :class:`torch.nn.MaxPool2d` modules\n            with :class:`.BlurMaxPool2d` modules. Default: ``True``.\n        blur_first (bool): when ``replace_convs`` is ``True``, blur input before the\n            associated convolution. When set to ``False``, the convolution is\n            applied with a stride of 1 before the blurring, resulting in\n            significant overhead (though more closely matching the paper).\n            See :class:`.BlurConv2d` for further discussion. Default: ``True``.\n    \"\"\"\n\n    def __init__(self, replace_convs: bool, replace_maxpools: bool, blur_first: bool) -> None:\n        self.replace_convs = replace_convs\n        self.replace_maxpools = replace_maxpools\n        self.blur_first = blur_first\n\n        if self.replace_maxpools is False and \\\n             self.replace_convs is False:\n            log.warning('Both replace_maxpool and replace_convs set to false '\n                        'BlurPool will not be modifying the model.')\n\n    def match(self, event: Event, state: State) -> bool:\n        \"\"\"Runs on :attr:`~composer.core.event.Event.INIT`.\n\n        Args:\n            event (Event): The current event.\n            state (State): The current state.\n        Returns:\n            bool: True if this algorithm should run now.\n        \"\"\"\n        return event == Event.INIT\n\n    def apply(self, event: Event, state: State, logger: Logger) -> Optional[int]:\n        \"\"\"Adds anti-aliasing filters to the maxpools and/or convolutions.\n\n        Args:\n            event (Event): the current event\n            state (State): the current trainer state\n            logger (Logger): the training logger\n        \"\"\"\n        assert state.model is not None\n\n        apply_blurpool(state.model,\n                       optimizers=state.optimizers,\n                       replace_convs=self.replace_convs,\n                       replace_maxpools=self.replace_maxpools,\n                       blur_first=self.blur_first)\n        self._log_results(event, state, logger)\n\n    def _log_results(self, event: Event, state: State, logger: Logger) -> None:\n        \"\"\"Logs the result of BlurPool application, including the number of layers that have been replaced.\"\"\"\n        assert state.model is not None\n\n        num_blurpool_layers = module_surgery.count_module_instances(state.model, BlurMaxPool2d)\n        num_blurconv_layers = module_surgery.count_module_instances(state.model, BlurConv2d)\n\n        # python logger\n        log.info(f'Applied BlurPool to model {state.model.__class__.__name__} '\n                 f'with replace_maxpools={self.replace_maxpools}, '\n                 f'replace_convs={self.replace_convs}. '\n                 f'Model now has {num_blurpool_layers} BlurMaxPool2d '\n                 f'and {num_blurconv_layers} BlurConv2D layers.')\n\n        logger.data_fit({\n            'blurpool/num_blurpool_layers': num_blurpool_layers,\n            'blurpool/num_blurconv_layers': num_blurconv_layers,\n        })\n\n\ndef _log_surgery_result(model: torch.nn.Module):\n    num_blurpool_layers = module_surgery.count_module_instances(model, BlurMaxPool2d)\n    num_blurconv_layers = module_surgery.count_module_instances(model, BlurConv2d)\n    log.info(f'Applied BlurPool to model {model.__class__.__name__}. '\n             f'Model now has {num_blurpool_layers} BlurMaxPool2d '\n             f'and {num_blurconv_layers} BlurConv2D layers.')\n\n\ndef _maybe_replace_strided_conv2d(module: torch.nn.Conv2d, module_index: int, blur_first: bool):\n    if (np.max(module.stride) > 1 and module.in_channels >= 16):\n        return BlurConv2d.from_conv2d(module, module_index, blur_first=blur_first)\n    return None\n", "path": "composer/algorithms/blurpool/blurpool.py"}], "after_files": [{"content": "# Copyright 2021 MosaicML. All Rights Reserved.\n\nfrom __future__ import annotations\n\nimport functools\nimport logging\nfrom typing import Optional\n\nimport numpy as np\nimport torch\n\nfrom composer.algorithms.blurpool.blurpool_layers import BlurConv2d, BlurMaxPool2d\nfrom composer.core import Algorithm, Event, State\nfrom composer.core.types import Optimizers\nfrom composer.loggers import Logger\nfrom composer.utils import module_surgery\n\nlog = logging.getLogger(__name__)\n\n\ndef apply_blurpool(model: torch.nn.Module,\n                   replace_convs: bool = True,\n                   replace_maxpools: bool = True,\n                   blur_first: bool = True,\n                   optimizers: Optional[Optimizers] = None) -> torch.nn.Module:\n    \"\"\"Add anti-aliasing filters to the strided :class:`torch.nn.Conv2d` and/or :class:`torch.nn.MaxPool2d` modules\n    within `model`.\n\n    These filters increase invariance to small spatial shifts in the input\n    (`Zhang 2019 <http://proceedings.mlr.press/v97/zhang19a.html>`_).\n\n    Args:\n        model (torch.nn.Module): the model to modify in-place\n        replace_convs (bool, optional): replace strided :class:`torch.nn.Conv2d` modules with\n            :class:`.BlurConv2d` modules. Default: ``True``.\n        replace_maxpools (bool, optional): replace eligible :class:`torch.nn.MaxPool2d` modules\n            with :class:`.BlurMaxPool2d` modules. Default: ``True``.\n        blur_first (bool, optional): for ``replace_convs``, blur input before the associated\n            convolution. When set to ``False``, the convolution is applied with\n            a stride of 1 before the blurring, resulting in significant\n            overhead (though more closely matching\n            `the paper <http://proceedings.mlr.press/v97/zhang19a.html>`_).\n            See :class:`.BlurConv2d` for further discussion. Default: ``True``.\n        optimizers (Optimizers, optional):  Existing optimizers bound to\n            ``model.parameters()``. All optimizers that have already been\n            constructed with ``model.parameters()`` must be specified here so\n            they will optimize the correct parameters.\n\n            If the optimizer(s) are constructed *after* calling this function,\n            then it is safe to omit this parameter. These optimizers will see\n            the correct model parameters.\n\n    Returns:\n        The modified model\n\n    Example:\n        .. testcode::\n\n            import composer.functional as cf\n            from torchvision import models\n            model = models.resnet50()\n            cf.apply_blurpool(model)\n    \"\"\"\n    transforms = {}\n    if replace_maxpools:\n        transforms[torch.nn.MaxPool2d] = BlurMaxPool2d.from_maxpool2d\n    if replace_convs:\n        transforms[torch.nn.Conv2d] = functools.partial(\n            _maybe_replace_strided_conv2d,\n            blur_first=blur_first,\n        )\n    module_surgery.replace_module_classes(model, optimizers=optimizers, policies=transforms)\n    _log_surgery_result(model)\n\n    return model\n\n\nclass BlurPool(Algorithm):\n    \"\"\"`BlurPool <http://proceedings.mlr.press/v97/zhang19a.html>`_ adds anti-aliasing filters to convolutional layers\n    to increase accuracy and invariance to small shifts in the input.\n\n    Runs on :attr:`~composer.core.event.Event.INIT`.\n\n    Args:\n        replace_convs (bool): replace strided :class:`torch.nn.Conv2d` modules with\n            :class:`.BlurConv2d` modules. Default: ``True``.\n        replace_maxpools (bool): replace eligible :class:`torch.nn.MaxPool2d` modules\n            with :class:`.BlurMaxPool2d` modules. Default: ``True``.\n        blur_first (bool): when ``replace_convs`` is ``True``, blur input before the\n            associated convolution. When set to ``False``, the convolution is\n            applied with a stride of 1 before the blurring, resulting in\n            significant overhead (though more closely matching the paper).\n            See :class:`.BlurConv2d` for further discussion. Default: ``True``.\n    \"\"\"\n\n    def __init__(self, replace_convs: bool = True, replace_maxpools: bool = True, blur_first: bool = True) -> None:\n        self.replace_convs = replace_convs\n        self.replace_maxpools = replace_maxpools\n        self.blur_first = blur_first\n\n        if self.replace_maxpools is False and \\\n             self.replace_convs is False:\n            log.warning('Both replace_maxpool and replace_convs set to false '\n                        'BlurPool will not be modifying the model.')\n\n    def match(self, event: Event, state: State) -> bool:\n        \"\"\"Runs on :attr:`~composer.core.event.Event.INIT`.\n\n        Args:\n            event (Event): The current event.\n            state (State): The current state.\n        Returns:\n            bool: True if this algorithm should run now.\n        \"\"\"\n        return event == Event.INIT\n\n    def apply(self, event: Event, state: State, logger: Logger) -> Optional[int]:\n        \"\"\"Adds anti-aliasing filters to the maxpools and/or convolutions.\n\n        Args:\n            event (Event): the current event\n            state (State): the current trainer state\n            logger (Logger): the training logger\n        \"\"\"\n        assert state.model is not None\n\n        apply_blurpool(state.model,\n                       optimizers=state.optimizers,\n                       replace_convs=self.replace_convs,\n                       replace_maxpools=self.replace_maxpools,\n                       blur_first=self.blur_first)\n        self._log_results(event, state, logger)\n\n    def _log_results(self, event: Event, state: State, logger: Logger) -> None:\n        \"\"\"Logs the result of BlurPool application, including the number of layers that have been replaced.\"\"\"\n        assert state.model is not None\n\n        num_blurpool_layers = module_surgery.count_module_instances(state.model, BlurMaxPool2d)\n        num_blurconv_layers = module_surgery.count_module_instances(state.model, BlurConv2d)\n\n        # python logger\n        log.info(f'Applied BlurPool to model {state.model.__class__.__name__} '\n                 f'with replace_maxpools={self.replace_maxpools}, '\n                 f'replace_convs={self.replace_convs}. '\n                 f'Model now has {num_blurpool_layers} BlurMaxPool2d '\n                 f'and {num_blurconv_layers} BlurConv2D layers.')\n\n        logger.data_fit({\n            'blurpool/num_blurpool_layers': num_blurpool_layers,\n            'blurpool/num_blurconv_layers': num_blurconv_layers,\n        })\n\n\ndef _log_surgery_result(model: torch.nn.Module):\n    num_blurpool_layers = module_surgery.count_module_instances(model, BlurMaxPool2d)\n    num_blurconv_layers = module_surgery.count_module_instances(model, BlurConv2d)\n    log.info(f'Applied BlurPool to model {model.__class__.__name__}. '\n             f'Model now has {num_blurpool_layers} BlurMaxPool2d '\n             f'and {num_blurconv_layers} BlurConv2D layers.')\n\n\ndef _maybe_replace_strided_conv2d(module: torch.nn.Conv2d, module_index: int, blur_first: bool):\n    if (np.max(module.stride) > 1 and module.in_channels >= 16):\n        return BlurConv2d.from_conv2d(module, module_index, blur_first=blur_first)\n    return None\n", "path": "composer/algorithms/blurpool/blurpool.py"}]}