code: def build_encoder(cls, args, dictionary):
      text_encoder = cls.build_text_encoder(args, dictionary)
      if getattr(args, "load_pretrained_mbart_encoder_from", None):
          text_encoder = (
              checkpoint_utils.load_pretrained_component_from_model(
                  component=text_encoder,
                  checkpoint=args.load_pretrained_mbart_encoder_from,
              )
          )
      speech_encoder = cls.build_speech_encoder(args)
      if getattr(args, "load_pretrained_feature_extractor_from", None):
  
          def load_feature_extractor(component, checkpoint):
              if not PathManager.exists(checkpoint):
                  raise IOError(
                      "Model file not found: {}".format(checkpoint)
                  )
              state = checkpoint_utils.load_checkpoint_to_cpu(
                  checkpoint
              )
              component_state_dict = OrderedDict()
  
              component_prefix = "feature_extractor"
              for key in state["model"].keys():
                  if key.startswith(component_prefix):
                      component_subkey = key[
                          len(component_prefix) + 1 :
                      ]
                      component_state_dict[component_subkey] = state[
                          "model"
                      ][key]
              component.load_state_dict(
                  component_state_dict, strict=True
              )
              return component
  
          speech_encoder.subsample = load_feature_extractor(
              speech_encoder.subsample,
              args.load_pretrained_feature_extractor_from,
          )
      speech_s2s_encoder = speech_encoder
      unsup_speech_encoder = cls.build_unsup_speech_encoder(
          args, speech_encoder
      )
      if getattr(args, "stacked_encoder", "none") != "none":
          if args.encoder_shared_text_layers_from_begin > 0:
              raise ValueError(
                  "We can not stack encoders and share encoders at the same time!"
              )
          speech_s2s_encoder = StackedSpeechWavTransformerEncoder(
              speech_encoder,
              text_encoder.layers,
              text_encoder.layer_norm,
          )
          if args.stacked_encoder == "all":
              speech_encoder = speech_s2s_encoder
              unsup_speech_encoder = StackedSpeechWavTransformerEncoder(
                  unsup_speech_encoder,
                  text_encoder.layers,
                  text_encoder.layer_norm,
              )
      else:
          cls.share_speech_text_encoder(
              speech_encoder,
              text_encoder,
              args.encoder_shared_text_layers_from_begin,
          )
      return SpeechTextPreTrainEncoder(
          dictionary,
          speech_encoder,
          speech_s2s_encoder,
          unsup_speech_encoder,
          text_encoder,
      )
  
imports: import logging
  from collections import OrderedDict, namedtuple
  from typing import Dict, Optional
  import torch
  import torch.nn
  import torch.nn.functional
  from torch import Tensor
  from fairseq import checkpoint_utils, utils
  from fairseq.file_io import PathManager
  from fairseq.models import FairseqDecoder, FairseqEncoderDecoderModel, register_model, register_model_architecture
  from fairseq.models.speech_to_text import MultiInputDecoder, MultiModalityEncoder, SpeechWavTransformerEncoder, StackedSpeechWavTransformerEncoder
  from fairseq.models.transformer import TransformerDecoder, TransformerEncoder, TransformerModel
label_desc: Use image node_id 7 for calling the SpeechTextPreTrainEncoder obj's underlying member method code with example usage: obj.build_encoder(cls, args, dictionary) and returns: SpeechTextPreTrainEncoder, component