prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [Feature Request] Allow Initialize to take a module
  # 🚀 Feature Request
  
  Allow hydra.experimental.initialize to take a calling module
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `hydra/experimental/compose.py`
  Content:
  ```
  1 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
  2 from typing import List, Optional
  3 
  4 from omegaconf import DictConfig, open_dict
  5 
  6 from hydra._internal.hydra import Hydra
  7 from hydra._internal.utils import detect_calling_file_or_module_from_stack_frame
  8 from hydra.core.global_hydra import GlobalHydra
  9 
  10 
  11 def initialize(
  12     config_dir: Optional[str] = None,
  13     strict: Optional[bool] = None,
  14     caller_stack_depth: int = 1,
  15 ) -> None:
  16     """
  17     :param config_dir: config directory relative to the calling script
  18     :param strict:
  19     :param caller_stack_depth:
  20     :return:
  21     """
  22     calling_file, calling_module = detect_calling_file_or_module_from_stack_frame(
  23         caller_stack_depth + 1
  24     )
  25     Hydra.create_main_hydra_file_or_module(
  26         calling_file, calling_module, config_dir, strict
  27     )
  28 
  29 
  30 def compose(
  31     config_name: Optional[str] = None,
  32     overrides: List[str] = [],
  33     strict: Optional[bool] = None,
  34 ) -> DictConfig:
  35     """
  36     :param config_name: optional config name to load
  37     :param overrides: list of overrides for config file
  38     :param strict: optionally override the default strict mode
  39     :return: the composed config
  40     """
  41     assert (
  42         GlobalHydra().is_initialized()
  43     ), "GlobalHydra is not initialized, use @hydra.main() or call hydra.experimental.initialize() first"
  44 
  45     gh = GlobalHydra.instance()
  46     assert gh.hydra is not None
  47     cfg = gh.hydra.compose_config(
  48         config_name=config_name, overrides=overrides, strict=strict
  49     )
  50     assert isinstance(cfg, DictConfig)
  51 
  52     if "hydra" in cfg:
  53         with open_dict(cfg):
  54             del cfg["hydra"]
  55     return cfg
  56
  ```
  
  Path: `examples/advanced/ad_hoc_composition/hydra_compose_example.py`
  Content:
  ```
  1 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
  2 from hydra.experimental import compose, initialize
  3 
  4 if __name__ == "__main__":
  5     # initialize the Hydra subsystem.
  6     # This is needed for apps that cannot have a standard @hydra.main() entry point
  7     initialize(config_dir="conf", strict=True)
  8 
  9     cfg = compose("config.yaml", overrides=["db=mysql", "db.user=${env:USER}"])
  10     print(cfg.pretty(resolve=True))
  11
  ```
  --- 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/examples/advanced/ad_hoc_composition/hydra_compose_example.py b/examples/advanced/ad_hoc_composition/hydra_compose_example.py
  --- a/examples/advanced/ad_hoc_composition/hydra_compose_example.py
  +++ b/examples/advanced/ad_hoc_composition/hydra_compose_example.py
  @@ -4,7 +4,7 @@
   if __name__ == "__main__":
       # initialize the Hydra subsystem.
       # This is needed for apps that cannot have a standard @hydra.main() entry point
  -    initialize(config_dir="conf", strict=True)
  +    initialize(config_path="conf", strict=True)
   
       cfg = compose("config.yaml", overrides=["db=mysql", "db.user=${env:USER}"])
       print(cfg.pretty(resolve=True))
  diff --git a/hydra/experimental/compose.py b/hydra/experimental/compose.py
  --- a/hydra/experimental/compose.py
  +++ b/hydra/experimental/compose.py
  @@ -9,31 +9,58 @@
   
   
   def initialize(
  -    config_dir: Optional[str] = None,
  +    config_path: Optional[str] = None,
       strict: Optional[bool] = None,
       caller_stack_depth: int = 1,
   ) -> None:
       """
  -    :param config_dir: config directory relative to the calling script
  -    :param strict:
  -    :param caller_stack_depth:
  -    :return:
  +    Initialize automatically detect the calling file or module.
  +    config_path is relative to the detected calling for or module.
  +
  +    :param config_path: A directory relative to the declaring python file or module
  +    :param strict: (Deprecated), will be removed in the next major version
  +    :param caller_stack_depth: stack depth of module the config_path is relative to
       """
       calling_file, calling_module = detect_calling_file_or_module_from_stack_frame(
           caller_stack_depth + 1
       )
       Hydra.create_main_hydra_file_or_module(
  -        calling_file, calling_module, config_dir, strict
  +        calling_file, calling_module, config_path, strict
       )
   
   
  +def initialize_with_file(
  +    calling_file: Optional[str], config_path: Optional[str] = None
  +) -> None:
  +    """
  +    Initialize Hydra and add the config_path to the search path.
  +    The config path is relative to the calling_file.
  +    :param calling_file : The file to make the config_path relative to
  +    :param config_path : The config path
  +    """
  +    Hydra.create_main_hydra_file_or_module(calling_file, None, config_path, None)
  +
  +
  +def initialize_with_module(
  +    calling_module: Optional[str], config_path: Optional[str] = None
  +) -> None:
  +    """
  +    Initialize Hydra and add the config_path to the search path.
  +    The config path is relative to the calling_module.
  +    :param calling_module : The module to make the config_path relative to
  +    :param config_path : The config path
  +    """
  +
  +    Hydra.create_main_hydra_file_or_module(None, calling_module, config_path, None)
  +
  +
   def compose(
       config_name: Optional[str] = None,
       overrides: List[str] = [],
       strict: Optional[bool] = None,
   ) -> DictConfig:
       """
  -    :param config_name: optional config name to load
  +    :param config_name: the name of the config (usually the file name without the .yaml extension)
       :param overrides: list of overrides for config file
       :param strict: optionally override the default strict mode
       :return: the composed config
  
verification_info: {"golden_diff": "diff --git a/examples/advanced/ad_hoc_composition/hydra_compose_example.py b/examples/advanced/ad_hoc_composition/hydra_compose_example.py\n--- a/examples/advanced/ad_hoc_composition/hydra_compose_example.py\n+++ b/examples/advanced/ad_hoc_composition/hydra_compose_example.py\n@@ -4,7 +4,7 @@\n if __name__ == \"__main__\":\n     # initialize the Hydra subsystem.\n     # This is needed for apps that cannot have a standard @hydra.main() entry point\n-    initialize(config_dir=\"conf\", strict=True)\n+    initialize(config_path=\"conf\", strict=True)\n \n     cfg = compose(\"config.yaml\", overrides=[\"db=mysql\", \"db.user=${env:USER}\"])\n     print(cfg.pretty(resolve=True))\ndiff --git a/hydra/experimental/compose.py b/hydra/experimental/compose.py\n--- a/hydra/experimental/compose.py\n+++ b/hydra/experimental/compose.py\n@@ -9,31 +9,58 @@\n \n \n def initialize(\n-    config_dir: Optional[str] = None,\n+    config_path: Optional[str] = None,\n     strict: Optional[bool] = None,\n     caller_stack_depth: int = 1,\n ) -> None:\n     \"\"\"\n-    :param config_dir: config directory relative to the calling script\n-    :param strict:\n-    :param caller_stack_depth:\n-    :return:\n+    Initialize automatically detect the calling file or module.\n+    config_path is relative to the detected calling for or module.\n+\n+    :param config_path: A directory relative to the declaring python file or module\n+    :param strict: (Deprecated), will be removed in the next major version\n+    :param caller_stack_depth: stack depth of module the config_path is relative to\n     \"\"\"\n     calling_file, calling_module = detect_calling_file_or_module_from_stack_frame(\n         caller_stack_depth + 1\n     )\n     Hydra.create_main_hydra_file_or_module(\n-        calling_file, calling_module, config_dir, strict\n+        calling_file, calling_module, config_path, strict\n     )\n \n \n+def initialize_with_file(\n+    calling_file: Optional[str], config_path: Optional[str] = None\n+) -> None:\n+    \"\"\"\n+    Initialize Hydra and add the config_path to the search path.\n+    The config path is relative to the calling_file.\n+    :param calling_file : The file to make the config_path relative to\n+    :param config_path : The config path\n+    \"\"\"\n+    Hydra.create_main_hydra_file_or_module(calling_file, None, config_path, None)\n+\n+\n+def initialize_with_module(\n+    calling_module: Optional[str], config_path: Optional[str] = None\n+) -> None:\n+    \"\"\"\n+    Initialize Hydra and add the config_path to the search path.\n+    The config path is relative to the calling_module.\n+    :param calling_module : The module to make the config_path relative to\n+    :param config_path : The config path\n+    \"\"\"\n+\n+    Hydra.create_main_hydra_file_or_module(None, calling_module, config_path, None)\n+\n+\n def compose(\n     config_name: Optional[str] = None,\n     overrides: List[str] = [],\n     strict: Optional[bool] = None,\n ) -> DictConfig:\n     \"\"\"\n-    :param config_name: optional config name to load\n+    :param config_name: the name of the config (usually the file name without the .yaml extension)\n     :param overrides: list of overrides for config file\n     :param strict: optionally override the default strict mode\n     :return: the composed config\n", "issue": "[Feature Request] Allow Initialize to take a module\n# \ud83d\ude80 Feature Request\r\n\r\nAllow hydra.experimental.initialize to take a calling module\n", "before_files": [{"content": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nfrom typing import List, Optional\n\nfrom omegaconf import DictConfig, open_dict\n\nfrom hydra._internal.hydra import Hydra\nfrom hydra._internal.utils import detect_calling_file_or_module_from_stack_frame\nfrom hydra.core.global_hydra import GlobalHydra\n\n\ndef initialize(\n    config_dir: Optional[str] = None,\n    strict: Optional[bool] = None,\n    caller_stack_depth: int = 1,\n) -> None:\n    \"\"\"\n    :param config_dir: config directory relative to the calling script\n    :param strict:\n    :param caller_stack_depth:\n    :return:\n    \"\"\"\n    calling_file, calling_module = detect_calling_file_or_module_from_stack_frame(\n        caller_stack_depth + 1\n    )\n    Hydra.create_main_hydra_file_or_module(\n        calling_file, calling_module, config_dir, strict\n    )\n\n\ndef compose(\n    config_name: Optional[str] = None,\n    overrides: List[str] = [],\n    strict: Optional[bool] = None,\n) -> DictConfig:\n    \"\"\"\n    :param config_name: optional config name to load\n    :param overrides: list of overrides for config file\n    :param strict: optionally override the default strict mode\n    :return: the composed config\n    \"\"\"\n    assert (\n        GlobalHydra().is_initialized()\n    ), \"GlobalHydra is not initialized, use @hydra.main() or call hydra.experimental.initialize() first\"\n\n    gh = GlobalHydra.instance()\n    assert gh.hydra is not None\n    cfg = gh.hydra.compose_config(\n        config_name=config_name, overrides=overrides, strict=strict\n    )\n    assert isinstance(cfg, DictConfig)\n\n    if \"hydra\" in cfg:\n        with open_dict(cfg):\n            del cfg[\"hydra\"]\n    return cfg\n", "path": "hydra/experimental/compose.py"}, {"content": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nfrom hydra.experimental import compose, initialize\n\nif __name__ == \"__main__\":\n    # initialize the Hydra subsystem.\n    # This is needed for apps that cannot have a standard @hydra.main() entry point\n    initialize(config_dir=\"conf\", strict=True)\n\n    cfg = compose(\"config.yaml\", overrides=[\"db=mysql\", \"db.user=${env:USER}\"])\n    print(cfg.pretty(resolve=True))\n", "path": "examples/advanced/ad_hoc_composition/hydra_compose_example.py"}], "after_files": [{"content": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nfrom typing import List, Optional\n\nfrom omegaconf import DictConfig, open_dict\n\nfrom hydra._internal.hydra import Hydra\nfrom hydra._internal.utils import detect_calling_file_or_module_from_stack_frame\nfrom hydra.core.global_hydra import GlobalHydra\n\n\ndef initialize(\n    config_path: Optional[str] = None,\n    strict: Optional[bool] = None,\n    caller_stack_depth: int = 1,\n) -> None:\n    \"\"\"\n    Initialize automatically detect the calling file or module.\n    config_path is relative to the detected calling for or module.\n\n    :param config_path: A directory relative to the declaring python file or module\n    :param strict: (Deprecated), will be removed in the next major version\n    :param caller_stack_depth: stack depth of module the config_path is relative to\n    \"\"\"\n    calling_file, calling_module = detect_calling_file_or_module_from_stack_frame(\n        caller_stack_depth + 1\n    )\n    Hydra.create_main_hydra_file_or_module(\n        calling_file, calling_module, config_path, strict\n    )\n\n\ndef initialize_with_file(\n    calling_file: Optional[str], config_path: Optional[str] = None\n) -> None:\n    \"\"\"\n    Initialize Hydra and add the config_path to the search path.\n    The config path is relative to the calling_file.\n    :param calling_file : The file to make the config_path relative to\n    :param config_path : The config path\n    \"\"\"\n    Hydra.create_main_hydra_file_or_module(calling_file, None, config_path, None)\n\n\ndef initialize_with_module(\n    calling_module: Optional[str], config_path: Optional[str] = None\n) -> None:\n    \"\"\"\n    Initialize Hydra and add the config_path to the search path.\n    The config path is relative to the calling_module.\n    :param calling_module : The module to make the config_path relative to\n    :param config_path : The config path\n    \"\"\"\n\n    Hydra.create_main_hydra_file_or_module(None, calling_module, config_path, None)\n\n\ndef compose(\n    config_name: Optional[str] = None,\n    overrides: List[str] = [],\n    strict: Optional[bool] = None,\n) -> DictConfig:\n    \"\"\"\n    :param config_name: the name of the config (usually the file name without the .yaml extension)\n    :param overrides: list of overrides for config file\n    :param strict: optionally override the default strict mode\n    :return: the composed config\n    \"\"\"\n    assert (\n        GlobalHydra().is_initialized()\n    ), \"GlobalHydra is not initialized, use @hydra.main() or call hydra.experimental.initialize() first\"\n\n    gh = GlobalHydra.instance()\n    assert gh.hydra is not None\n    cfg = gh.hydra.compose_config(\n        config_name=config_name, overrides=overrides, strict=strict\n    )\n    assert isinstance(cfg, DictConfig)\n\n    if \"hydra\" in cfg:\n        with open_dict(cfg):\n            del cfg[\"hydra\"]\n    return cfg\n", "path": "hydra/experimental/compose.py"}, {"content": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nfrom hydra.experimental import compose, initialize\n\nif __name__ == \"__main__\":\n    # initialize the Hydra subsystem.\n    # This is needed for apps that cannot have a standard @hydra.main() entry point\n    initialize(config_path=\"conf\", strict=True)\n\n    cfg = compose(\"config.yaml\", overrides=[\"db=mysql\", \"db.user=${env:USER}\"])\n    print(cfg.pretty(resolve=True))\n", "path": "examples/advanced/ad_hoc_composition/hydra_compose_example.py"}]}