prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [CI] InProj countainer not properly covered
  # 🐛 Bug
  Not a bug per say, but many inProjCountainer options are not covered, see https://app.codecov.io/gh/facebookresearch/xformers/blob/main/xformers/components/in_proj_container.py
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `xformers/components/__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 from dataclasses import fields
  8 from pathlib import Path
  9 from typing import Any, Dict, Union
  10 
  11 from xformers.utils import import_all_modules
  12 
  13 from .activations import Activation, build_activation  # noqa
  14 from .attention import Attention, build_attention  # noqa
  15 from .multi_head_dispatch import MultiHeadDispatch, MultiHeadDispatchConfig  # noqa
  16 from .residual import LayerNormStyle, PostNorm, PreNorm, Residual  # noqa
  17 
  18 # automatically import any Python files in the directory
  19 import_all_modules(str(Path(__file__).parent), "xformers.components")
  20 
  21 
  22 def build_multi_head_attention(
  23     multi_head_config: Union[MultiHeadDispatchConfig, Dict[str, Any]],
  24 ):
  25     """Builds a multihead attention from a config.
  26 
  27     This assumes a 'name' key in the config which is used to determine what
  28     attention class to instantiate. For instance, a config `{"name": "my_attention",
  29     "foo": "bar"}` will find a class that was registered as "my_attention"
  30     (see :func:`register_attention`) and call .from_config on it."""
  31 
  32     if not isinstance(multi_head_config, MultiHeadDispatchConfig):
  33         # Extract the required fields
  34         field_names = list(map(lambda x: x.name, fields(MultiHeadDispatchConfig)))
  35 
  36         # The missing fields get Noned
  37         for k in field_names:
  38             if k not in multi_head_config.keys():
  39                 multi_head_config[k] = None
  40 
  41         # Could be that the attention needs to be instantiated
  42         if not isinstance(multi_head_config["attention"], Attention):
  43             # Convenience: fill in possible missing fields
  44             if "num_heads" not in multi_head_config["attention"]:
  45                 multi_head_config["attention"]["num_heads"] = multi_head_config[
  46                     "num_heads"
  47                 ]
  48 
  49             if (
  50                 "dim_features" not in multi_head_config["attention"]
  51                 or multi_head_config["attention"]["dim_features"] is None
  52             ):
  53                 multi_head_config["attention"]["dim_features"] = (
  54                     multi_head_config["dim_model"] // multi_head_config["num_heads"]
  55                 )
  56 
  57             multi_head_config["attention"] = build_attention(
  58                 multi_head_config["attention"]
  59             )
  60 
  61         multi_head_config = MultiHeadDispatchConfig(**multi_head_config)
  62 
  63     return MultiHeadDispatch.from_config(multi_head_config)
  64
  ```
  --- 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/xformers/components/__init__.py b/xformers/components/__init__.py
  --- a/xformers/components/__init__.py
  +++ b/xformers/components/__init__.py
  @@ -12,6 +12,7 @@
   
   from .activations import Activation, build_activation  # noqa
   from .attention import Attention, build_attention  # noqa
  +from .in_proj_container import InProjContainer, InProjParams  # noqa
   from .multi_head_dispatch import MultiHeadDispatch, MultiHeadDispatchConfig  # noqa
   from .residual import LayerNormStyle, PostNorm, PreNorm, Residual  # noqa
  
