def __init__(self, encoder_type=None, encoder_name=None, decoder_name=None, encoder_decoder_type=None, encoder_decoder_name=None, config=None, args=None, use_cuda=True, cuda_device=(- 1), **kwargs):
    '\n        Initializes a Seq2SeqModel.\n\n        Args:\n            encoder_type (optional): The type of model to use as the encoder.\n            encoder_name (optional): The exact architecture and trained weights to use. This may be a Hugging Face Transformers compatible pre-trained model, a community model, or the path to a directory containing model files.\n            decoder_name (optional): The exact architecture and trained weights to use. This may be a Hugging Face Transformers compatible pre-trained model, a community model, or the path to a directory containing model files.\n                                    Must be the same "size" as the encoder model (base/base, large/large, etc.)\n            encoder_decoder_type (optional): The type of encoder-decoder model. (E.g. bart)\n            encoder_decoder_name (optional): The path to a directory containing the saved encoder and decoder of a Seq2SeqModel. (E.g. "outputs/") OR a valid BART or MarianMT model.\n            config (optional): A configuration file to build an EncoderDecoderModel.\n            args (optional): Default args will be used if this parameter is not provided. If provided, it should be a dict containing the args that should be changed in the default args.\n            use_cuda (optional): Use GPU if available. Setting to False will force model to use CPU only.\n            cuda_device (optional): Specific GPU that should be used. Will use the first available GPU by default.\n            **kwargs (optional): For providing proxies, force_download, resume_download, cache_dir and other options specific to the \'from_pretrained\' implementation where this will be supplied.\n        '
    if (not config):
        if (not ((encoder_name and decoder_name) or encoder_decoder_name)):
            raise ValueError('You must specify a Seq2Seq config \t OR \tencoder_type, encoder_name, and decoder_name OR \t \tencoder_type and encoder_decoder_name')
        elif (not (encoder_type or encoder_decoder_type)):
            raise ValueError('You must specify a Seq2Seq config \t OR \tencoder_type, encoder_name, and decoder_name \t OR \tencoder_type and encoder_decoder_name')
    self.args = self._load_model_args(encoder_decoder_name)
    if isinstance(args, dict):
        self.args.update_from_dict(args)
    elif isinstance(args, Seq2SeqArgs):
        self.args = args
    if ('sweep_config' in kwargs):
        sweep_config = kwargs.pop('sweep_config')
        sweep_values = {key: value['value'] for (key, value) in sweep_config.as_dict().items() if (key != '_wandb')}
        self.args.update_from_dict(sweep_values)
    if self.args.manual_seed:
        random.seed(self.args.manual_seed)
        np.random.seed(self.args.manual_seed)
        torch.manual_seed(self.args.manual_seed)
        if (self.args.n_gpu > 0):
            torch.cuda.manual_seed_all(self.args.manual_seed)
    if use_cuda:
        if torch.cuda.is_available():
            if (cuda_device == (- 1)):
                self.device = torch.device('cuda')
            else:
                self.device = torch.device(f'cuda:{cuda_device}')
        else:
            raise ValueError("'use_cuda' set to True when cuda is unavailable.Make sure CUDA is available or set `use_cuda=False`.")
    else:
        self.device = 'cpu'
    self.results = {}
    if (not use_cuda):
        self.args.fp16 = False
    if encoder_decoder_type:
        (config_class, model_class, tokenizer_class) = MODEL_CLASSES[encoder_decoder_type]
    else:
        (config_class, model_class, tokenizer_class) = MODEL_CLASSES[encoder_type]
    if (encoder_decoder_type in ['bart', 'marian']):
        self.model = model_class.from_pretrained(encoder_decoder_name)
        if (encoder_decoder_type == 'bart'):
            self.encoder_tokenizer = tokenizer_class.from_pretrained(encoder_decoder_name)
        elif (encoder_decoder_type == 'marian'):
            if self.args.base_marian_model_name:
                self.encoder_tokenizer = tokenizer_class.from_pretrained(self.args.base_marian_model_name)
            else:
                self.encoder_tokenizer = tokenizer_class.from_pretrained(encoder_decoder_name)
        self.decoder_tokenizer = self.encoder_tokenizer
        self.config = self.model.config
    else:
        if encoder_decoder_name:
            self.model = EncoderDecoderModel.from_encoder_decoder_pretrained(os.path.join(encoder_decoder_name, 'encoder'), os.path.join(encoder_decoder_name, 'decoder'))
            self.model.encoder = model_class.from_pretrained(os.path.join(encoder_decoder_name, 'encoder'))
            self.model.decoder = BertForMaskedLM.from_pretrained(os.path.join(encoder_decoder_name, 'decoder'))
            self.encoder_tokenizer = tokenizer_class.from_pretrained(os.path.join(encoder_decoder_name, 'encoder'))
            self.decoder_tokenizer = BertTokenizer.from_pretrained(os.path.join(encoder_decoder_name, 'decoder'))
        else:
            self.model = EncoderDecoderModel.from_encoder_decoder_pretrained(encoder_name, decoder_name, config=config)
            self.encoder_tokenizer = tokenizer_class.from_pretrained(encoder_name)
            self.decoder_tokenizer = BertTokenizer.from_pretrained(decoder_name)
        self.encoder_config = self.model.config.encoder
        self.decoder_config = self.model.config.decoder
    if (self.args.wandb_project and (not wandb_available)):
        warnings.warn('wandb_project specified but wandb is not available. Wandb disabled.')
        self.args.wandb_project = None
    if encoder_decoder_name:
        self.args.model_name = encoder_decoder_name
        self.args.base_marian_model_name = encoder_decoder_name
    elif (encoder_name and decoder_name):
        self.args.model_name = ((encoder_name + '-') + decoder_name)
    else:
        self.args.model_name = 'encoder-decoder'
    if encoder_decoder_type:
        self.args.model_type = encoder_decoder_type
    elif encoder_type:
        self.args.model_type = (encoder_type + '-bert')
    else:
        self.args.model_type = 'encoder-decoder'
