code: def __init__(self, args, dicts, training):
      lang_pairs = [
          f"{self.source_lang}-{self.target_lang}",
          f"{self.target_lang}-{self.source_lang}",
          (
              f"{self.source_lang}-{self.target_lang}_"
              f"{constants.MONOLINGUAL_DATA_IDENTIFIER}"
          ),
          (
              f"{self.target_lang}-{self.source_lang}_"
              f"{constants.MONOLINGUAL_DATA_IDENTIFIER}"
          ),
      ]
      # This is explicitly set so that we can re-use code from
      # MultilingualTranslationTask. During initialization, it sets
      # args.lang_pairs as self.lang_pairs
      args.lang_pairs = lang_pairs
      super().__init__(args, dicts, training)
      self.eval_lang_pairs = [
          f"{self.source_lang}-{self.target_lang}",
          f"{self.target_lang}-{self.source_lang}",
      ]
      self.remove_eos_from_source = not args.append_eos_to_source
      self.args = args
      self.model = None
  
      """
          loss_weights refers to weights given to training loss for constituent
          models for specified number of epochs. If we don't specify a model, they
          receive a weight of 1
          The format is [(epochs, {model: weight})]
  
          Sample input:
          [(5, {'src-tgt': 1, 'src-tgt_mono': 0}), (10, {'src-tgt': 0.5, 'src-tgt_mono': 0.5})]
          Here, we give assign weights as follows:
          For first 5 epochs, 'src-tgt' model gets weight 1, 'src-tgt_mono' gets 0
          For the next 10 epochs (till the end of training), 'src-tgt' model gets
              weight 0.5, 'src-tgt_mono' gets 0.5, the rest get 1
  
          """
  
      # default loss_weights is equal weighting for all model keys
      self.loss_weights = [
          (
              100,
              {
                  "src-tgt": 1,
                  "src-tgt_mono": 1,
                  "tgt-src": 1,
                  "tgt-src_mono": 1,
              },
          )
      ]
      if (
          hasattr(self.args, "loss_weights_json")
          and self.args.loss_weights_json
      ):
          self.loss_weights = (
              PytorchTranslateSemiSupervised.parse_loss_weights(
                  loss_weights_json=self.args.loss_weights_json
              )
          )
  
imports: import json
  from collections import OrderedDict
  from typing import Optional
  from fairseq import models
  from fairseq.data import BacktranslationDataset, LanguagePairDataset, RoundRobinZipDatasets, TransformEosDataset
  from fairseq.models import FairseqMultiModel
  from fairseq.tasks import register_task
  from pytorch_translate import beam_decode, constants, rnn
  from pytorch_translate.data import data, dictionary, utils, weighted_data
  from pytorch_translate.tasks.pytorch_translate_multi_task import PyTorchTranslateMultiTask
  from pytorch_translate.tasks.pytorch_translate_task import PytorchTranslateTask
label_desc: Use image node_id 1 to create a new PytorchTranslateSemiSupervised object from inherited base classes: PyTorchTranslateMultiTask with example: obj = PytorchTranslateSemiSupervised(args, dicts, training)