class_docstr: OpenNMT option parser powered with option check methods.
code: def validate_train_opts(cls, opt):
      if torch.cuda.is_available() and not opt.gpu_ranks:
          logger.warn(
              "You have a CUDA device, should run with -gpu_ranks"
          )
      if opt.world_size < len(opt.gpu_ranks):
          raise AssertionError(
              "parameter counts of -gpu_ranks must be less or equal "
              "than -world_size."
          )
      if (
          opt.world_size == len(opt.gpu_ranks)
          and min(opt.gpu_ranks) > 0
      ):
          raise AssertionError(
              "-gpu_ranks should have master(=0) rank "
              "unless -world_size is greater than len(gpu_ranks)."
          )
  
      assert len(opt.dropout) == len(
          opt.dropout_steps
      ), "Number of dropout values must match accum_steps values"
  
      assert len(opt.attention_dropout) == len(
          opt.dropout_steps
      ), "Number of attention_dropout values must match accum_steps values"
  
      assert len(opt.accum_count) == len(
          opt.accum_steps
      ), "Number of accum_count values must match number of accum_steps"
  
      if opt.update_vocab:
          assert (
              opt.train_from
          ), "-update_vocab needs -train_from option"
          assert opt.reset_optim in [
              "states",
              "all",
          ], '-update_vocab needs -reset_optim "states" or "all"'
  
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 6 for calling the ArgumentParser obj's underlying member method code with example usage: obj.validate_train_opts(cls, opt) without return types