prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Add more logging to the pytorch lighning models.
  The feature consists of two parts:
    1. Add the validation loss to the progress bar by default
    2. Create boolean parameter for extended progress bar logging (showing the different components of the loss)
  
  </issue>
  <code>
  [start of icevision/engines/lightning/lightning_model_adapter.py]
  1 __all__ = ["LightningModelAdapter"]
  2 
  3 import pytorch_lightning as pl
  4 from icevision.imports import *
  5 from icevision.metrics import *
  6 
  7 
  8 class LightningModelAdapter(pl.LightningModule, ABC):
  9     def __init__(self, metrics: List[Metric] = None):
  10         super().__init__()
  11         self.metrics = metrics or []
  12 
  13     def accumulate_metrics(self, preds):
  14         for metric in self.metrics:
  15             metric.accumulate(preds=preds)
  16 
  17     def finalize_metrics(self) -> None:
  18         for metric in self.metrics:
  19             metric_logs = metric.finalize()
  20             for k, v in metric_logs.items():
  21                 self.log(f"{metric.name}/{k}", v)
  22
  [end of icevision/engines/lightning/lightning_model_adapter.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/icevision/engines/lightning/lightning_model_adapter.py b/icevision/engines/lightning/lightning_model_adapter.py
  --- a/icevision/engines/lightning/lightning_model_adapter.py
  +++ b/icevision/engines/lightning/lightning_model_adapter.py
  @@ -6,9 +6,21 @@
   
   
   class LightningModelAdapter(pl.LightningModule, ABC):
  -    def __init__(self, metrics: List[Metric] = None):
  +    def __init__(
  +        self,
  +        metrics: List[Metric] = None,
  +        metrics_keys_to_log_to_prog_bar: List[tuple] = None,
  +    ):
  +        """
  +        To show a metric in the progressbar a list of tupels can be provided for metrics_keys_to_log_to_prog_bar, the first
  +        entry has to be the name of the metric to log and the second entry the display name in the progressbar. By default the
  +        mAP is logged to the progressbar.
  +        """
           super().__init__()
           self.metrics = metrics or []
  +        self.metrics_keys_to_log_to_prog_bar = metrics_keys_to_log_to_prog_bar or [
  +            ("AP (IoU=0.50:0.95) area=all", "COCOMetric")
  +        ]
   
       def accumulate_metrics(self, preds):
           for metric in self.metrics:
  @@ -18,4 +30,9 @@
           for metric in self.metrics:
               metric_logs = metric.finalize()
               for k, v in metric_logs.items():
  -                self.log(f"{metric.name}/{k}", v)
  +                for entry in self.metrics_keys_to_log_to_prog_bar:
  +                    if entry[0] == k:
  +                        self.log(entry[1], v, prog_bar=True)
  +                        self.log(f"{metric.name}/{k}", v)
  +                    else:
  +                        self.log(f"{metric.name}/{k}", v)
  
verification_info: {"golden_diff": "diff --git a/icevision/engines/lightning/lightning_model_adapter.py b/icevision/engines/lightning/lightning_model_adapter.py\n--- a/icevision/engines/lightning/lightning_model_adapter.py\n+++ b/icevision/engines/lightning/lightning_model_adapter.py\n@@ -6,9 +6,21 @@\n \n \n class LightningModelAdapter(pl.LightningModule, ABC):\n-    def __init__(self, metrics: List[Metric] = None):\n+    def __init__(\n+        self,\n+        metrics: List[Metric] = None,\n+        metrics_keys_to_log_to_prog_bar: List[tuple] = None,\n+    ):\n+        \"\"\"\n+        To show a metric in the progressbar a list of tupels can be provided for metrics_keys_to_log_to_prog_bar, the first\n+        entry has to be the name of the metric to log and the second entry the display name in the progressbar. By default the\n+        mAP is logged to the progressbar.\n+        \"\"\"\n         super().__init__()\n         self.metrics = metrics or []\n+        self.metrics_keys_to_log_to_prog_bar = metrics_keys_to_log_to_prog_bar or [\n+            (\"AP (IoU=0.50:0.95) area=all\", \"COCOMetric\")\n+        ]\n \n     def accumulate_metrics(self, preds):\n         for metric in self.metrics:\n@@ -18,4 +30,9 @@\n         for metric in self.metrics:\n             metric_logs = metric.finalize()\n             for k, v in metric_logs.items():\n-                self.log(f\"{metric.name}/{k}\", v)\n+                for entry in self.metrics_keys_to_log_to_prog_bar:\n+                    if entry[0] == k:\n+                        self.log(entry[1], v, prog_bar=True)\n+                        self.log(f\"{metric.name}/{k}\", v)\n+                    else:\n+                        self.log(f\"{metric.name}/{k}\", v)\n", "issue": "Add more logging to the pytorch lighning models.\nThe feature consists of two parts:\r\n  1. Add the validation loss to the progress bar by default\r\n  2. Create boolean parameter for extended progress bar logging (showing the different components of the loss)\n", "before_files": [{"content": "__all__ = [\"LightningModelAdapter\"]\n\nimport pytorch_lightning as pl\nfrom icevision.imports import *\nfrom icevision.metrics import *\n\n\nclass LightningModelAdapter(pl.LightningModule, ABC):\n    def __init__(self, metrics: List[Metric] = None):\n        super().__init__()\n        self.metrics = metrics or []\n\n    def accumulate_metrics(self, preds):\n        for metric in self.metrics:\n            metric.accumulate(preds=preds)\n\n    def finalize_metrics(self) -> None:\n        for metric in self.metrics:\n            metric_logs = metric.finalize()\n            for k, v in metric_logs.items():\n                self.log(f\"{metric.name}/{k}\", v)\n", "path": "icevision/engines/lightning/lightning_model_adapter.py"}]}