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","."]
code: def instantiate_optimizers(self, config, cuda_enabled=False):
      # Optimiser
      optimizer_opt = self.get_from_opt(
          config,
          ["training", "optim", "optimizer"],
          msg_err="optimizer needs to be defined within the training config",
      )
      optmizer_cls_name = optimizer_opt.get("class")
      optimizer_cls = getattr(torch.optim, optmizer_cls_name)
      optimizer_params = {}
      if hasattr(optimizer_opt, "params"):
          optimizer_params = optimizer_opt.params
      self._optimizer = optimizer_cls(
          self.parameters(), **optimizer_params
      )
  
      # LR Scheduler
      scheduler_opt = self.get_from_opt(
          config, ["training", "optim", "lr_scheduler"]
      )
      if scheduler_opt:
          update_lr_scheduler_on = config.get(
              "update_lr_scheduler_on"
          )  # Update to OmegaConf 2.0
          if update_lr_scheduler_on:
              self._update_lr_scheduler_on = update_lr_scheduler_on
          scheduler_opt.update_scheduler_on = (
              self._update_lr_scheduler_on
          )
          lr_scheduler = instantiate_scheduler(
              self._optimizer, scheduler_opt
          )
          self._add_scheduler("lr_scheduler", lr_scheduler)
  
      # BN Scheduler
      bn_scheduler_opt = self.get_from_opt(
          config, ["training", "optim", "bn_scheduler"]
      )
      if bn_scheduler_opt:
          update_bn_scheduler_on = config.get(
              "update_bn_scheduler_on"
          )  # update to OmegaConf 2.0
          if update_bn_scheduler_on:
              self._update_bn_scheduler_on = update_bn_scheduler_on
          bn_scheduler_opt.update_scheduler_on = (
              self._update_bn_scheduler_on
          )
          bn_scheduler = instantiate_bn_scheduler(
              self, bn_scheduler_opt
          )
          self._add_scheduler("bn_scheduler", bn_scheduler)
  
      # Accumulated gradients
      self._accumulated_gradient_step = self.get_from_opt(
          config, ["training", "optim", "accumulated_gradient"]
      )
      if self._accumulated_gradient_step:
          if self._accumulated_gradient_step > 1:
              self._accumulated_gradient_count = 0
          else:
              raise Exception(
                  "When set, accumulated_gradient option should be an integer greater than 1"
              )
  
      # Gradient clipping
      self._grad_clip = self.get_from_opt(
          config, ["training", "optim", "grad_clip"], default_value=-1
      )
  
      # Gradient Scaling
      self._enable_mixed = self.get_from_opt(
          config, ["training", "enable_mixed"], default_value=False
      )
      self._enable_mixed = bool(self._enable_mixed)
      if self.is_mixed_precision() and not cuda_enabled:
          log.warning(
              "Mixed precision is not supported on this device, using default precision..."
          )
          self._enable_mixed = False
      elif self._enable_mixed and not self._supports_mixed:
          log.warning(
              "Mixed precision is not supported on this model, using default precision..."
          )
      elif self.is_mixed_precision():
          log.info("Model will use mixed precision")
  
      self._grad_scale = torch.cuda.amp.GradScaler(
          enabled=self.is_mixed_precision()
      )
  
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 32 for calling the BaseModel obj's underlying member method code with example usage: obj.instantiate_optimizers(config, cuda_enabled) without return types