class_docstr: Checker with methods for validate data related options.
docstr: Parse corpora specified in data field of YAML file.
docstr_tok: ["Parse","corpora","specified","in","data","field","of","YAML","file","."]
code: def _validate_data(cls, opt):
      """Parse corpora specified in data field of YAML file."""
      import yaml
  
      default_transforms = opt.transforms
      if len(default_transforms) != 0:
          logger.info(f"Default transforms: {default_transforms}.")
      corpora = yaml.safe_load(opt.data)
  
      for cname, corpus in corpora.items():
          # Check Transforms
          _transforms = corpus.get("transforms", None)
          if _transforms is None:
              logger.info(
                  f"Missing transforms field for {cname} data, "
                  f"set to default: {default_transforms}."
              )
              corpus["transforms"] = default_transforms
          # Check path
          path_src = corpus.get("path_src", None)
          path_tgt = corpus.get("path_tgt", None)
          if path_src is None:
              raise ValueError(
                  f"Corpus {cname} src path is required."
                  "tgt path is also required for non language"
                  " modeling tasks."
              )
          else:
              opt.data_task = ModelTask.SEQ2SEQ
              if path_tgt is None:
                  logger.debug(
                      "path_tgt is None, it should be set unless the task"
                      " is language modeling"
                  )
                  opt.data_task = ModelTask.LANGUAGE_MODEL
                  # tgt is src for LM task
                  corpus["path_tgt"] = path_src
                  corpora[cname] = corpus
                  path_tgt = path_src
              cls._validate_file(path_src, info=f"{cname}/path_src")
              cls._validate_file(path_tgt, info=f"{cname}/path_tgt")
          path_align = corpus.get("path_align", None)
          if path_align is None:
              if (
                  hasattr(opt, "lambda_align")
                  and opt.lambda_align > 0.0
              ):
                  raise ValueError(
                      f"Corpus {cname} alignment file path are "
                      "required when lambda_align > 0.0"
                  )
              corpus["path_align"] = None
          else:
              cls._validate_file(path_align, info=f"{cname}/path_align")
          # Check weight
          weight = corpus.get("weight", None)
          if weight is None:
              if cname != CorpusName.VALID:
                  logger.warning(
                      f"Corpus {cname}'s weight should be given."
                      " We default it to 1 for you."
                  )
              corpus["weight"] = 1
  
          # Check features
          if opt.n_src_feats > 0:
              if "inferfeats" not in corpus["transforms"]:
                  raise ValueError(
                      "'inferfeats' transform is required "
                      "when setting source features"
                  )
  
      logger.info(f"Parsed {len(corpora)} corpora from -data.")
      opt.data = corpora
  
imports: import configargparse
  import os
  import torch
  import onmt.opts
  from onmt.utils.logging import logger
  from onmt.constants import CorpusName, ModelTask
  from onmt.transforms import AVAILABLE_TRANSFORMS
label_desc: Use image node_id 2 for calling the DataOptsCheckerMixin obj's underlying member method code with example usage: obj._validate_data(cls, opt) without return types