code: def build_task_specific_model(model_opt, vocabs):
      # Share the embedding matrix - preprocess with share_vocab required.
      if model_opt.share_embeddings:
          # src/tgt vocab should be the same if `-share_vocab` is specified.
          assert (
              vocabs["src"] == vocabs["tgt"]
          ), "preprocess with -share_vocab if you use share_embeddings"
  
      if model_opt.model_task == ModelTask.SEQ2SEQ:
          encoder, src_emb = build_encoder_with_embeddings(
              model_opt, vocabs
          )
          decoder, _ = build_decoder_with_embeddings(
              model_opt,
              vocabs,
              share_embeddings=model_opt.share_embeddings,
              src_emb=src_emb,
          )
          return NMTModel(encoder=encoder, decoder=decoder)
      elif model_opt.model_task == ModelTask.LANGUAGE_MODEL:
          src_emb = build_src_emb(model_opt, vocabs)
          decoder, _ = build_decoder_with_embeddings(
              model_opt, vocabs, share_embeddings=True, src_emb=src_emb
          )
          return LanguageModel(decoder=decoder)
      else:
          raise ValueError(
              f"No model defined for {model_opt.model_task} task"
          )
  
imports: import torch
  import torch.nn
  from torch.nn.utils import skip_init
  from torch.nn.init import xavier_uniform_, zeros_, uniform_
  from onmt.models.model import NMTModel, LanguageModel
  from onmt.encoders import str2enc
  from onmt.decoders import str2dec
  from onmt.inputters.inputter import dict_to_vocabs
  from onmt.modules import Embeddings, CopyGenerator
  from onmt.utils.misc import use_gpu
  from onmt.utils.logging import logger
  from onmt.utils.parse import ArgumentParser
  from onmt.models.model_saver import load_checkpoint
  from onmt.constants import DefaultTokens, ModelTask
  from onmt.modules.lora import replace_lora_linear, replace_lora_embedding, mark_only_lora_as_trainable
label_desc: Use image node_id 8 for calling a global function with example usage: build_task_specific_model(model_opt, vocabs) and returns: NMTModel, LanguageModel