We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
TQDM spams lines during validation when running trainer.fit() in notebook
** Environment **
Colab notebook.

<img width="607" alt="TQDM Spam" src="https://user-images.githubusercontent.com/11728034/151625792-31dc2c0e-d572-43d1-9514-5127a6a3751b.png">

** To reproduce

run `trainer.fit()` in a Colab notebook. See [this notebook](https://colab.research.google.com/drive/12Dl0NVDaj4tf4gfpfg-rkIAoO_H7edo3?usp=sharing) for an example.

## Expected behavior

TQDM output should remain on a single line during evaluation, which happens during training.


--- 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/loggers/tqdm_logger.py`
Content:
```
1 # Copyright 2021 MosaicML. All Rights Reserved.
2 
3 from __future__ import annotations
4 
5 import sys
6 from dataclasses import asdict, dataclass
7 from typing import TYPE_CHECKING, Any, Dict, List, Optional
8 
9 import tqdm
10 import yaml
11 
12 from composer.core.logging import LogLevel, TLogData, TLogDataValue, format_log_data_value
13 from composer.core.logging.base_backend import BaseLoggerBackend
14 from composer.core.state import State
15 from composer.core.types import StateDict
16 from composer.utils import dist
17 
18 if TYPE_CHECKING:
19     from composer.core.logging import Logger
20 
21 _IS_TRAIN_TO_KEYS_TO_LOG = {True: ['loss/train'], False: ['accuracy/val']}
22 
23 
24 @dataclass
25 class _TQDMLoggerInstanceState:
26     total: Optional[int]
27     description: str
28     position: int
29     keys_to_log: List[str]
30     n: int
31     epoch_metrics: Dict[str, TLogDataValue]
32 
33 
34 class _TQDMLoggerInstance:
35 
36     def __init__(self, state: _TQDMLoggerInstanceState) -> None:
37         self.state = state
38         self.pbar = tqdm.tqdm(total=state.total,
39                               desc=state.description,
40                               position=state.position,
41                               bar_format="{l_bar}{bar:10}{r_bar}{bar:-10b}")
42         self.pbar.set_postfix(state.epoch_metrics)
43 
44     def log_metric(self, data: TLogData):
45         formatted_data = {k: format_log_data_value(v) for (k, v) in data.items() if k in self.state.keys_to_log}
46         self.state.epoch_metrics.update(formatted_data)
47         self.pbar.set_postfix(self.state.epoch_metrics)
48 
49     def update(self):
50         self.pbar.update()
51         self.state.n = self.pbar.n
52 
53     def close(self):
54         self.pbar.close()
55 
56     def state_dict(self) -> StateDict:
57         return asdict(self.state)
58 
59 
60 class TQDMLoggerBackend(BaseLoggerBackend):
61     """Shows TQDM progress bars.
62 
63     During training, the progress bar logs the batch and training loss.
64     During validation, the progress bar logs the batch and validation accuracy.
65 
66     Example output::
67 
68         Epoch 1: 100%|██████████| 64/64 [00:01<00:00, 53.17it/s, loss/train=2.3023]                                                                                 
69         Epoch 1 (val): 100%|██████████| 20/20 [00:00<00:00, 100.96it/s, accuracy/val=0.0995]  
70 
71     .. note::
72 
73         It is currently not possible to show additional metrics. 
74         Custom metrics for the TQDM progress bar will be supported in a future version.
75 
76     Args:
77         config (dict or None, optional):
78             Trainer configuration. If provided, it is printed to the terminal as YAML.
79     """
80 
81     def __init__(self, config: Optional[Dict[str, Any]] = None) -> None:
82         super().__init__()
83         self.pbars: Dict[bool, _TQDMLoggerInstance] = {}
84         self.is_train: Optional[bool] = None
85         self.config = config
86 
87     def will_log(self, state: State, log_level: LogLevel) -> bool:
88         del state  # Unused
89         return dist.get_global_rank() == 0 and log_level <= LogLevel.BATCH
90 
91     def log_metric(self, epoch: int, step: int, log_level: LogLevel, data: TLogData) -> None:
92         del epoch, step, log_level  # Unused
93         if self.is_train in self.pbars:
94             # Logging outside an epoch
95             assert self.is_train is not None
96             self.pbars[self.is_train].log_metric(data)
97 
98     def init(self, state: State, logger: Logger) -> None:
99         del state, logger  # unused
100         if self.config is not None:
101             print("Config")
102             print("-" * 30)
103             yaml.safe_dump(self.config, stream=sys.stdout)
104             print("-" * 30)
105             print()
106 
107     def _start(self, state: State):
108         if dist.get_global_rank() != 0:
109             return
110         assert self.is_train is not None, "self.is_train should be set by the callback"
111         # TODO(anis) -- in #120, len(state.eval_dataloader) is inaccurate, as it does not incorporate
112         # trainer._eval_subset_num_batches. The evaluator spec should fix this.
113         total_steps = state.steps_per_epoch if self.is_train else len(state.eval_dataloader)
114         desc = f'Epoch {int(state.timer.epoch)}'
115         position = 0 if self.is_train else 1
116         if not self.is_train:
117             desc += f", Batch {int(state.timer.batch)} (val)"
118         self.pbars[self.is_train] = _TQDMLoggerInstance(
119             _TQDMLoggerInstanceState(total=total_steps,
120                                      position=position,
121                                      n=0,
122                                      keys_to_log=_IS_TRAIN_TO_KEYS_TO_LOG[self.is_train],
123                                      description=desc,
124                                      epoch_metrics={}))
125 
126     def epoch_start(self, state: State, logger: Logger) -> None:
127         del logger  # unused
128         if dist.get_global_rank() != 0:
129             return
130         self.is_train = True
131         self._start(state)
132 
133     def eval_start(self, state: State, logger: Logger) -> None:
134         del logger  # unused
135         if dist.get_global_rank() != 0:
136             return
137         self.is_train = False
138         self._start(state)
139 
140     def _update(self):
141         if dist.get_global_rank() != 0:
142             return
143         if self.is_train in self.pbars:
144             assert self.is_train is not None
145             self.pbars[self.is_train].update()
146 
147     def batch_end(self, state: State, logger: Logger) -> None:
148         del state, logger  # unused
149         if dist.get_global_rank() != 0:
150             return
151         self._update()
152 
153     def eval_after_forward(self, state: State, logger: Logger) -> None:
154         del state, logger  # unused
155         if dist.get_global_rank() != 0:
156             return
157         self._update()
158 
159     def _end(self):
160         if dist.get_global_rank() != 0:
161             return
162         if self.is_train in self.pbars:
163             assert self.is_train is not None
164             self.pbars[self.is_train].close()
165             del self.pbars[self.is_train]
166             self.is_train = None
167 
168     def epoch_end(self, state: State, logger: Logger) -> None:
169         del state, logger  # unused
170         if dist.get_global_rank() != 0:
171             return
172         self._end()
173 
174     def eval_end(self, state: State, logger: Logger) -> None:
175         del state, logger  # unused
176         if dist.get_global_rank() != 0:
177             return
178         self._end()
179 
180     def state_dict(self) -> StateDict:
181         return {
182             "pbars": {k: v.state_dict() for (k, v) in self.pbars.items()},
183             "is_train": self.is_train,
184         }
185 
186     def load_state_dict(self, state: StateDict) -> None:
187         self.pbars = {k: _TQDMLoggerInstance(**v) for (k, v) in state["pbars"].items()}
188         self.is_train = state["is_train"]
189
```
--- 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/loggers/tqdm_logger.py b/composer/loggers/tqdm_logger.py
--- a/composer/loggers/tqdm_logger.py
+++ b/composer/loggers/tqdm_logger.py
@@ -6,8 +6,8 @@
 from dataclasses import asdict, dataclass
 from typing import TYPE_CHECKING, Any, Dict, List, Optional
 
-import tqdm
 import yaml
+from tqdm import auto
 
 from composer.core.logging import LogLevel, TLogData, TLogDataValue, format_log_data_value
 from composer.core.logging.base_backend import BaseLoggerBackend
@@ -35,7 +35,7 @@
 
     def __init__(self, state: _TQDMLoggerInstanceState) -> None:
         self.state = state
-        self.pbar = tqdm.tqdm(total=state.total,
+        self.pbar = auto.tqdm(total=state.total,
                               desc=state.description,
                               position=state.position,
                               bar_format="{l_bar}{bar:10}{r_bar}{bar:-10b}")
@@ -65,12 +65,12 @@
 
     Example output::
 
-        Epoch 1: 100%|██████████| 64/64 [00:01<00:00, 53.17it/s, loss/train=2.3023]                                                                                 
-        Epoch 1 (val): 100%|██████████| 20/20 [00:00<00:00, 100.96it/s, accuracy/val=0.0995]  
+        Epoch 1: 100%|██████████| 64/64 [00:01<00:00, 53.17it/s, loss/train=2.3023]
+        Epoch 1 (val): 100%|██████████| 20/20 [00:00<00:00, 100.96it/s, accuracy/val=0.0995]
 
     .. note::
 
-        It is currently not possible to show additional metrics. 
+        It is currently not possible to show additional metrics.
         Custom metrics for the TQDM progress bar will be supported in a future version.
 
     Args:

{"golden_diff": "diff --git a/composer/loggers/tqdm_logger.py b/composer/loggers/tqdm_logger.py\n--- a/composer/loggers/tqdm_logger.py\n+++ b/composer/loggers/tqdm_logger.py\n@@ -6,8 +6,8 @@\n from dataclasses import asdict, dataclass\n from typing import TYPE_CHECKING, Any, Dict, List, Optional\n \n-import tqdm\n import yaml\n+from tqdm import auto\n \n from composer.core.logging import LogLevel, TLogData, TLogDataValue, format_log_data_value\n from composer.core.logging.base_backend import BaseLoggerBackend\n@@ -35,7 +35,7 @@\n \n     def __init__(self, state: _TQDMLoggerInstanceState) -> None:\n         self.state = state\n-        self.pbar = tqdm.tqdm(total=state.total,\n+        self.pbar = auto.tqdm(total=state.total,\n                               desc=state.description,\n                               position=state.position,\n                               bar_format=\"{l_bar}{bar:10}{r_bar}{bar:-10b}\")\n@@ -65,12 +65,12 @@\n \n     Example output::\n \n-        Epoch 1: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 64/64 [00:01<00:00, 53.17it/s, loss/train=2.3023]                                                                                 \n-        Epoch 1 (val): 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 20/20 [00:00<00:00, 100.96it/s, accuracy/val=0.0995]  \n+        Epoch 1: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 64/64 [00:01<00:00, 53.17it/s, loss/train=2.3023]\n+        Epoch 1 (val): 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 20/20 [00:00<00:00, 100.96it/s, accuracy/val=0.0995]\n \n     .. note::\n \n-        It is currently not possible to show additional metrics. \n+        It is currently not possible to show additional metrics.\n         Custom metrics for the TQDM progress bar will be supported in a future version.\n \n     Args:\n", "issue": "TQDM spams lines during validation when running trainer.fit() in notebook\n** Environment **\r\nColab notebook.\r\n\r\n<img width=\"607\" alt=\"TQDM Spam\" src=\"https://user-images.githubusercontent.com/11728034/151625792-31dc2c0e-d572-43d1-9514-5127a6a3751b.png\">\r\n\r\n** To reproduce\r\n\r\nrun `trainer.fit()` in a Colab notebook. See [this notebook](https://colab.research.google.com/drive/12Dl0NVDaj4tf4gfpfg-rkIAoO_H7edo3?usp=sharing) for an example.\r\n\r\n## Expected behavior\r\n\r\nTQDM output should remain on a single line during evaluation, which happens during training.\r\n\n", "before_files": [{"content": "# Copyright 2021 MosaicML. All Rights Reserved.\n\nfrom __future__ import annotations\n\nimport sys\nfrom dataclasses import asdict, dataclass\nfrom typing import TYPE_CHECKING, Any, Dict, List, Optional\n\nimport tqdm\nimport yaml\n\nfrom composer.core.logging import LogLevel, TLogData, TLogDataValue, format_log_data_value\nfrom composer.core.logging.base_backend import BaseLoggerBackend\nfrom composer.core.state import State\nfrom composer.core.types import StateDict\nfrom composer.utils import dist\n\nif TYPE_CHECKING:\n    from composer.core.logging import Logger\n\n_IS_TRAIN_TO_KEYS_TO_LOG = {True: ['loss/train'], False: ['accuracy/val']}\n\n\n@dataclass\nclass _TQDMLoggerInstanceState:\n    total: Optional[int]\n    description: str\n    position: int\n    keys_to_log: List[str]\n    n: int\n    epoch_metrics: Dict[str, TLogDataValue]\n\n\nclass _TQDMLoggerInstance:\n\n    def __init__(self, state: _TQDMLoggerInstanceState) -> None:\n        self.state = state\n        self.pbar = tqdm.tqdm(total=state.total,\n                              desc=state.description,\n                              position=state.position,\n                              bar_format=\"{l_bar}{bar:10}{r_bar}{bar:-10b}\")\n        self.pbar.set_postfix(state.epoch_metrics)\n\n    def log_metric(self, data: TLogData):\n        formatted_data = {k: format_log_data_value(v) for (k, v) in data.items() if k in self.state.keys_to_log}\n        self.state.epoch_metrics.update(formatted_data)\n        self.pbar.set_postfix(self.state.epoch_metrics)\n\n    def update(self):\n        self.pbar.update()\n        self.state.n = self.pbar.n\n\n    def close(self):\n        self.pbar.close()\n\n    def state_dict(self) -> StateDict:\n        return asdict(self.state)\n\n\nclass TQDMLoggerBackend(BaseLoggerBackend):\n    \"\"\"Shows TQDM progress bars.\n\n    During training, the progress bar logs the batch and training loss.\n    During validation, the progress bar logs the batch and validation accuracy.\n\n    Example output::\n\n        Epoch 1: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 64/64 [00:01<00:00, 53.17it/s, loss/train=2.3023]                                                                                 \n        Epoch 1 (val): 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 20/20 [00:00<00:00, 100.96it/s, accuracy/val=0.0995]  \n\n    .. note::\n\n        It is currently not possible to show additional metrics. \n        Custom metrics for the TQDM progress bar will be supported in a future version.\n\n    Args:\n        config (dict or None, optional):\n            Trainer configuration. If provided, it is printed to the terminal as YAML.\n    \"\"\"\n\n    def __init__(self, config: Optional[Dict[str, Any]] = None) -> None:\n        super().__init__()\n        self.pbars: Dict[bool, _TQDMLoggerInstance] = {}\n        self.is_train: Optional[bool] = None\n        self.config = config\n\n    def will_log(self, state: State, log_level: LogLevel) -> bool:\n        del state  # Unused\n        return dist.get_global_rank() == 0 and log_level <= LogLevel.BATCH\n\n    def log_metric(self, epoch: int, step: int, log_level: LogLevel, data: TLogData) -> None:\n        del epoch, step, log_level  # Unused\n        if self.is_train in self.pbars:\n            # Logging outside an epoch\n            assert self.is_train is not None\n            self.pbars[self.is_train].log_metric(data)\n\n    def init(self, state: State, logger: Logger) -> None:\n        del state, logger  # unused\n        if self.config is not None:\n            print(\"Config\")\n            print(\"-\" * 30)\n            yaml.safe_dump(self.config, stream=sys.stdout)\n            print(\"-\" * 30)\n            print()\n\n    def _start(self, state: State):\n        if dist.get_global_rank() != 0:\n            return\n        assert self.is_train is not None, \"self.is_train should be set by the callback\"\n        # TODO(anis) -- in #120, len(state.eval_dataloader) is inaccurate, as it does not incorporate\n        # trainer._eval_subset_num_batches. The evaluator spec should fix this.\n        total_steps = state.steps_per_epoch if self.is_train else len(state.eval_dataloader)\n        desc = f'Epoch {int(state.timer.epoch)}'\n        position = 0 if self.is_train else 1\n        if not self.is_train:\n            desc += f\", Batch {int(state.timer.batch)} (val)\"\n        self.pbars[self.is_train] = _TQDMLoggerInstance(\n            _TQDMLoggerInstanceState(total=total_steps,\n                                     position=position,\n                                     n=0,\n                                     keys_to_log=_IS_TRAIN_TO_KEYS_TO_LOG[self.is_train],\n                                     description=desc,\n                                     epoch_metrics={}))\n\n    def epoch_start(self, state: State, logger: Logger) -> None:\n        del logger  # unused\n        if dist.get_global_rank() != 0:\n            return\n        self.is_train = True\n        self._start(state)\n\n    def eval_start(self, state: State, logger: Logger) -> None:\n        del logger  # unused\n        if dist.get_global_rank() != 0:\n            return\n        self.is_train = False\n        self._start(state)\n\n    def _update(self):\n        if dist.get_global_rank() != 0:\n            return\n        if self.is_train in self.pbars:\n            assert self.is_train is not None\n            self.pbars[self.is_train].update()\n\n    def batch_end(self, state: State, logger: Logger) -> None:\n        del state, logger  # unused\n        if dist.get_global_rank() != 0:\n            return\n        self._update()\n\n    def eval_after_forward(self, state: State, logger: Logger) -> None:\n        del state, logger  # unused\n        if dist.get_global_rank() != 0:\n            return\n        self._update()\n\n    def _end(self):\n        if dist.get_global_rank() != 0:\n            return\n        if self.is_train in self.pbars:\n            assert self.is_train is not None\n            self.pbars[self.is_train].close()\n            del self.pbars[self.is_train]\n            self.is_train = None\n\n    def epoch_end(self, state: State, logger: Logger) -> None:\n        del state, logger  # unused\n        if dist.get_global_rank() != 0:\n            return\n        self._end()\n\n    def eval_end(self, state: State, logger: Logger) -> None:\n        del state, logger  # unused\n        if dist.get_global_rank() != 0:\n            return\n        self._end()\n\n    def state_dict(self) -> StateDict:\n        return {\n            \"pbars\": {k: v.state_dict() for (k, v) in self.pbars.items()},\n            \"is_train\": self.is_train,\n        }\n\n    def load_state_dict(self, state: StateDict) -> None:\n        self.pbars = {k: _TQDMLoggerInstance(**v) for (k, v) in state[\"pbars\"].items()}\n        self.is_train = state[\"is_train\"]\n", "path": "composer/loggers/tqdm_logger.py"}], "after_files": [{"content": "# Copyright 2021 MosaicML. All Rights Reserved.\n\nfrom __future__ import annotations\n\nimport sys\nfrom dataclasses import asdict, dataclass\nfrom typing import TYPE_CHECKING, Any, Dict, List, Optional\n\nimport yaml\nfrom tqdm import auto\n\nfrom composer.core.logging import LogLevel, TLogData, TLogDataValue, format_log_data_value\nfrom composer.core.logging.base_backend import BaseLoggerBackend\nfrom composer.core.state import State\nfrom composer.core.types import StateDict\nfrom composer.utils import dist\n\nif TYPE_CHECKING:\n    from composer.core.logging import Logger\n\n_IS_TRAIN_TO_KEYS_TO_LOG = {True: ['loss/train'], False: ['accuracy/val']}\n\n\n@dataclass\nclass _TQDMLoggerInstanceState:\n    total: Optional[int]\n    description: str\n    position: int\n    keys_to_log: List[str]\n    n: int\n    epoch_metrics: Dict[str, TLogDataValue]\n\n\nclass _TQDMLoggerInstance:\n\n    def __init__(self, state: _TQDMLoggerInstanceState) -> None:\n        self.state = state\n        self.pbar = auto.tqdm(total=state.total,\n                              desc=state.description,\n                              position=state.position,\n                              bar_format=\"{l_bar}{bar:10}{r_bar}{bar:-10b}\")\n        self.pbar.set_postfix(state.epoch_metrics)\n\n    def log_metric(self, data: TLogData):\n        formatted_data = {k: format_log_data_value(v) for (k, v) in data.items() if k in self.state.keys_to_log}\n        self.state.epoch_metrics.update(formatted_data)\n        self.pbar.set_postfix(self.state.epoch_metrics)\n\n    def update(self):\n        self.pbar.update()\n        self.state.n = self.pbar.n\n\n    def close(self):\n        self.pbar.close()\n\n    def state_dict(self) -> StateDict:\n        return asdict(self.state)\n\n\nclass TQDMLoggerBackend(BaseLoggerBackend):\n    \"\"\"Shows TQDM progress bars.\n\n    During training, the progress bar logs the batch and training loss.\n    During validation, the progress bar logs the batch and validation accuracy.\n\n    Example output::\n\n        Epoch 1: 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 64/64 [00:01<00:00, 53.17it/s, loss/train=2.3023]\n        Epoch 1 (val): 100%|\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| 20/20 [00:00<00:00, 100.96it/s, accuracy/val=0.0995]\n\n    .. note::\n\n        It is currently not possible to show additional metrics.\n        Custom metrics for the TQDM progress bar will be supported in a future version.\n\n    Args:\n        config (dict or None, optional):\n            Trainer configuration. If provided, it is printed to the terminal as YAML.\n    \"\"\"\n\n    def __init__(self, config: Optional[Dict[str, Any]] = None) -> None:\n        super().__init__()\n        self.pbars: Dict[bool, _TQDMLoggerInstance] = {}\n        self.is_train: Optional[bool] = None\n        self.config = config\n\n    def will_log(self, state: State, log_level: LogLevel) -> bool:\n        del state  # Unused\n        return dist.get_global_rank() == 0 and log_level <= LogLevel.BATCH\n\n    def log_metric(self, epoch: int, step: int, log_level: LogLevel, data: TLogData) -> None:\n        del epoch, step, log_level  # Unused\n        if self.is_train in self.pbars:\n            # Logging outside an epoch\n            assert self.is_train is not None\n            self.pbars[self.is_train].log_metric(data)\n\n    def init(self, state: State, logger: Logger) -> None:\n        del state, logger  # unused\n        if self.config is not None:\n            print(\"Config\")\n            print(\"-\" * 30)\n            yaml.safe_dump(self.config, stream=sys.stdout)\n            print(\"-\" * 30)\n            print()\n\n    def _start(self, state: State):\n        if dist.get_global_rank() != 0:\n            return\n        assert self.is_train is not None, \"self.is_train should be set by the callback\"\n        # TODO(anis) -- in #120, len(state.eval_dataloader) is inaccurate, as it does not incorporate\n        # trainer._eval_subset_num_batches. The evaluator spec should fix this.\n        total_steps = state.steps_per_epoch if self.is_train else len(state.eval_dataloader)\n        desc = f'Epoch {int(state.timer.epoch)}'\n        position = 0 if self.is_train else 1\n        if not self.is_train:\n            desc += f\", Batch {int(state.timer.batch)} (val)\"\n        self.pbars[self.is_train] = _TQDMLoggerInstance(\n            _TQDMLoggerInstanceState(total=total_steps,\n                                     position=position,\n                                     n=0,\n                                     keys_to_log=_IS_TRAIN_TO_KEYS_TO_LOG[self.is_train],\n                                     description=desc,\n                                     epoch_metrics={}))\n\n    def epoch_start(self, state: State, logger: Logger) -> None:\n        del logger  # unused\n        if dist.get_global_rank() != 0:\n            return\n        self.is_train = True\n        self._start(state)\n\n    def eval_start(self, state: State, logger: Logger) -> None:\n        del logger  # unused\n        if dist.get_global_rank() != 0:\n            return\n        self.is_train = False\n        self._start(state)\n\n    def _update(self):\n        if dist.get_global_rank() != 0:\n            return\n        if self.is_train in self.pbars:\n            assert self.is_train is not None\n            self.pbars[self.is_train].update()\n\n    def batch_end(self, state: State, logger: Logger) -> None:\n        del state, logger  # unused\n        if dist.get_global_rank() != 0:\n            return\n        self._update()\n\n    def eval_after_forward(self, state: State, logger: Logger) -> None:\n        del state, logger  # unused\n        if dist.get_global_rank() != 0:\n            return\n        self._update()\n\n    def _end(self):\n        if dist.get_global_rank() != 0:\n            return\n        if self.is_train in self.pbars:\n            assert self.is_train is not None\n            self.pbars[self.is_train].close()\n            del self.pbars[self.is_train]\n            self.is_train = None\n\n    def epoch_end(self, state: State, logger: Logger) -> None:\n        del state, logger  # unused\n        if dist.get_global_rank() != 0:\n            return\n        self._end()\n\n    def eval_end(self, state: State, logger: Logger) -> None:\n        del state, logger  # unused\n        if dist.get_global_rank() != 0:\n            return\n        self._end()\n\n    def state_dict(self) -> StateDict:\n        return {\n            \"pbars\": {k: v.state_dict() for (k, v) in self.pbars.items()},\n            \"is_train\": self.is_train,\n        }\n\n    def load_state_dict(self, state: StateDict) -> None:\n        self.pbars = {k: _TQDMLoggerInstance(**v) for (k, v) in state[\"pbars\"].items()}\n        self.is_train = state[\"is_train\"]\n", "path": "composer/loggers/tqdm_logger.py"}]}