code: def build_encoder(cls, args, task):
      spch_encoder = DualInputEncoder.build_spch_encoder(args)
      text_encoder = DualInputEncoder.build_text_encoder(
          args, task.src_dict, spch_encoder
      )
      cross_attentive_loss_before_last_layer = (
          0
          if getattr(args, "attentive_cost_regularization", 0.0) > 0.0
          else -1
      )
      encoder = DualInputEncoder(
          args,
          spch_encoder,
          text_encoder,
          task.src_dict,
          cross_attentive_loss_before_last_layer,
      )
      if args.init_scale != 1.0:
          with torch.no_grad():
              for param in encoder.parameters():
                  param.data.mul_(args.init_scale)
      if args.load_pretrain_text_encoder != "":
          checkpoint_utils.load_pretrained_component_from_model(
              text_encoder, args.load_pretrain_text_encoder
          )
      if args.load_pretrain_speech_encoder != "":
          if hasattr(spch_encoder, "encoder"):
              checkpoint_utils.load_pretrained_component_from_model(
                  spch_encoder.encoder,
                  args.load_pretrain_speech_encoder,
              )
          else:
              checkpoint_utils.load_pretrained_component_from_model(
                  spch_encoder, args.load_pretrain_speech_encoder
              )
      if (
          args.load_pretrain_text_encoder_last != ""
      ):  # if share encoder, speech encoder parameters will be used.
          # It provides a chance to use pre-trained mt encoder instead
          checkpoint_utils.load_pretrained_component_from_model(
              text_encoder, args.load_pretrain_text_encoder_last
          )
  
      if args.load_pretrain_encoder != "":
          checkpoint_utils.load_pretrained_component_from_model(
              encoder, args.load_pretrain_encoder
          )
      return encoder
  
imports: import logging
  from collections import namedtuple
  import torch
  import torch.nn
  from fairseq import checkpoint_utils
  from fairseq import utils
  from fairseq.models import FairseqEncoder, FairseqDecoder, FairseqEncoderDecoderModel, register_model, register_model_architecture
  from fairseq.models.fairseq_encoder import EncoderOut
  from fairseq.models.speech_to_text import TransformerDecoder, S2TTransformerEncoder
  from fairseq.models.transformer import TransformerEncoder
  from fairseq.modules import TransformerEncoderLayer, GradMultiply, LayerNorm
label_desc: Use image node_id 4 for calling the DualInputS2TTransformerModel obj's underlying member method code with example usage: obj.build_encoder(cls, args, task) and returns: encoder