class_docstr: OpenNMT option parser powered with option check methods.
code: def validate_model_opts(cls, model_opt):
      assert model_opt.model_type in ["text"], (
          "Unsupported model type %s" % model_opt.model_type
      )
  
      # encoder and decoder should be same sizes
      same_size = model_opt.enc_hid_size == model_opt.dec_hid_size
      assert (
          same_size
      ), "The encoder and decoder rnns must be the same size for now"
  
      assert (
          model_opt.rnn_type != "SRU" or model_opt.gpu_ranks
      ), "Using SRU requires -gpu_ranks set."
      if model_opt.share_embeddings:
          if model_opt.model_type != "text":
              raise AssertionError(
                  "--share_embeddings requires --model_type text."
              )
      if model_opt.lambda_align > 0.0:
          assert (
              model_opt.decoder_type == "transformer"
          ), "Only transformer is supported to joint learn alignment."
          assert (
              model_opt.alignment_layer < model_opt.dec_layers
              and model_opt.alignment_layer >= -model_opt.dec_layers
          ), "N° alignment_layer should be smaller than number of layers."
          logger.info(
              "Joint learn alignment at layer [{}] "
              "with {} heads in full_context '{}'.".format(
                  model_opt.alignment_layer,
                  model_opt.alignment_heads,
                  model_opt.full_context_alignment,
              )
          )
  
      if (
          model_opt.feat_merge == "concat"
          and model_opt.feat_vec_size > 0
      ):
          assert (
              model_opt.feat_vec_size * model_opt.n_src_feats
          ) + model_opt.src_word_vec_size == model_opt.hidden_size, (
              "(feat_vec_size * n_src_feats) + "
              "src_word_vec_size should be equal to hidden_size with "
              "-feat_merge concat mode."
          )
  
      if (
          model_opt.position_encoding
          and model_opt.max_relative_positions != 0
      ):
          raise ValueError(
              "Cannot use absolute and relative position encoding at the"
              "same time. Use either --position_encoding=true for legacy"
              "absolute position encoding or --max_realtive_positions with"
              " -1 for Rotary, or > 0 for Relative Position Representations"
              "as in https://arxiv.org/pdf/1803.02155.pdf"
          )
      if model_opt.multiquery and model_opt.num_kv == 0:
          model_opt.num_kv = 1
  
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 4 for calling the ArgumentParser obj's underlying member method code with example usage: obj.validate_model_opts(cls, model_opt) without return types