verification_info: {"golden_diff": "diff --git a/xformers/components/__init__.py b/xformers/components/__init__.py\n--- a/xformers/components/__init__.py\n+++ b/xformers/components/__init__.py\n@@ -12,6 +12,7 @@\n \n from .activations import Activation, build_activation  # noqa\n from .attention import Attention, build_attention  # noqa\n+from .in_proj_container import InProjContainer, InProjParams  # noqa\n from .multi_head_dispatch import MultiHeadDispatch, MultiHeadDispatchConfig  # noqa\n from .residual import LayerNormStyle, PostNorm, PreNorm, Residual  # noqa\n", "issue": "[CI] InProj countainer not properly covered\n# \ud83d\udc1b Bug\r\nNot a bug per say, but many inProjCountainer options are not covered, see https://app.codecov.io/gh/facebookresearch/xformers/blob/main/xformers/components/in_proj_container.py\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\nfrom dataclasses import fields\nfrom pathlib import Path\nfrom typing import Any, Dict, Union\n\nfrom xformers.utils import import_all_modules\n\nfrom .activations import Activation, build_activation  # noqa\nfrom .attention import Attention, build_attention  # noqa\nfrom .multi_head_dispatch import MultiHeadDispatch, MultiHeadDispatchConfig  # noqa\nfrom .residual import LayerNormStyle, PostNorm, PreNorm, Residual  # noqa\n\n# automatically import any Python files in the directory\nimport_all_modules(str(Path(__file__).parent), \"xformers.components\")\n\n\ndef build_multi_head_attention(\n    multi_head_config: Union[MultiHeadDispatchConfig, Dict[str, Any]],\n):\n    \"\"\"Builds a multihead attention from a config.\n\n    This assumes a 'name' key in the config which is used to determine what\n    attention class to instantiate. For instance, a config `{\"name\": \"my_attention\",\n    \"foo\": \"bar\"}` will find a class that was registered as \"my_attention\"\n    (see :func:`register_attention`) and call .from_config on it.\"\"\"\n\n    if not isinstance(multi_head_config, MultiHeadDispatchConfig):\n        # Extract the required fields\n        field_names = list(map(lambda x: x.name, fields(MultiHeadDispatchConfig)))\n\n        # The missing fields get Noned\n        for k in field_names:\n            if k not in multi_head_config.keys():\n                multi_head_config[k] = None\n\n        # Could be that the attention needs to be instantiated\n        if not isinstance(multi_head_config[\"attention\"], Attention):\n            # Convenience: fill in possible missing fields\n            if \"num_heads\" not in multi_head_config[\"attention\"]:\n                multi_head_config[\"attention\"][\"num_heads\"] = multi_head_config[\n                    \"num_heads\"\n                ]\n\n            if (\n                \"dim_features\" not in multi_head_config[\"attention\"]\n                or multi_head_config[\"attention\"][\"dim_features\"] is None\n            ):\n                multi_head_config[\"attention\"][\"dim_features\"] = (\n                    multi_head_config[\"dim_model\"] // multi_head_config[\"num_heads\"]\n                )\n\n            multi_head_config[\"attention\"] = build_attention(\n                multi_head_config[\"attention\"]\n            )\n\n        multi_head_config = MultiHeadDispatchConfig(**multi_head_config)\n\n    return MultiHeadDispatch.from_config(multi_head_config)\n", "path": "xformers/components/__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\nfrom dataclasses import fields\nfrom pathlib import Path\nfrom typing import Any, Dict, Union\n\nfrom xformers.utils import import_all_modules\n\nfrom .activations import Activation, build_activation  # noqa\nfrom .attention import Attention, build_attention  # noqa\nfrom .in_proj_container import InProjContainer, InProjParams  # noqa\nfrom .multi_head_dispatch import MultiHeadDispatch, MultiHeadDispatchConfig  # noqa\nfrom .residual import LayerNormStyle, PostNorm, PreNorm, Residual  # noqa\n\n# automatically import any Python files in the directory\nimport_all_modules(str(Path(__file__).parent), \"xformers.components\")\n\n\ndef build_multi_head_attention(\n    multi_head_config: Union[MultiHeadDispatchConfig, Dict[str, Any]],\n):\n    \"\"\"Builds a multihead attention from a config.\n\n    This assumes a 'name' key in the config which is used to determine what\n    attention class to instantiate. For instance, a config `{\"name\": \"my_attention\",\n    \"foo\": \"bar\"}` will find a class that was registered as \"my_attention\"\n    (see :func:`register_attention`) and call .from_config on it.\"\"\"\n\n    if not isinstance(multi_head_config, MultiHeadDispatchConfig):\n        # Extract the required fields\n        field_names = list(map(lambda x: x.name, fields(MultiHeadDispatchConfig)))\n\n        # The missing fields get Noned\n        for k in field_names:\n            if k not in multi_head_config.keys():\n                multi_head_config[k] = None\n\n        # Could be that the attention needs to be instantiated\n        if not isinstance(multi_head_config[\"attention\"], Attention):\n            # Convenience: fill in possible missing fields\n            if \"num_heads\" not in multi_head_config[\"attention\"]:\n                multi_head_config[\"attention\"][\"num_heads\"] = multi_head_config[\n                    \"num_heads\"\n                ]\n\n            if (\n                \"dim_features\" not in multi_head_config[\"attention\"]\n                or multi_head_config[\"attention\"][\"dim_features\"] is None\n            ):\n                multi_head_config[\"attention\"][\"dim_features\"] = (\n                    multi_head_config[\"dim_model\"] // multi_head_config[\"num_heads\"]\n                )\n\n            multi_head_config[\"attention\"] = build_attention(\n                multi_head_config[\"attention\"]\n            )\n\n        multi_head_config = MultiHeadDispatchConfig(**multi_head_config)\n\n    return MultiHeadDispatch.from_config(multi_head_config)\n", "path": "xformers/components/__init__.py"}]}