prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Remove experimental label from `_ProgressBar`
  ### Motivation
  
  Several issues related to `_ProgressBar` have been already addressed (ref: https://github.com/optuna/optuna/issues/2892, https://github.com/optuna/optuna/issues/2957, https://github.com/optuna/optuna/issues/2958). Now we can remove the experimental label from `_ProgressBar`.
  
  ### Suggestion
  
  Remove the `@experimental_func` decorator from `_ProgressBar`. Also, `_init_valid` method can be removed as explained in [TODO comment](https://github.com/optuna/optuna/blob/806448420863606c113aeb2e33457acf022be066/optuna/progress_bar.py#L57C28-L58).
  
  ### Additional context (optional)
  
  _No response_
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `optuna/progress_bar.py`
  Content:
  ```
  1 import logging
  2 from typing import Any
  3 from typing import Optional
  4 from typing import TYPE_CHECKING
  5 
  6 from tqdm.auto import tqdm
  7 
  8 from optuna import logging as optuna_logging
  9 from optuna._experimental import experimental_func
  10 
  11 
  12 if TYPE_CHECKING:
  13     from optuna.study import Study
  14 
  15 _tqdm_handler: Optional["_TqdmLoggingHandler"] = None
  16 
  17 
  18 # Reference: https://gist.github.com/hvy/8b80c2cedf02b15c24f85d1fa17ebe02
  19 class _TqdmLoggingHandler(logging.StreamHandler):
  20     def emit(self, record: Any) -> None:
  21         try:
  22             msg = self.format(record)
  23             tqdm.write(msg)
  24             self.flush()
  25         except (KeyboardInterrupt, SystemExit):
  26             raise
  27         except Exception:
  28             self.handleError(record)
  29 
  30 
  31 class _ProgressBar:
  32     """Progress Bar implementation for :func:`~optuna.study.Study.optimize` on the top of `tqdm`.
  33 
  34     Args:
  35         is_valid:
  36             Whether to show progress bars in :func:`~optuna.study.Study.optimize`.
  37         n_trials:
  38             The number of trials.
  39         timeout:
  40             Stop study after the given number of second(s).
  41     """
  42 
  43     def __init__(
  44         self,
  45         is_valid: bool,
  46         n_trials: Optional[int] = None,
  47         timeout: Optional[float] = None,
  48     ) -> None:
  49         self._is_valid = is_valid and (n_trials or timeout) is not None
  50         self._n_trials = n_trials
  51         self._timeout = timeout
  52         self._last_elapsed_seconds = 0.0
  53 
  54         if self._is_valid:
  55             self._init_valid()
  56 
  57     # TODO(hvy): Remove initialization indirection via this method when the progress bar is no
  58     # longer experimental.
  59     @experimental_func("1.2.0", name="Progress bar")
  60     def _init_valid(self) -> None:
  61         if self._n_trials is not None:
  62             self._progress_bar = tqdm(total=self._n_trials)
  63 
  64         elif self._timeout is not None:
  65             total = tqdm.format_interval(self._timeout)
  66             fmt = "{desc} {percentage:3.0f}%|{bar}| {elapsed}/" + total
  67             self._progress_bar = tqdm(total=self._timeout, bar_format=fmt)
  68         else:
  69             assert False
  70 
  71         global _tqdm_handler
  72 
  73         _tqdm_handler = _TqdmLoggingHandler()
  74         _tqdm_handler.setLevel(logging.INFO)
  75         _tqdm_handler.setFormatter(optuna_logging.create_default_formatter())
  76         optuna_logging.disable_default_handler()
  77         optuna_logging._get_library_root_logger().addHandler(_tqdm_handler)
  78 
  79     def update(self, elapsed_seconds: float, study: "Study") -> None:
  80         """Update the progress bars if ``is_valid`` is :obj:`True`.
  81 
  82         Args:
  83             elapsed_seconds:
  84                 The time past since :func:`~optuna.study.Study.optimize` started.
  85             study:
  86                 The current study object.
  87         """
  88 
  89         if self._is_valid:
  90             if not study._is_multi_objective():
  91                 # Not updating the progress bar when there are no complete trial.
  92                 try:
  93                     msg = (
  94                         f"Best trial: {study.best_trial.number}. "
  95                         f"Best value: {study.best_value:.6g}"
  96                     )
  97 
  98                     self._progress_bar.set_description(msg)
  99                 except ValueError:
  100                     pass
  101 
  102             if self._n_trials is not None:
  103                 self._progress_bar.update(1)
  104                 if self._timeout is not None:
  105                     self._progress_bar.set_postfix_str(
  106                         "{:.02f}/{} seconds".format(elapsed_seconds, self._timeout)
  107                     )
  108 
  109             elif self._timeout is not None:
  110                 time_diff = elapsed_seconds - self._last_elapsed_seconds
  111                 if elapsed_seconds > self._timeout:
  112                     # Clip elapsed time to avoid tqdm warnings.
  113                     time_diff -= elapsed_seconds - self._timeout
  114 
  115                 self._progress_bar.update(time_diff)
  116                 self._last_elapsed_seconds = elapsed_seconds
  117 
  118             else:
  119                 assert False
  120 
  121     def close(self) -> None:
  122         """Close progress bars."""
  123 
  124         if self._is_valid:
  125             self._progress_bar.close()
  126             assert _tqdm_handler is not None
  127             optuna_logging._get_library_root_logger().removeHandler(_tqdm_handler)
  128             optuna_logging.enable_default_handler()
  129
  ```
  --- 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/optuna/progress_bar.py b/optuna/progress_bar.py
  --- a/optuna/progress_bar.py
  +++ b/optuna/progress_bar.py
  @@ -6,7 +6,6 @@
   from tqdm.auto import tqdm
   
   from optuna import logging as optuna_logging
  -from optuna._experimental import experimental_func
   
   
   if TYPE_CHECKING:
  @@ -52,29 +51,22 @@
           self._last_elapsed_seconds = 0.0
   
           if self._is_valid:
  -            self._init_valid()
  -
  -    # TODO(hvy): Remove initialization indirection via this method when the progress bar is no
  -    # longer experimental.
  -    @experimental_func("1.2.0", name="Progress bar")
  -    def _init_valid(self) -> None:
  -        if self._n_trials is not None:
  -            self._progress_bar = tqdm(total=self._n_trials)
  -
  -        elif self._timeout is not None:
  -            total = tqdm.format_interval(self._timeout)
  -            fmt = "{desc} {percentage:3.0f}%|{bar}| {elapsed}/" + total
  -            self._progress_bar = tqdm(total=self._timeout, bar_format=fmt)
  -        else:
  -            assert False
  -
  -        global _tqdm_handler
  -
  -        _tqdm_handler = _TqdmLoggingHandler()
  -        _tqdm_handler.setLevel(logging.INFO)
  -        _tqdm_handler.setFormatter(optuna_logging.create_default_formatter())
  -        optuna_logging.disable_default_handler()
  -        optuna_logging._get_library_root_logger().addHandler(_tqdm_handler)
  +            if self._n_trials is not None:
  +                self._progress_bar = tqdm(total=self._n_trials)
  +            elif self._timeout is not None:
  +                total = tqdm.format_interval(self._timeout)
  +                fmt = "{desc} {percentage:3.0f}%|{bar}| {elapsed}/" + total
  +                self._progress_bar = tqdm(total=self._timeout, bar_format=fmt)
  +            else:
  +                assert False
  +
  +            global _tqdm_handler
  +
  +            _tqdm_handler = _TqdmLoggingHandler()
  +            _tqdm_handler.setLevel(logging.INFO)
  +            _tqdm_handler.setFormatter(optuna_logging.create_default_formatter())
  +            optuna_logging.disable_default_handler()
  +            optuna_logging._get_library_root_logger().addHandler(_tqdm_handler)
   
       def update(self, elapsed_seconds: float, study: "Study") -> None:
           """Update the progress bars if ``is_valid`` is :obj:`True`.
  
verification_info: {"golden_diff": "diff --git a/optuna/progress_bar.py b/optuna/progress_bar.py\n--- a/optuna/progress_bar.py\n+++ b/optuna/progress_bar.py\n@@ -6,7 +6,6 @@\n from tqdm.auto import tqdm\n \n from optuna import logging as optuna_logging\n-from optuna._experimental import experimental_func\n \n \n if TYPE_CHECKING:\n@@ -52,29 +51,22 @@\n         self._last_elapsed_seconds = 0.0\n \n         if self._is_valid:\n-            self._init_valid()\n-\n-    # TODO(hvy): Remove initialization indirection via this method when the progress bar is no\n-    # longer experimental.\n-    @experimental_func(\"1.2.0\", name=\"Progress bar\")\n-    def _init_valid(self) -> None:\n-        if self._n_trials is not None:\n-            self._progress_bar = tqdm(total=self._n_trials)\n-\n-        elif self._timeout is not None:\n-            total = tqdm.format_interval(self._timeout)\n-            fmt = \"{desc} {percentage:3.0f}%|{bar}| {elapsed}/\" + total\n-            self._progress_bar = tqdm(total=self._timeout, bar_format=fmt)\n-        else:\n-            assert False\n-\n-        global _tqdm_handler\n-\n-        _tqdm_handler = _TqdmLoggingHandler()\n-        _tqdm_handler.setLevel(logging.INFO)\n-        _tqdm_handler.setFormatter(optuna_logging.create_default_formatter())\n-        optuna_logging.disable_default_handler()\n-        optuna_logging._get_library_root_logger().addHandler(_tqdm_handler)\n+            if self._n_trials is not None:\n+                self._progress_bar = tqdm(total=self._n_trials)\n+            elif self._timeout is not None:\n+                total = tqdm.format_interval(self._timeout)\n+                fmt = \"{desc} {percentage:3.0f}%|{bar}| {elapsed}/\" + total\n+                self._progress_bar = tqdm(total=self._timeout, bar_format=fmt)\n+            else:\n+                assert False\n+\n+            global _tqdm_handler\n+\n+            _tqdm_handler = _TqdmLoggingHandler()\n+            _tqdm_handler.setLevel(logging.INFO)\n+            _tqdm_handler.setFormatter(optuna_logging.create_default_formatter())\n+            optuna_logging.disable_default_handler()\n+            optuna_logging._get_library_root_logger().addHandler(_tqdm_handler)\n \n     def update(self, elapsed_seconds: float, study: \"Study\") -> None:\n         \"\"\"Update the progress bars if ``is_valid`` is :obj:`True`.\n", "issue": "Remove experimental label from `_ProgressBar`\n### Motivation\n\nSeveral issues related to `_ProgressBar` have been already addressed (ref: https://github.com/optuna/optuna/issues/2892, https://github.com/optuna/optuna/issues/2957, https://github.com/optuna/optuna/issues/2958). Now we can remove the experimental label from `_ProgressBar`.\n\n### Suggestion\n\nRemove the `@experimental_func` decorator from `_ProgressBar`. Also, `_init_valid` method can be removed as explained in [TODO comment](https://github.com/optuna/optuna/blob/806448420863606c113aeb2e33457acf022be066/optuna/progress_bar.py#L57C28-L58).\n\n### Additional context (optional)\n\n_No response_\n", "before_files": [{"content": "import logging\nfrom typing import Any\nfrom typing import Optional\nfrom typing import TYPE_CHECKING\n\nfrom tqdm.auto import tqdm\n\nfrom optuna import logging as optuna_logging\nfrom optuna._experimental import experimental_func\n\n\nif TYPE_CHECKING:\n    from optuna.study import Study\n\n_tqdm_handler: Optional[\"_TqdmLoggingHandler\"] = None\n\n\n# Reference: https://gist.github.com/hvy/8b80c2cedf02b15c24f85d1fa17ebe02\nclass _TqdmLoggingHandler(logging.StreamHandler):\n    def emit(self, record: Any) -> None:\n        try:\n            msg = self.format(record)\n            tqdm.write(msg)\n            self.flush()\n        except (KeyboardInterrupt, SystemExit):\n            raise\n        except Exception:\n            self.handleError(record)\n\n\nclass _ProgressBar:\n    \"\"\"Progress Bar implementation for :func:`~optuna.study.Study.optimize` on the top of `tqdm`.\n\n    Args:\n        is_valid:\n            Whether to show progress bars in :func:`~optuna.study.Study.optimize`.\n        n_trials:\n            The number of trials.\n        timeout:\n            Stop study after the given number of second(s).\n    \"\"\"\n\n    def __init__(\n        self,\n        is_valid: bool,\n        n_trials: Optional[int] = None,\n        timeout: Optional[float] = None,\n    ) -> None:\n        self._is_valid = is_valid and (n_trials or timeout) is not None\n        self._n_trials = n_trials\n        self._timeout = timeout\n        self._last_elapsed_seconds = 0.0\n\n        if self._is_valid:\n            self._init_valid()\n\n    # TODO(hvy): Remove initialization indirection via this method when the progress bar is no\n    # longer experimental.\n    @experimental_func(\"1.2.0\", name=\"Progress bar\")\n    def _init_valid(self) -> None:\n        if self._n_trials is not None:\n            self._progress_bar = tqdm(total=self._n_trials)\n\n        elif self._timeout is not None:\n            total = tqdm.format_interval(self._timeout)\n            fmt = \"{desc} {percentage:3.0f}%|{bar}| {elapsed}/\" + total\n            self._progress_bar = tqdm(total=self._timeout, bar_format=fmt)\n        else:\n            assert False\n\n        global _tqdm_handler\n\n        _tqdm_handler = _TqdmLoggingHandler()\n        _tqdm_handler.setLevel(logging.INFO)\n        _tqdm_handler.setFormatter(optuna_logging.create_default_formatter())\n        optuna_logging.disable_default_handler()\n        optuna_logging._get_library_root_logger().addHandler(_tqdm_handler)\n\n    def update(self, elapsed_seconds: float, study: \"Study\") -> None:\n        \"\"\"Update the progress bars if ``is_valid`` is :obj:`True`.\n\n        Args:\n            elapsed_seconds:\n                The time past since :func:`~optuna.study.Study.optimize` started.\n            study:\n                The current study object.\n        \"\"\"\n\n        if self._is_valid:\n            if not study._is_multi_objective():\n                # Not updating the progress bar when there are no complete trial.\n                try:\n                    msg = (\n                        f\"Best trial: {study.best_trial.number}. \"\n                        f\"Best value: {study.best_value:.6g}\"\n                    )\n\n                    self._progress_bar.set_description(msg)\n                except ValueError:\n                    pass\n\n            if self._n_trials is not None:\n                self._progress_bar.update(1)\n                if self._timeout is not None:\n                    self._progress_bar.set_postfix_str(\n                        \"{:.02f}/{} seconds\".format(elapsed_seconds, self._timeout)\n                    )\n\n            elif self._timeout is not None:\n                time_diff = elapsed_seconds - self._last_elapsed_seconds\n                if elapsed_seconds > self._timeout:\n                    # Clip elapsed time to avoid tqdm warnings.\n                    time_diff -= elapsed_seconds - self._timeout\n\n                self._progress_bar.update(time_diff)\n                self._last_elapsed_seconds = elapsed_seconds\n\n            else:\n                assert False\n\n    def close(self) -> None:\n        \"\"\"Close progress bars.\"\"\"\n\n        if self._is_valid:\n            self._progress_bar.close()\n            assert _tqdm_handler is not None\n            optuna_logging._get_library_root_logger().removeHandler(_tqdm_handler)\n            optuna_logging.enable_default_handler()\n", "path": "optuna/progress_bar.py"}], "after_files": [{"content": "import logging\nfrom typing import Any\nfrom typing import Optional\nfrom typing import TYPE_CHECKING\n\nfrom tqdm.auto import tqdm\n\nfrom optuna import logging as optuna_logging\n\n\nif TYPE_CHECKING:\n    from optuna.study import Study\n\n_tqdm_handler: Optional[\"_TqdmLoggingHandler\"] = None\n\n\n# Reference: https://gist.github.com/hvy/8b80c2cedf02b15c24f85d1fa17ebe02\nclass _TqdmLoggingHandler(logging.StreamHandler):\n    def emit(self, record: Any) -> None:\n        try:\n            msg = self.format(record)\n            tqdm.write(msg)\n            self.flush()\n        except (KeyboardInterrupt, SystemExit):\n            raise\n        except Exception:\n            self.handleError(record)\n\n\nclass _ProgressBar:\n    \"\"\"Progress Bar implementation for :func:`~optuna.study.Study.optimize` on the top of `tqdm`.\n\n    Args:\n        is_valid:\n            Whether to show progress bars in :func:`~optuna.study.Study.optimize`.\n        n_trials:\n            The number of trials.\n        timeout:\n            Stop study after the given number of second(s).\n    \"\"\"\n\n    def __init__(\n        self,\n        is_valid: bool,\n        n_trials: Optional[int] = None,\n        timeout: Optional[float] = None,\n    ) -> None:\n        self._is_valid = is_valid and (n_trials or timeout) is not None\n        self._n_trials = n_trials\n        self._timeout = timeout\n        self._last_elapsed_seconds = 0.0\n\n        if self._is_valid:\n            if self._n_trials is not None:\n                self._progress_bar = tqdm(total=self._n_trials)\n            elif self._timeout is not None:\n                total = tqdm.format_interval(self._timeout)\n                fmt = \"{desc} {percentage:3.0f}%|{bar}| {elapsed}/\" + total\n                self._progress_bar = tqdm(total=self._timeout, bar_format=fmt)\n            else:\n                assert False\n\n            global _tqdm_handler\n\n            _tqdm_handler = _TqdmLoggingHandler()\n            _tqdm_handler.setLevel(logging.INFO)\n            _tqdm_handler.setFormatter(optuna_logging.create_default_formatter())\n            optuna_logging.disable_default_handler()\n            optuna_logging._get_library_root_logger().addHandler(_tqdm_handler)\n\n    def update(self, elapsed_seconds: float, study: \"Study\") -> None:\n        \"\"\"Update the progress bars if ``is_valid`` is :obj:`True`.\n\n        Args:\n            elapsed_seconds:\n                The time past since :func:`~optuna.study.Study.optimize` started.\n            study:\n                The current study object.\n        \"\"\"\n\n        if self._is_valid:\n            if not study._is_multi_objective():\n                # Not updating the progress bar when there are no complete trial.\n                try:\n                    msg = (\n                        f\"Best trial: {study.best_trial.number}. \"\n                        f\"Best value: {study.best_value:.6g}\"\n                    )\n\n                    self._progress_bar.set_description(msg)\n                except ValueError:\n                    pass\n\n            if self._n_trials is not None:\n                self._progress_bar.update(1)\n                if self._timeout is not None:\n                    self._progress_bar.set_postfix_str(\n                        \"{:.02f}/{} seconds\".format(elapsed_seconds, self._timeout)\n                    )\n\n            elif self._timeout is not None:\n                time_diff = elapsed_seconds - self._last_elapsed_seconds\n                if elapsed_seconds > self._timeout:\n                    # Clip elapsed time to avoid tqdm warnings.\n                    time_diff -= elapsed_seconds - self._timeout\n\n                self._progress_bar.update(time_diff)\n                self._last_elapsed_seconds = elapsed_seconds\n\n            else:\n                assert False\n\n    def close(self) -> None:\n        \"\"\"Close progress bars.\"\"\"\n\n        if self._is_valid:\n            self._progress_bar.close()\n            assert _tqdm_handler is not None\n            optuna_logging._get_library_root_logger().removeHandler(_tqdm_handler)\n            optuna_logging.enable_default_handler()\n", "path": "optuna/progress_bar.py"}]}