class_docstr: This class is an abstract base class (ABC) for models.
  To create a subclass, you need to implement the following five functions:
      -- <__init__>:                      initialize the class; first call BaseModel.__init__(self, opt).
      -- <set_input>:                     unpack data from dataset and apply preprocessing.
      -- <forward>:                       produce intermediate results.
      -- <optimize_parameters>:           calculate losses, gradients, and update network weights.
class_docstr_tok: ["This","class","is","an","abstract","base","class","(","ABC",")","for","models",".","To","create","a","subclass",",","you","need","to","implement","the","following","five","functions",":","--","<","__init__",">",":","initialize","the","class",";","first","call","BaseModel.__init__","(","self",",","opt",")",".","--","<","set_input",">",":","unpack","data","from","dataset","and","apply","preprocessing",".","--","<","forward",">",":","produce","intermediate","results",".","--","<","optimize_parameters",">",":","calculate","losses",",","gradients",",","and","update","network","weights","."]
docstr: instantiate the loss and the miner if it's available
  in the yaml config:
  
  example in the yaml config
  metric_loss:
      class: "TripletMarginLoss"
      params:
          smooth_loss: True
          triplets_per_anchors: 'all'
docstr_tok: ["instantiate","the","loss","and","the","miner","if","it","'s","available","in","the","yaml","config",":","example","in","the","yaml","config","metric_loss",":","class",":","``","TripletMarginLoss","''","params",":","smooth_loss",":","True","triplets_per_anchors",":","'all","'"]
code: def get_metric_loss_and_miner(opt_loss, opt_miner):
      """
      instantiate the loss and the miner if it's available
      in the yaml config:
  
      example in the yaml config
      metric_loss:
          class: "TripletMarginLoss"
          params:
              smooth_loss: True
              triplets_per_anchors: 'all'
      """
      loss = None
      miner = None
      if opt_loss is not None:
          loss = instantiate_loss_or_miner(opt_loss, mode="metric_loss")
      if opt_miner is not None:
          miner = instantiate_loss_or_miner(opt_miner, mode="miner")
  
      return loss, miner
  
imports: from collections import OrderedDict
  from abc import abstractmethod
  from typing import Optional, Dict, Any, List
  import os
  import torch
  from torch.optim.optimizer import Optimizer
  from torch.optim.lr_scheduler import _LRScheduler
  import logging
  from collections import defaultdict
  from torch_points3d.core.schedulers.lr_schedulers import instantiate_scheduler
  from torch_points3d.core.schedulers.bn_schedulers import instantiate_bn_scheduler
  from torch_points3d.utils.enums import SchedulerUpdateOn
  from torch_points3d.core.regularizer import *
  from torch_points3d.core.losses import instantiate_loss_or_miner
  from torch_points3d.utils.config import is_dict
  from torch_points3d.utils.colors import colored_print, COLORS
  from .model_interface import TrackerInterface, DatasetInterface, CheckpointInterface
label_desc: Use image node_id 37 for calling the BaseModel obj's underlying member method code with example usage: obj.get_metric_loss_and_miner(opt_loss, opt_miner) and returns: loss,  miner