class_docstr: An internal YOLO model wrapper that tracks metrics, and logs models to Weights & Biases.
  
  Usage:
  ```python
  from wandb.integration.yolov8.yolov8 import WandbCallback
  
  model = YOLO("yolov8n.pt")
  wandb_logger = WandbCallback(
      model,
  )
  for event, callback_fn in wandb_logger.callbacks.items():
      model.add_callback(event, callback_fn)
  ```
class_docstr_tok: ["An","internal","YOLO","model","wrapper","that","tracks","metrics",",","and","logs","models","to","Weights","&","Biases",".","Usage",":","``","`","python","from","wandb.integration.yolov8.yolov8","import","WandbCallback","model","=","YOLO","(","``","yolov8n.pt","''",")","wandb_logger","=","WandbCallback","(","model",",",")","for","event",",","callback_fn","in","wandb_logger.callbacks.items","(",")",":","model.add_callback","(","event",",","callback_fn",")","``","`"]
docstr: On train end we log all the media, including plots, images and best model artifact to Weights & Biases.
docstr_tok: ["On","train","end","we","log","all","the","media",",","including","plots",",","images","and","best","model","artifact","to","Weights","&","Biases","."]
code: def on_train_end(self, trainer: BaseTrainer) -> None:
      """On train end we log all the media, including plots, images and best model artifact to Weights & Biases."""
      # Currently only the detection and segmentation trainers save images to the save_dir
      assert self.run is not None
      if not isinstance(trainer, ClassificationTrainer):
          assert self.run is not None
          self.run.log(
              {
                  "plots": [
                      wandb.Image(
                          str(image_path), caption=image_path.stem
                      )
                      for image_path in trainer.save_dir.glob("*.png")
                  ],
                  "val_images": [
                      wandb.Image(
                          str(image_path), caption=image_path.stem
                      )
                      for image_path in trainer.validator.save_dir.glob(
                          "val*.jpg"
                      )
                  ],
              },
          )
  
      if trainer.best.exists():
          assert self.run is not None
          self.run.log_artifact(
              str(trainer.best),
              type="model",
              name=f"{self.run.name}_{trainer.args.task}.pt",
              aliases=["best", f"epoch_{trainer.epoch + 1}"],
          )
  
file_path: wandb/wandb/integration/yolov8/yolov8.py
imports: from typing import Any, Callable, Dict, List, Optional
  from ultralytics.yolo.engine.model import YOLO
  from ultralytics.yolo.engine.trainer import BaseTrainer
  from ultralytics.yolo.v8.classify.train import ClassificationTrainer
  import wandb
  from wandb.sdk.lib import telemetry
label_desc: Use image node_id 7 for calling the WandbCallback obj's underlying member method code with example usage: obj.on_train_end(trainer) without return types