code: def get_model_from_config(
      cfg, is_cli_call: bool = False
  ) -> SelfSupervisedEmbedding:
      checkpoint = cfg["checkpoint"]
      if torch.cuda.is_available():
          device = torch.device("cuda")
      else:
          device = torch.device("cpu")
  
      if not checkpoint:
          checkpoint, key = get_ptmodel_from_config(cfg["model"])
          if not checkpoint:
              msg = "Cannot download checkpoint for key {} ".format(key)
              msg += "because it does not exist!"
              raise RuntimeError(msg)
          state_dict = load_state_dict_from_url(
              checkpoint, map_location=device
          )["state_dict"]
      else:
          checkpoint = (
              fix_input_path(checkpoint) if is_cli_call else checkpoint
          )
          state_dict = torch.load(checkpoint, map_location=device)[
              "state_dict"
          ]
  
      # load model
      resnet = ResNetGenerator(
          cfg["model"]["name"], cfg["model"]["width"]
      )
      last_conv_channels = list(resnet.children())[-1].in_features
      features = nn.Sequential(
          get_norm_layer(3, 0),
          *list(resnet.children())[:-1],
          nn.Conv2d(last_conv_channels, cfg["model"]["num_ftrs"], 1),
          nn.AdaptiveAvgPool2d(1),
      )
  
      model = _SimCLR(
          features,
          num_ftrs=cfg["model"]["num_ftrs"],
          out_dim=cfg["model"]["out_dim"],
      ).to(device)
  
      if state_dict is not None:
          load_from_state_dict(model, state_dict)
  
      encoder = SelfSupervisedEmbedding(model, None, None, None)
      return encoder
  
imports: import os
  import hydra
  import torch
  from hydra import utils
  from torch import nn
  from lightly.cli._cli_simclr import _SimCLR
  from lightly.embedding import SelfSupervisedEmbedding
  from lightly.models import ZOO
  from lightly.models import ResNetGenerator
  from lightly.models.batchnorm import get_norm_layer
  from lightly.utils.version_compare import version_compare
label_desc: Use image node_id 11 for calling a global function with example usage: get_model_from_config(cfg, is_cli_call) and returns: encoder