Initializes a Seq2SeqModel.

Args:
    encoder_type (optional): The type of model to use as the encoder.
    encoder_name (optional): The exact architecture and trained weights to use. This may be a Hugging Face Transformers compatible pre-trained model, a community model, or the path to a directory containing model files.
    decoder_name (optional): The exact architecture and trained weights to use. This may be a Hugging Face Transformers compatible pre-trained model, a community model, or the path to a directory containing model files.
                            Must be the same "size" as the encoder model (base/base, large/large, etc.)
    encoder_decoder_type (optional): The type of encoder-decoder model. (E.g. bart)
    encoder_decoder_name (optional): The path to a directory containing the saved encoder and decoder of a Seq2SeqModel. (E.g. "outputs/") OR a valid BART or MarianMT model.
    config (optional): A configuration file to build an EncoderDecoderModel.
    args (optional): Default args will be used if this parameter is not provided. If provided, it should be a dict containing the args that should be changed in the default args.
    use_cuda (optional): Use GPU if available. Setting to False will force model to use CPU only.
    cuda_device (optional): Specific GPU that should be used. Will use the first available GPU by default.
    **kwargs (optional): For providing proxies, force_download, resume_download, cache_dir and other options specific to the 'from_pretrained' implementation where this will be supplied.
def __init__(self, encoder_type=None, encoder_name=None, decoder_name=None, encoder_decoder_type=None, encoder_decoder_name=None, config=None, args=None, use_cuda=True, cuda_device=(- 1), **kwargs):
    '\n        Initializes a Seq2SeqModel.\n\n        Args:\n            encoder_type (optional): The type of model to use as the encoder.\n            encoder_name (optional): The exact architecture and trained weights to use. This may be a Hugging Face Transformers compatible pre-trained model, a community model, or the path to a directory containing model files.\n            decoder_name (optional): The exact architecture and trained weights to use. This may be a Hugging Face Transformers compatible pre-trained model, a community model, or the path to a directory containing model files.\n                                    Must be the same "size" as the encoder model (base/base, large/large, etc.)\n            encoder_decoder_type (optional): The type of encoder-decoder model. (E.g. bart)\n            encoder_decoder_name (optional): The path to a directory containing the saved encoder and decoder of a Seq2SeqModel. (E.g. "outputs/") OR a valid BART or MarianMT model.\n            config (optional): A configuration file to build an EncoderDecoderModel.\n            args (optional): Default args will be used if this parameter is not provided. If provided, it should be a dict containing the args that should be changed in the default args.\n            use_cuda (optional): Use GPU if available. Setting to False will force model to use CPU only.\n            cuda_device (optional): Specific GPU that should be used. Will use the first available GPU by default.\n            **kwargs (optional): For providing proxies, force_download, resume_download, cache_dir and other options specific to the \'from_pretrained\' implementation where this will be supplied.\n        '
    if (not config):
        if (not ((encoder_name and decoder_name) or encoder_decoder_name)):
            raise ValueError('You must specify a Seq2Seq config \t OR \tencoder_type, encoder_name, and decoder_name OR \t \tencoder_type and encoder_decoder_name')
        elif (not (encoder_type or encoder_decoder_type)):
            raise ValueError('You must specify a Seq2Seq config \t OR \tencoder_type, encoder_name, and decoder_name \t OR \tencoder_type and encoder_decoder_name')
    self.args = self._load_model_args(encoder_decoder_name)
    if isinstance(args, dict):
        self.args.update_from_dict(args)
    elif isinstance(args, Seq2SeqArgs):
        self.args = args
    if ('sweep_config' in kwargs):
        sweep_config = kwargs.pop('sweep_config')
        sweep_values = {key: value['value'] for (key, value) in sweep_config.as_dict().items() if (key != '_wandb')}
        self.args.update_from_dict(sweep_values)
    if self.args.manual_seed:
        random.seed(self.args.manual_seed)
        np.random.seed(self.args.manual_seed)
        torch.manual_seed(self.args.manual_seed)
        if (self.args.n_gpu > 0):
            torch.cuda.manual_seed_all(self.args.manual_seed)
    if use_cuda:
        if torch.cuda.is_available():
            if (cuda_device == (- 1)):
                self.device = torch.device('cuda')
            else:
                self.device = torch.device(f'cuda:{cuda_device}')
        else:
            raise ValueError("'use_cuda' set to True when cuda is unavailable.Make sure CUDA is available or set `use_cuda=False`.")
    else:
        self.device = 'cpu'
    self.results = {}
    if (not use_cuda):
        self.args.fp16 = False
    if encoder_decoder_type:
        (config_class, model_class, tokenizer_class) = MODEL_CLASSES[encoder_decoder_type]
    else:
        (config_class, model_class, tokenizer_class) = MODEL_CLASSES[encoder_type]
    if (encoder_decoder_type in ['bart', 'marian']):
        self.model = model_class.from_pretrained(encoder_decoder_name)
        if (encoder_decoder_type == 'bart'):
            self.encoder_tokenizer = tokenizer_class.from_pretrained(encoder_decoder_name)
        elif (encoder_decoder_type == 'marian'):
            if self.args.base_marian_model_name:
                self.encoder_tokenizer = tokenizer_class.from_pretrained(self.args.base_marian_model_name)
            else:
                self.encoder_tokenizer = tokenizer_class.from_pretrained(encoder_decoder_name)
        self.decoder_tokenizer = self.encoder_tokenizer
        self.config = self.model.config
    else:
        if encoder_decoder_name:
            self.model = EncoderDecoderModel.from_encoder_decoder_pretrained(os.path.join(encoder_decoder_name, 'encoder'), os.path.join(encoder_decoder_name, 'decoder'))
            self.model.encoder = model_class.from_pretrained(os.path.join(encoder_decoder_name, 'encoder'))
            self.model.decoder = BertForMaskedLM.from_pretrained(os.path.join(encoder_decoder_name, 'decoder'))
            self.encoder_tokenizer = tokenizer_class.from_pretrained(os.path.join(encoder_decoder_name, 'encoder'))
            self.decoder_tokenizer = BertTokenizer.from_pretrained(os.path.join(encoder_decoder_name, 'decoder'))
        else:
            self.model = EncoderDecoderModel.from_encoder_decoder_pretrained(encoder_name, decoder_name, config=config)
            self.encoder_tokenizer = tokenizer_class.from_pretrained(encoder_name)
            self.decoder_tokenizer = BertTokenizer.from_pretrained(decoder_name)
        self.encoder_config = self.model.config.encoder
        self.decoder_config = self.model.config.decoder
    if (self.args.wandb_project and (not wandb_available)):
        warnings.warn('wandb_project specified but wandb is not available. Wandb disabled.')
        self.args.wandb_project = None
    if encoder_decoder_name:
        self.args.model_name = encoder_decoder_name
        self.args.base_marian_model_name = encoder_decoder_name
    elif (encoder_name and decoder_name):
        self.args.model_name = ((encoder_name + '-') + decoder_name)
    else:
        self.args.model_name = 'encoder-decoder'
    if encoder_decoder_type:
        self.args.model_type = encoder_decoder_type
    elif encoder_type:
        self.args.model_type = (encoder_type + '-bert')
    else:
        self.args.model_type = 'encoder-decoder'