code: def ssl_model():
      preprocessor = {
          "cls": "nemo.collections.asr.modules.AudioToMelSpectrogramPreprocessor",
          "params": dict({"pad_to": 16, "dither": 0}),
      }
  
      model_defaults = {"enc_hidden": 32, "dec_out": 128}
  
      encoder = {
          "cls": "nemo.collections.asr.modules.ConvASREncoder",
          "params": {
              "feat_in": 64,
              "activation": "relu",
              "conv_mask": True,
              "jasper": [
                  {
                      "filters": model_defaults["enc_hidden"],
                      "repeat": 1,
                      "kernel": [1],
                      "stride": [1],
                      "dilation": [1],
                      "dropout": 0.0,
                      "residual": False,
                      "separable": True,
                      "se": True,
                      "se_context_size": -1,
                  },
                  {
                      "filters": model_defaults["enc_hidden"],
                      "repeat": 1,
                      "kernel": [1],
                      "stride": [1],
                      "dilation": [1],
                      "dropout": 0.0,
                      "residual": False,
                      "separable": True,
                      "se": True,
                      "se_context_size": -1,
                  },
                  {
                      "filters": model_defaults["enc_hidden"],
                      "repeat": 1,
                      "kernel": [1],
                      "stride": [1],
                      "dilation": [1],
                      "dropout": 0.0,
                      "residual": False,
                      "separable": True,
                      "se": True,
                      "se_context_size": -1,
                  },
              ],
          },
      }
  
      spec_augment = {
          "_target_": "nemo.collections.asr.modules.MaskedPatchAugmentation",
          "freq_masks": 3,
          "freq_width": 20,
          "patch_size": 16,
          "mask_patches": 0.5,
      }
  
      loss_list_contr_mlm = {
          "contr": {
              "decoder": {
                  "_target_": "nemo.collections.asr.modules.ConvASRDecoderReconstruction",
                  "feat_in": model_defaults["enc_hidden"],
                  "feat_hidden": 128,
                  "feat_out": model_defaults["dec_out"],
                  "stride_layers": 0,
                  "non_stride_layers": 0,
                  "stride_transpose": False,
              },
              "loss": {
                  "_target_": "nemo.collections.asr.losses.ContrastiveLoss",
                  "in_dim": 64,
                  "proj_dim": model_defaults["dec_out"],
                  "combine_time_steps": 1,
                  "quantized_targets": True,
                  "codebook_size": 64,
                  "sample_from_same_utterance_only": True,
                  "sample_from_non_masked": False,
                  "num_negatives": 3,
              },
          },
          "mlm": {
              "decoder": {
                  "_target_": "nemo.collections.asr.modules.ConvASRDecoder",
                  "feat_in": model_defaults["enc_hidden"],
                  "num_classes": 4096,
              },
              "loss": {
                  "_target_": "nemo.collections.asr.losses.MLMLoss",
                  "combine_time_steps": 1,
              },
              "targets_from_loss": "contr",
          },
      }
  
      modelConfig_contr_mlm = DictConfig(
          {
              "preprocessor": DictConfig(preprocessor),
              "spec_augment": DictConfig(spec_augment),
              "model_defaults": DictConfig(model_defaults),
              "encoder": DictConfig(encoder),
              "loss_list": DictConfig(loss_list_contr_mlm),
          }
      )
      ssl_model = SpeechEncDecSelfSupervisedModel(
          cfg=modelConfig_contr_mlm
      )
      return ssl_model
  
file_path: NeMo/tests/collections/asr/test_ssl_models.py
imports: import copy
  import pytest
  import torch
  from omegaconf import DictConfig, ListConfig
  from nemo.collections.asr.models import SpeechEncDecSelfSupervisedModel
label_desc: Use image node_id 1 for calling a global function with example usage: ssl_model() and returns: ssl_model