docstr: Base Model for all SSL Models.
  
  Args:
      config (DictConfig): Configuration defined by the user
      mode (str, optional): Mode of the model. Defaults to "pretrain".
      encoder (Optional[nn.Module], optional): Encoder of the model. Defaults to None.
      decoder (Optional[nn.Module], optional): Decoder of the model. Defaults to None.
      custom_optimizer (Optional[torch.optim.Optimizer], optional): Custom optimizer to use. Defaults to None.
      custom_optimizer_params (Dict, optional): Custom optimizer parameters to use. Defaults to {}.
docstr_tok: ["Base","Model","for","all","SSL","Models",".","Args",":","config","(","DictConfig",")",":","Configuration","defined","by","the","user","mode","(","str",",","optional",")",":","Mode","of","the","model",".","Defaults","to","``","pretrain","''",".","encoder","(","Optional","[","nn.Module","]",",","optional",")",":","Encoder","of","the","model",".","Defaults","to","None",".","decoder","(","Optional","[","nn.Module","]",",","optional",")",":","Decoder","of","the","model",".","Defaults","to","None",".","custom_optimizer","(","Optional","[","torch.optim.Optimizer","]",",","optional",")",":","Custom","optimizer","to","use",".","Defaults","to","None",".","custom_optimizer_params","(","Dict",",","optional",")",":","Custom","optimizer","parameters","to","use",".","Defaults","to","{","}","."]
code: def __init__(
      self,
      config: DictConfig,
      mode: str = "pretrain",
      encoder: Optional[nn.Module] = None,
      decoder: Optional[nn.Module] = None,
      custom_optimizer: Optional[torch.optim.Optimizer] = None,
      custom_optimizer_params: Dict = {},
      **kwargs,
  ):
      """Base Model for all SSL Models.
  
      Args:
          config (DictConfig): Configuration defined by the user
          mode (str, optional): Mode of the model. Defaults to "pretrain".
          encoder (Optional[nn.Module], optional): Encoder of the model. Defaults to None.
          decoder (Optional[nn.Module], optional): Decoder of the model. Defaults to None.
          custom_optimizer (Optional[torch.optim.Optimizer], optional): Custom optimizer to use. Defaults to None.
          custom_optimizer_params (Dict, optional): Custom optimizer parameters to use. Defaults to {}.
      """
      super().__init__()
      assert (
          "inferred_config" in kwargs
      ), "inferred_config not found in initialization arguments"
      inferred_config = kwargs["inferred_config"]
      # Merging the config and inferred config
      config = safe_merge_config(config, inferred_config)
  
      self._setup_encoder_decoder(
          encoder,
          config.encoder_config,
          decoder,
          config.decoder_config,
          inferred_config,
      )
      self.custom_optimizer = custom_optimizer
      self.custom_optimizer_params = custom_optimizer_params
      # Updating config with custom parameters for experiment tracking
      if self.custom_optimizer is not None:
          config.optimizer = str(
              self.custom_optimizer.__class__.__name__
          )
      if len(self.custom_optimizer_params) > 0:
          config.optimizer_params = self.custom_optimizer_params
      self.mode = mode
      self._check_and_verify()
      self.save_hyperparameters(config)
      self._build_network()
      self._setup_loss()
      self._setup_metrics()
  
imports: import warnings
  from abc import ABCMeta, abstractmethod
  from typing import Dict, Optional
  import pytorch_lightning
  import torch
  import torch.nn
  from omegaconf import DictConfig, OmegaConf
  from pytorch_tabular.models.base_model import _create_optimizer
  from pytorch_tabular.utils import get_logger, getattr_nested, reset_all_weights
label_desc: Use image node_id 1 to create a new SSLBaseModel object from inherited base classes: pl with example: obj = SSLBaseModel(config, mode, encoder, decoder, custom_optimizer, custom_optimizer_params)