class_docstr: Implementation for https://arxiv.org/abs/2006.04558
class_docstr_tok: ["Implementation","for","https",":","\/\/arxiv.org\/abs\/2006.04558"]
code: def build_model(cls, args, task):
      embed_speaker = task.get_speaker_embeddings(args)
      encoder = FastSpeech2Encoder(args, task.src_dict, embed_speaker)
      return cls(encoder, args, task.src_dict)
  
imports: import logging
  import torch
  from torch import nn
  from fairseq import utils
  from fairseq.data.data_utils import lengths_to_padding_mask
  from fairseq.models import FairseqEncoder, FairseqEncoderModel, register_model, register_model_architecture
  from fairseq.models.text_to_speech.hub_interface import TTSHubInterface
  from fairseq.models.text_to_speech.tacotron2 import Postnet
  from fairseq.modules import FairseqDropout, LayerNorm, MultiheadAttention, PositionalEmbedding
label_desc: Use image node_id 5 for calling the FastSpeech2Model obj's underlying member method code with example usage: obj.build_model(cls, args, task) and returns: cls