We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
dvclive.error
### Search before asking

- [X] I have searched the YOLOv8 [issues](https://github.com/ultralytics/ultralytics/issues) and found no similar bug report.


### YOLOv8 Component

Training

### Bug

Hello,
I have used several time the YOLOV8 without problem.
Today, I tried to retrain my model and I updated the ultralytics packages and when I started the training, i got this error:

      Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/engine/model.py", line 371, in train
        self.trainer.train()
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/engine/trainer.py", line 192, in train
        self._do_train(world_size)
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/engine/trainer.py", line 275, in _do_train
        self._setup_train(world_size)
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/engine/trainer.py", line 268, in _setup_train
        self.run_callbacks('on_pretrain_routine_end')
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/engine/trainer.py", line 165, in run_callbacks
        callback(self)
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/utils/callbacks/dvc.py", line 76, in on_pretrain_routine_end
        _log_plots(trainer.plots, 'train')
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/utils/callbacks/dvc.py", line 40, in _log_plots
        _log_images(name, prefix)
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/utils/callbacks/dvc.py", line 33, in _log_images
        live.log_image(os.path.join(prefix, image_path.name), image_path)
      File "/home/jupyter-moussa/.local/lib/python3.9/site-packages/dvclive/live.py", line 249, in log_image
        raise InvalidDataTypeError(name, type(val))
    dvclive.error.InvalidDataTypeError: Data 'train/labels.jpg' has not supported type <class 'pathlib.PosixPath'>

what do you think about it?

Thank you.

### Environment

ultralytics              8.0.114
torch                    2.0.1
torchaudio               0.13.1
torchvision              0.15.2
Ubuntu 22.04.1 LTS

### Minimal Reproducible Example

_No response_

### Additional

_No response_

### Are you willing to submit a PR?

- [ ] Yes I'd like to help by submitting a PR!

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ultralytics/yolo/utils/callbacks/dvc.py`
Content:
```
1 # Ultralytics YOLO 🚀, GPL-3.0 license
2 import os
3 
4 from ultralytics.yolo.utils import LOGGER, TESTS_RUNNING
5 from ultralytics.yolo.utils.torch_utils import get_flops, get_num_params
6 
7 try:
8     from importlib.metadata import version
9 
10     import dvclive
11 
12     assert not TESTS_RUNNING  # do not log pytest
13     assert version('dvclive')
14 except (ImportError, AssertionError):
15     dvclive = None
16 
17 # DVCLive logger instance
18 live = None
19 _processed_plots = {}
20 
21 # `on_fit_epoch_end` is called on final validation (probably need to be fixed)
22 # for now this is the way we distinguish final evaluation of the best model vs
23 # last epoch validation
24 _training_epoch = False
25 
26 
27 def _logger_disabled():
28     return os.getenv('ULTRALYTICS_DVC_DISABLED', 'false').lower() == 'true'
29 
30 
31 def _log_images(image_path, prefix=''):
32     if live:
33         live.log_image(os.path.join(prefix, image_path.name), image_path)
34 
35 
36 def _log_plots(plots, prefix=''):
37     for name, params in plots.items():
38         timestamp = params['timestamp']
39         if _processed_plots.get(name, None) != timestamp:
40             _log_images(name, prefix)
41             _processed_plots[name] = timestamp
42 
43 
44 def _log_confusion_matrix(validator):
45     targets = []
46     preds = []
47     matrix = validator.confusion_matrix.matrix
48     names = list(validator.names.values())
49     if validator.confusion_matrix.task == 'detect':
50         names += ['background']
51 
52     for ti, pred in enumerate(matrix.T.astype(int)):
53         for pi, num in enumerate(pred):
54             targets.extend([names[ti]] * num)
55             preds.extend([names[pi]] * num)
56 
57     live.log_sklearn_plot('confusion_matrix', targets, preds, name='cf.json', normalized=True)
58 
59 
60 def on_pretrain_routine_start(trainer):
61     try:
62         global live
63         if not _logger_disabled():
64             live = dvclive.Live(save_dvc_exp=True)
65             LOGGER.info(
66                 'DVCLive is detected and auto logging is enabled (can be disabled with `ULTRALYTICS_DVC_DISABLED=true`).'
67             )
68         else:
69             LOGGER.debug('DVCLive is detected and auto logging is disabled via `ULTRALYTICS_DVC_DISABLED`.')
70             live = None
71     except Exception as e:
72         LOGGER.warning(f'WARNING ⚠️ DVCLive installed but not initialized correctly, not logging this run. {e}')
73 
74 
75 def on_pretrain_routine_end(trainer):
76     _log_plots(trainer.plots, 'train')
77 
78 
79 def on_train_start(trainer):
80     if live:
81         live.log_params(trainer.args)
82 
83 
84 def on_train_epoch_start(trainer):
85     global _training_epoch
86     _training_epoch = True
87 
88 
89 def on_fit_epoch_end(trainer):
90     global _training_epoch
91     if live and _training_epoch:
92         all_metrics = {**trainer.label_loss_items(trainer.tloss, prefix='train'), **trainer.metrics, **trainer.lr}
93         for metric, value in all_metrics.items():
94             live.log_metric(metric, value)
95 
96         if trainer.epoch == 0:
97             model_info = {
98                 'model/parameters': get_num_params(trainer.model),
99                 'model/GFLOPs': round(get_flops(trainer.model), 3),
100                 'model/speed(ms)': round(trainer.validator.speed['inference'], 3)}
101 
102             for metric, value in model_info.items():
103                 live.log_metric(metric, value, plot=False)
104 
105         _log_plots(trainer.plots, 'train')
106         _log_plots(trainer.validator.plots, 'val')
107 
108         live.next_step()
109         _training_epoch = False
110 
111 
112 def on_train_end(trainer):
113     if live:
114         # At the end log the best metrics. It runs validator on the best model internally.
115         all_metrics = {**trainer.label_loss_items(trainer.tloss, prefix='train'), **trainer.metrics, **trainer.lr}
116         for metric, value in all_metrics.items():
117             live.log_metric(metric, value, plot=False)
118 
119         _log_plots(trainer.plots, 'eval')
120         _log_plots(trainer.validator.plots, 'eval')
121         _log_confusion_matrix(trainer.validator)
122 
123         if trainer.best.exists():
124             live.log_artifact(trainer.best, copy=True)
125 
126         live.end()
127 
128 
129 callbacks = {
130     'on_pretrain_routine_start': on_pretrain_routine_start,
131     'on_pretrain_routine_end': on_pretrain_routine_end,
132     'on_train_start': on_train_start,
133     'on_train_epoch_start': on_train_epoch_start,
134     'on_fit_epoch_end': on_fit_epoch_end,
135     'on_train_end': on_train_end} if dvclive else {}
136
```
--- 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/ultralytics/yolo/utils/callbacks/dvc.py b/ultralytics/yolo/utils/callbacks/dvc.py
--- a/ultralytics/yolo/utils/callbacks/dvc.py
+++ b/ultralytics/yolo/utils/callbacks/dvc.py
@@ -1,6 +1,8 @@
 # Ultralytics YOLO 🚀, GPL-3.0 license
 import os
 
+import pkg_resources as pkg
+
 from ultralytics.yolo.utils import LOGGER, TESTS_RUNNING
 from ultralytics.yolo.utils.torch_utils import get_flops, get_num_params
 
@@ -10,8 +12,12 @@
     import dvclive
 
     assert not TESTS_RUNNING  # do not log pytest
-    assert version('dvclive')
-except (ImportError, AssertionError):
+
+    ver = version('dvclive')
+    if pkg.parse_version(ver) < pkg.parse_version('2.11.0'):
+        LOGGER.debug(f'DVCLive is detected but version {ver} is incompatible (>=2.11 required).')
+        dvclive = None  # noqa: F811
+except (ImportError, AssertionError, TypeError):
     dvclive = None
 
 # DVCLive logger instance

{"golden_diff": "diff --git a/ultralytics/yolo/utils/callbacks/dvc.py b/ultralytics/yolo/utils/callbacks/dvc.py\n--- a/ultralytics/yolo/utils/callbacks/dvc.py\n+++ b/ultralytics/yolo/utils/callbacks/dvc.py\n@@ -1,6 +1,8 @@\n # Ultralytics YOLO \ud83d\ude80, GPL-3.0 license\n import os\n \n+import pkg_resources as pkg\n+\n from ultralytics.yolo.utils import LOGGER, TESTS_RUNNING\n from ultralytics.yolo.utils.torch_utils import get_flops, get_num_params\n \n@@ -10,8 +12,12 @@\n     import dvclive\n \n     assert not TESTS_RUNNING  # do not log pytest\n-    assert version('dvclive')\n-except (ImportError, AssertionError):\n+\n+    ver = version('dvclive')\n+    if pkg.parse_version(ver) < pkg.parse_version('2.11.0'):\n+        LOGGER.debug(f'DVCLive is detected but version {ver} is incompatible (>=2.11 required).')\n+        dvclive = None  # noqa: F811\n+except (ImportError, AssertionError, TypeError):\n     dvclive = None\n \n # DVCLive logger instance\n", "issue": "dvclive.error\n### Search before asking\n\n- [X] I have searched the YOLOv8 [issues](https://github.com/ultralytics/ultralytics/issues) and found no similar bug report.\n\n\n### YOLOv8 Component\n\nTraining\n\n### Bug\n\nHello,\r\nI have used several time the YOLOV8 without problem.\r\nToday, I tried to retrain my model and I updated the ultralytics packages and when I started the training, i got this error:\r\n\r\n      Traceback (most recent call last):\r\n      File \"<stdin>\", line 1, in <module>\r\n      File \"/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/engine/model.py\", line 371, in train\r\n        self.trainer.train()\r\n      File \"/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/engine/trainer.py\", line 192, in train\r\n        self._do_train(world_size)\r\n      File \"/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/engine/trainer.py\", line 275, in _do_train\r\n        self._setup_train(world_size)\r\n      File \"/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/engine/trainer.py\", line 268, in _setup_train\r\n        self.run_callbacks('on_pretrain_routine_end')\r\n      File \"/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/engine/trainer.py\", line 165, in run_callbacks\r\n        callback(self)\r\n      File \"/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/utils/callbacks/dvc.py\", line 76, in on_pretrain_routine_end\r\n        _log_plots(trainer.plots, 'train')\r\n      File \"/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/utils/callbacks/dvc.py\", line 40, in _log_plots\r\n        _log_images(name, prefix)\r\n      File \"/home/jupyter-moussa/.local/lib/python3.9/site-packages/ultralytics/yolo/utils/callbacks/dvc.py\", line 33, in _log_images\r\n        live.log_image(os.path.join(prefix, image_path.name), image_path)\r\n      File \"/home/jupyter-moussa/.local/lib/python3.9/site-packages/dvclive/live.py\", line 249, in log_image\r\n        raise InvalidDataTypeError(name, type(val))\r\n    dvclive.error.InvalidDataTypeError: Data 'train/labels.jpg' has not supported type <class 'pathlib.PosixPath'>\r\n\r\nwhat do you think about it?\r\n\r\nThank you.\n\n### Environment\n\nultralytics              8.0.114\r\ntorch                    2.0.1\r\ntorchaudio               0.13.1\r\ntorchvision              0.15.2\r\nUbuntu 22.04.1 LTS\n\n### Minimal Reproducible Example\n\n_No response_\n\n### Additional\n\n_No response_\n\n### Are you willing to submit a PR?\n\n- [ ] Yes I'd like to help by submitting a PR!\n", "before_files": [{"content": "# Ultralytics YOLO \ud83d\ude80, GPL-3.0 license\nimport os\n\nfrom ultralytics.yolo.utils import LOGGER, TESTS_RUNNING\nfrom ultralytics.yolo.utils.torch_utils import get_flops, get_num_params\n\ntry:\n    from importlib.metadata import version\n\n    import dvclive\n\n    assert not TESTS_RUNNING  # do not log pytest\n    assert version('dvclive')\nexcept (ImportError, AssertionError):\n    dvclive = None\n\n# DVCLive logger instance\nlive = None\n_processed_plots = {}\n\n# `on_fit_epoch_end` is called on final validation (probably need to be fixed)\n# for now this is the way we distinguish final evaluation of the best model vs\n# last epoch validation\n_training_epoch = False\n\n\ndef _logger_disabled():\n    return os.getenv('ULTRALYTICS_DVC_DISABLED', 'false').lower() == 'true'\n\n\ndef _log_images(image_path, prefix=''):\n    if live:\n        live.log_image(os.path.join(prefix, image_path.name), image_path)\n\n\ndef _log_plots(plots, prefix=''):\n    for name, params in plots.items():\n        timestamp = params['timestamp']\n        if _processed_plots.get(name, None) != timestamp:\n            _log_images(name, prefix)\n            _processed_plots[name] = timestamp\n\n\ndef _log_confusion_matrix(validator):\n    targets = []\n    preds = []\n    matrix = validator.confusion_matrix.matrix\n    names = list(validator.names.values())\n    if validator.confusion_matrix.task == 'detect':\n        names += ['background']\n\n    for ti, pred in enumerate(matrix.T.astype(int)):\n        for pi, num in enumerate(pred):\n            targets.extend([names[ti]] * num)\n            preds.extend([names[pi]] * num)\n\n    live.log_sklearn_plot('confusion_matrix', targets, preds, name='cf.json', normalized=True)\n\n\ndef on_pretrain_routine_start(trainer):\n    try:\n        global live\n        if not _logger_disabled():\n            live = dvclive.Live(save_dvc_exp=True)\n            LOGGER.info(\n                'DVCLive is detected and auto logging is enabled (can be disabled with `ULTRALYTICS_DVC_DISABLED=true`).'\n            )\n        else:\n            LOGGER.debug('DVCLive is detected and auto logging is disabled via `ULTRALYTICS_DVC_DISABLED`.')\n            live = None\n    except Exception as e:\n        LOGGER.warning(f'WARNING \u26a0\ufe0f DVCLive installed but not initialized correctly, not logging this run. {e}')\n\n\ndef on_pretrain_routine_end(trainer):\n    _log_plots(trainer.plots, 'train')\n\n\ndef on_train_start(trainer):\n    if live:\n        live.log_params(trainer.args)\n\n\ndef on_train_epoch_start(trainer):\n    global _training_epoch\n    _training_epoch = True\n\n\ndef on_fit_epoch_end(trainer):\n    global _training_epoch\n    if live and _training_epoch:\n        all_metrics = {**trainer.label_loss_items(trainer.tloss, prefix='train'), **trainer.metrics, **trainer.lr}\n        for metric, value in all_metrics.items():\n            live.log_metric(metric, value)\n\n        if trainer.epoch == 0:\n            model_info = {\n                'model/parameters': get_num_params(trainer.model),\n                'model/GFLOPs': round(get_flops(trainer.model), 3),\n                'model/speed(ms)': round(trainer.validator.speed['inference'], 3)}\n\n            for metric, value in model_info.items():\n                live.log_metric(metric, value, plot=False)\n\n        _log_plots(trainer.plots, 'train')\n        _log_plots(trainer.validator.plots, 'val')\n\n        live.next_step()\n        _training_epoch = False\n\n\ndef on_train_end(trainer):\n    if live:\n        # At the end log the best metrics. It runs validator on the best model internally.\n        all_metrics = {**trainer.label_loss_items(trainer.tloss, prefix='train'), **trainer.metrics, **trainer.lr}\n        for metric, value in all_metrics.items():\n            live.log_metric(metric, value, plot=False)\n\n        _log_plots(trainer.plots, 'eval')\n        _log_plots(trainer.validator.plots, 'eval')\n        _log_confusion_matrix(trainer.validator)\n\n        if trainer.best.exists():\n            live.log_artifact(trainer.best, copy=True)\n\n        live.end()\n\n\ncallbacks = {\n    'on_pretrain_routine_start': on_pretrain_routine_start,\n    'on_pretrain_routine_end': on_pretrain_routine_end,\n    'on_train_start': on_train_start,\n    'on_train_epoch_start': on_train_epoch_start,\n    'on_fit_epoch_end': on_fit_epoch_end,\n    'on_train_end': on_train_end} if dvclive else {}\n", "path": "ultralytics/yolo/utils/callbacks/dvc.py"}], "after_files": [{"content": "# Ultralytics YOLO \ud83d\ude80, GPL-3.0 license\nimport os\n\nimport pkg_resources as pkg\n\nfrom ultralytics.yolo.utils import LOGGER, TESTS_RUNNING\nfrom ultralytics.yolo.utils.torch_utils import get_flops, get_num_params\n\ntry:\n    from importlib.metadata import version\n\n    import dvclive\n\n    assert not TESTS_RUNNING  # do not log pytest\n\n    ver = version('dvclive')\n    if pkg.parse_version(ver) < pkg.parse_version('2.11.0'):\n        LOGGER.debug(f'DVCLive is detected but version {ver} is incompatible (>=2.11 required).')\n        dvclive = None  # noqa: F811\nexcept (ImportError, AssertionError, TypeError):\n    dvclive = None\n\n# DVCLive logger instance\nlive = None\n_processed_plots = {}\n\n# `on_fit_epoch_end` is called on final validation (probably need to be fixed)\n# for now this is the way we distinguish final evaluation of the best model vs\n# last epoch validation\n_training_epoch = False\n\n\ndef _logger_disabled():\n    return os.getenv('ULTRALYTICS_DVC_DISABLED', 'false').lower() == 'true'\n\n\ndef _log_images(image_path, prefix=''):\n    if live:\n        live.log_image(os.path.join(prefix, image_path.name), image_path)\n\n\ndef _log_plots(plots, prefix=''):\n    for name, params in plots.items():\n        timestamp = params['timestamp']\n        if _processed_plots.get(name, None) != timestamp:\n            _log_images(name, prefix)\n            _processed_plots[name] = timestamp\n\n\ndef _log_confusion_matrix(validator):\n    targets = []\n    preds = []\n    matrix = validator.confusion_matrix.matrix\n    names = list(validator.names.values())\n    if validator.confusion_matrix.task == 'detect':\n        names += ['background']\n\n    for ti, pred in enumerate(matrix.T.astype(int)):\n        for pi, num in enumerate(pred):\n            targets.extend([names[ti]] * num)\n            preds.extend([names[pi]] * num)\n\n    live.log_sklearn_plot('confusion_matrix', targets, preds, name='cf.json', normalized=True)\n\n\ndef on_pretrain_routine_start(trainer):\n    try:\n        global live\n        if not _logger_disabled():\n            live = dvclive.Live(save_dvc_exp=True)\n            LOGGER.info(\n                'DVCLive is detected and auto logging is enabled (can be disabled with `ULTRALYTICS_DVC_DISABLED=true`).'\n            )\n        else:\n            LOGGER.debug('DVCLive is detected and auto logging is disabled via `ULTRALYTICS_DVC_DISABLED`.')\n            live = None\n    except Exception as e:\n        LOGGER.warning(f'WARNING \u26a0\ufe0f DVCLive installed but not initialized correctly, not logging this run. {e}')\n\n\ndef on_pretrain_routine_end(trainer):\n    _log_plots(trainer.plots, 'train')\n\n\ndef on_train_start(trainer):\n    if live:\n        live.log_params(trainer.args)\n\n\ndef on_train_epoch_start(trainer):\n    global _training_epoch\n    _training_epoch = True\n\n\ndef on_fit_epoch_end(trainer):\n    global _training_epoch\n    if live and _training_epoch:\n        all_metrics = {**trainer.label_loss_items(trainer.tloss, prefix='train'), **trainer.metrics, **trainer.lr}\n        for metric, value in all_metrics.items():\n            live.log_metric(metric, value)\n\n        if trainer.epoch == 0:\n            model_info = {\n                'model/parameters': get_num_params(trainer.model),\n                'model/GFLOPs': round(get_flops(trainer.model), 3),\n                'model/speed(ms)': round(trainer.validator.speed['inference'], 3)}\n\n            for metric, value in model_info.items():\n                live.log_metric(metric, value, plot=False)\n\n        _log_plots(trainer.plots, 'train')\n        _log_plots(trainer.validator.plots, 'val')\n\n        live.next_step()\n        _training_epoch = False\n\n\ndef on_train_end(trainer):\n    if live:\n        # At the end log the best metrics. It runs validator on the best model internally.\n        all_metrics = {**trainer.label_loss_items(trainer.tloss, prefix='train'), **trainer.metrics, **trainer.lr}\n        for metric, value in all_metrics.items():\n            live.log_metric(metric, value, plot=False)\n\n        _log_plots(trainer.plots, 'eval')\n        _log_plots(trainer.validator.plots, 'eval')\n        _log_confusion_matrix(trainer.validator)\n\n        if trainer.best.exists():\n            live.log_artifact(trainer.best, copy=True)\n\n        live.end()\n\n\ncallbacks = {\n    'on_pretrain_routine_start': on_pretrain_routine_start,\n    'on_pretrain_routine_end': on_pretrain_routine_end,\n    'on_train_start': on_train_start,\n    'on_train_epoch_start': on_train_epoch_start,\n    'on_fit_epoch_end': on_fit_epoch_end,\n    'on_train_end': on_train_end} if dvclive else {}\n", "path": "ultralytics/yolo/utils/callbacks/dvc.py"}]}