code: def plot_learning_curves(
      curves: Dict[str, List],
      visdom_server: Optional["visdom.Visdom"] = None,
      env: Optional[str] = None,
      win: Optional[str] = None,
      title: str = "",
  ) -> Any:
      """Plots the specified dict of learning curves in visdom. Optionally, the
      environment, window handle, and title for the visdom plot can be specified.
      """
  
      if visdom_server is None and visdom_connected():
          visdom_server = vis[-1]
  
      # return if we are not connected to visdom server:
      if not visdom_server or not visdom_server.check_connection():
          print("WARNING: Not connected to visdom. Skipping plotting.")
          return
  
      # assertions:
      assert type(curves) == dict
      assert all(type(curve) == list for _, curve in curves.items())
  
      # remove batch time curves:
      _curves = {
          k: curves[k] for k in curves.keys() if "batch time" not in k
      }
  
      # show plot:
      X = torch.stack(
          [torch.FloatTensor(curve) for _, curve in _curves.items()],
          dim=1,
      )
      Y = torch.arange(0, X.size(0))
      Y = Y.view(Y.numel(), 1).expand(Y.numel(), X.size(1))
      opts = {
          "title": title,
          "legend": list(_curves.keys()),
          "xlabel": "Epochs",
      }
      return visdom_server.line(X, Y, env=env, win=win, opts=opts)
  
file_path: ClassyVision/classy_vision/generic/visualize.py
imports: import math
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  import torch.nn.modules
  from classy_vision.generic.util import get_model_dummy_input, is_pos_int
  from classy_vision.models import ClassyModel
  from PIL import Image
label_desc: Use image node_id 3 for calling a global function with example usage: plot_learning_curves(curves, visdom_server, env, win, title) and returns: visdom_server