@classmethod
def validate_model_opts(cls, model_opt):
    assert (model_opt.model_type in ['text', 'img', 'audio', 'vec']), ('Unsupported model type %s' % model_opt.model_type)
    same_size = (model_opt.enc_rnn_size == model_opt.dec_rnn_size)
    assert ((model_opt.model_type == 'audio') or 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.')
@classmethod
def validate_model_opts(cls, model_opt):
    assert (model_opt.model_type in ['text', 'img', 'audio', 'vec']), ('Unsupported model type %s' % model_opt.model_type)
    same_size = (model_opt.enc_rnn_size == model_opt.dec_rnn_size)
    assert ((model_opt.model_type == 'audio') or 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.')