

import unittest

from transformers import AutoTokenizer, FalconConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device

from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
						import torch

						from transformers import (
						    FalconForCausalLM,
						    FalconForQuestionAnswering,
						    FalconForSequenceClassification,
						    FalconForTokenClassification,
						    FalconModel,
						)

class 				__UpperCamelCase				:







	def __init__(   self: Optional[Any]  , __UpperCamelCase: Tuple  , __UpperCamelCase: Dict=3  , __UpperCamelCase: str=7  , __UpperCamelCase: Dict=True  , __UpperCamelCase: Tuple=True  , __UpperCamelCase: int=False  , __UpperCamelCase: Optional[Any]=True  , __UpperCamelCase: List[Any]=99  , __UpperCamelCase: Union[str, Any]=32  , __UpperCamelCase: Optional[Any]=5  , __UpperCamelCase: Any=4  , __UpperCamelCase: Tuple=37  , __UpperCamelCase: Optional[int]="gelu"  , __UpperCamelCase: int=0.1  , __UpperCamelCase: Tuple=0.1  , __UpperCamelCase: List[str]=5_12  , __UpperCamelCase: Any=16  , __UpperCamelCase: Any=2  , __UpperCamelCase: int=0.02  , __UpperCamelCase: Dict=3  , __UpperCamelCase: List[Any]=4  , __UpperCamelCase: Optional[int]=None  , ):

					'''simple docstring'''





					__magic_name__							=    parent
					__magic_name__							=    batch_size
					__magic_name__							=    seq_length
					__magic_name__							=    is_training
					__magic_name__							=    use_input_mask
					__magic_name__							=    use_token_type_ids
					__magic_name__							=    use_labels
					__magic_name__							=    vocab_size
					__magic_name__							=    hidden_size
					__magic_name__							=    num_hidden_layers
					__magic_name__							=    num_attention_heads
					__magic_name__							=    intermediate_size
					__magic_name__							=    hidden_act
					__magic_name__							=    hidden_dropout_prob
					__magic_name__							=    attention_probs_dropout_prob
					__magic_name__							=    max_position_embeddings
					__magic_name__							=    type_vocab_size
					__magic_name__							=    type_sequence_label_size
					__magic_name__							=    initializer_range
					__magic_name__							=    num_labels
					__magic_name__							=    num_choices
					__magic_name__							=    scope







	def 	_SCREAMING_SNAKE_CASE							(   self: int      ):

					'''simple docstring'''





					__magic_name__							=    ids_tensor([self.batch_size, self.seq_length]  , self.vocab_size      )

					__magic_name__							=    None
					if self.use_input_mask:
									__magic_name__							=    random_attention_mask([self.batch_size, self.seq_length]      )

					__magic_name__							=    None

					__magic_name__							=    None
					__magic_name__							=    None
					__magic_name__							=    None
					if self.use_labels:
									__magic_name__							=    ids_tensor([self.batch_size]  , self.type_sequence_label_size      )
									__magic_name__							=    ids_tensor([self.batch_size, self.seq_length]  , self.num_labels      )
									__magic_name__							=    ids_tensor([self.batch_size]  , self.num_choices      )

					__magic_name__							=    self.get_config()

					return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels







	def 	_SCREAMING_SNAKE_CASE							(   self: List[Any]      ):

					'''simple docstring'''





					return FalconConfig(
					    vocab_size=self.vocab_size  , hidden_size=self.hidden_size  , num_hidden_layers=self.num_hidden_layers  , num_attention_heads=self.num_attention_heads  , intermediate_size=self.intermediate_size  , hidden_act=self.hidden_act  , hidden_dropout_prob=self.hidden_dropout_prob  , attention_probs_dropout_prob=self.attention_probs_dropout_prob  , max_position_embeddings=self.max_position_embeddings  , type_vocab_size=self.type_vocab_size  , is_decoder=lowerCAmelCase__  , initializer_range=self.initializer_range  , pad_token_id=1  , new_decoder_architecture=lowerCAmelCase__  , )







	def 	_SCREAMING_SNAKE_CASE							(   self: Dict  , __UpperCamelCase: Optional[int]  , __UpperCamelCase: List[Any]  , __UpperCamelCase: Optional[int]  , __UpperCamelCase: Tuple  , __UpperCamelCase: Union[str, Any]  , __UpperCamelCase: str  , __UpperCamelCase: Union[str, Any]      ):

					'''simple docstring'''





					__magic_name__							=    FalconModel(config=lowerCAmelCase__      )
					model.to(lowerCAmelCase__      )
					model.eval()
					__magic_name__							=    model(lowerCAmelCase__  , attention_mask=lowerCAmelCase__      )
					__magic_name__							=    model(lowerCAmelCase__      )
					self.parent.assertEqual(result.last_hidden_state.shape  , (self.batch_size, self.seq_length, self.hidden_size)      )







	def 	_SCREAMING_SNAKE_CASE							(   self: Union[str, Any]  , __UpperCamelCase: Tuple  , __UpperCamelCase: Tuple  , __UpperCamelCase: Union[str, Any]  , __UpperCamelCase: Optional[int]  , __UpperCamelCase: Union[str, Any]  , __UpperCamelCase: str  , __UpperCamelCase: Tuple  , __UpperCamelCase: int  , __UpperCamelCase: Union[str, Any]  , ):

					'''simple docstring'''





					__magic_name__							=    True
					__magic_name__							=    FalconModel(lowerCAmelCase__      )
					model.to(lowerCAmelCase__      )
					model.eval()
					__magic_name__							=    model(
					    lowerCAmelCase__  , attention_mask=lowerCAmelCase__  , encoder_hidden_states=lowerCAmelCase__  , encoder_attention_mask=lowerCAmelCase__  , )
					__magic_name__							=    model(
					    lowerCAmelCase__  , attention_mask=lowerCAmelCase__  , encoder_hidden_states=lowerCAmelCase__  , )
					__magic_name__							=    model(lowerCAmelCase__  , attention_mask=lowerCAmelCase__      )
					self.parent.assertEqual(result.last_hidden_state.shape  , (self.batch_size, self.seq_length, self.hidden_size)      )







	def 	_SCREAMING_SNAKE_CASE							(   self: Optional[Any]  , __UpperCamelCase: List[str]  , __UpperCamelCase: List[Any]  , __UpperCamelCase: int  , __UpperCamelCase: List[Any]  , __UpperCamelCase: int  , __UpperCamelCase: List[str]  , __UpperCamelCase: int  , __UpperCamelCase: Any  , __UpperCamelCase: Dict  , ):

					'''simple docstring'''





					__magic_name__							=    FalconForCausalLM(config=lowerCAmelCase__      )
					model.to(lowerCAmelCase__      )
					model.eval()
					__magic_name__							=    model(lowerCAmelCase__  , attention_mask=lowerCAmelCase__  , labels=lowerCAmelCase__      )
					self.parent.assertEqual(result.logits.shape  , (self.batch_size, self.seq_length, self.vocab_size)      )







	def 	_SCREAMING_SNAKE_CASE							(   self: Union[str, Any]  , __UpperCamelCase: Optional[int]  , __UpperCamelCase: Dict  , __UpperCamelCase: int  , __UpperCamelCase: Optional[int]  , __UpperCamelCase: Tuple  , __UpperCamelCase: Optional[Any]  , __UpperCamelCase: List[Any]  , __UpperCamelCase: str  , __UpperCamelCase: Dict  , ):

					'''simple docstring'''





					__magic_name__							=    True
					__magic_name__							=    True
					__magic_name__							=    FalconForCausalLM(config=lowerCAmelCase__      )
					model.to(lowerCAmelCase__      )
					model.eval()

					# first forward pass
					__magic_name__							=    model(
					    lowerCAmelCase__  , attention_mask=lowerCAmelCase__  , encoder_hidden_states=lowerCAmelCase__  , encoder_attention_mask=lowerCAmelCase__  , use_cache=lowerCAmelCase__  , )
					__magic_name__							=    outputs.past_key_values

					# create hypothetical multiple next token and extent to next_input_ids
					__magic_name__							=    ids_tensor((self.batch_size, 3)  , config.vocab_size      )
					__magic_name__							=    ids_tensor((self.batch_size, 3)  , vocab_size=2      )

					# append to next input_ids and
					__magic_name__							=    torch.cat([input_ids, next_tokens]  , dim=-1      )
					__magic_name__							=    torch.cat([input_mask, next_mask]  , dim=-1      )

					__magic_name__							=    model(
					    lowerCAmelCase__  , attention_mask=lowerCAmelCase__  , encoder_hidden_states=lowerCAmelCase__  , encoder_attention_mask=lowerCAmelCase__  , output_hidden_states=lowerCAmelCase__  , )['hidden_states'][0]
					__magic_name__							=    model(
					    lowerCAmelCase__  , attention_mask=lowerCAmelCase__  , encoder_hidden_states=lowerCAmelCase__  , encoder_attention_mask=lowerCAmelCase__  , past_key_values=lowerCAmelCase__  , output_hidden_states=lowerCAmelCase__  , )['hidden_states'][0]

					# select random slice
					__magic_name__							=    ids_tensor((1,)  , output_from_past.shape[-1]      ).item()
					__magic_name__							=    output_from_no_past[:, -3:, random_slice_idx].detach()
					__magic_name__							=    output_from_past[:, :, random_slice_idx].detach()

					self.parent.assertTrue(output_from_past_slice.shape[1] == next_tokens.shape[1]      )

					# test that outputs are equal for slice
					self.parent.assertTrue(torch.allclose(lowerCAmelCase__  , lowerCAmelCase__  , atol=1E-3      )      )







	def 	_SCREAMING_SNAKE_CASE							(   self: List[str]      ):

					'''simple docstring'''





					__magic_name__							=    self.prepare_config_and_inputs()
					(
					    (
					    __magic_name__	
					),	(
					    __magic_name__	
					),	(
					    __magic_name__	
					),	(
					    __magic_name__	
					),	(
					    __magic_name__	
					),	(
					    __magic_name__	
					),	(
					    __magic_name__	
					),		
					)							=    config_and_inputs
					__magic_name__							=    {'input_ids': input_ids, 'attention_mask': input_mask}
					return config, inputs_dict




@require_torch
class 				__UpperCamelCase				(					_snake_case  ,						_snake_case  ,						_snake_case  ,						unittest.TestCase			):
	_lowercase  :   List[str]       				=  (
	    (
	        FalconModel,
	        FalconForCausalLM,
	        FalconForSequenceClassification,
	        FalconForTokenClassification,
	        FalconForQuestionAnswering,
	    )
	    if is_torch_available()
	    else ()
	)
	_lowercase  :   List[str]       				=  (FalconForCausalLM,) if is_torch_available() else ()
	_lowercase  :   int       				=  (
	    {
	        "feature-extraction": FalconModel,
	        "text-classification": FalconForSequenceClassification,
	        "text-generation": FalconForCausalLM,
	        "question-answering": FalconForQuestionAnswering,
	        "token-classification": FalconForTokenClassification,
	        "zero-shot": FalconForSequenceClassification,
	    }
	    if is_torch_available()
	    else {}
	)
	_lowercase  :   List[str]       				=  False
	_lowercase  :   Optional[int]       				=  False







	def 	_SCREAMING_SNAKE_CASE							(   self: Any      ):

					'''simple docstring'''





					__magic_name__							=    FalconModelTester(self      )
					__magic_name__							=    ConfigTester(self  , config_class=lowerCAmelCase__  , hidden_size=37      )







	def 	_SCREAMING_SNAKE_CASE							(   self: List[str]      ):

					'''simple docstring'''





					self.config_tester.run_common_tests()







	def 	_SCREAMING_SNAKE_CASE							(   self: List[str]      ):

					'''simple docstring'''





					__magic_name__							=    self.model_tester.prepare_config_and_inputs()
					self.model_tester.create_and_check_model(*lowerCAmelCase__      )







	def 	_SCREAMING_SNAKE_CASE							(   self: Any      ):

					'''simple docstring'''





					__magic_name__,	*__magic_name__							=    self.model_tester.prepare_config_and_inputs()
					for alibi in [True, False]:
									__magic_name__							=    alibi
									self.model_tester.create_and_check_model(lowerCAmelCase__  , *lowerCAmelCase__      )







	def 	_SCREAMING_SNAKE_CASE							(   self: Dict      ):

					'''simple docstring'''





					__magic_name__,	__magic_name__							=    self.model_tester.prepare_config_and_inputs_for_common()
					__magic_name__							=    3
					__magic_name__							=    input_dict['input_ids']
					__magic_name__							=    input_ids.ne(1      ).to(lowerCAmelCase__      )
					__magic_name__							=    ids_tensor([self.model_tester.batch_size]  , self.model_tester.type_sequence_label_size      )
					__magic_name__							=    FalconForSequenceClassification(lowerCAmelCase__      )
					model.to(lowerCAmelCase__      )
					model.eval()
					__magic_name__							=    model(lowerCAmelCase__  , attention_mask=lowerCAmelCase__  , labels=lowerCAmelCase__      )
					self.assertEqual(result.logits.shape  , (self.model_tester.batch_size, self.model_tester.num_labels)      )







	def 	_SCREAMING_SNAKE_CASE							(   self: Optional[Any]      ):

					'''simple docstring'''





					__magic_name__,	__magic_name__							=    self.model_tester.prepare_config_and_inputs_for_common()
					__magic_name__							=    3
					__magic_name__							=    'single_label_classification'
					__magic_name__							=    input_dict['input_ids']
					__magic_name__							=    input_ids.ne(1      ).to(lowerCAmelCase__      )
					__magic_name__							=    ids_tensor([self.model_tester.batch_size]  , self.model_tester.type_sequence_label_size      )
					__magic_name__							=    FalconForSequenceClassification(lowerCAmelCase__      )
					model.to(lowerCAmelCase__      )
					model.eval()
					__magic_name__							=    model(lowerCAmelCase__  , attention_mask=lowerCAmelCase__  , labels=lowerCAmelCase__      )
					self.assertEqual(result.logits.shape  , (self.model_tester.batch_size, self.model_tester.num_labels)      )







	def 	_SCREAMING_SNAKE_CASE							(   self: List[str]      ):

					'''simple docstring'''





					__magic_name__,	__magic_name__							=    self.model_tester.prepare_config_and_inputs_for_common()
					__magic_name__							=    input_dict['input_ids']
					__magic_name__							=    FalconForCausalLM(lowerCAmelCase__      )
					model.to(lowerCAmelCase__      )
					model.eval()
					__magic_name__							=    model(lowerCAmelCase__  , use_cache=lowerCAmelCase__      )
					__magic_name__							=    input_ids.shape[0]
					__magic_name__							=    model._convert_to_rw_cache(result.past_key_values      )
					__magic_name__							=    model._convert_cache_to_standard_format(lowerCAmelCase__  , lowerCAmelCase__      )
					for layer in range(len(lowerCAmelCase__      )      ):
									for tensor_idx in range(2      ):
													self.assertTrue(rw_cache[layer][tensor_idx].ndim == 3      )
													self.assertTrue(result.past_key_values[layer][tensor_idx].ndim == 4      )
													self.assertTrue(
													    torch.all(result.past_key_values[layer][tensor_idx] == standard_cache[layer][tensor_idx]      )      )







	def 	_SCREAMING_SNAKE_CASE							(   self: List[str]      ):

					'''simple docstring'''





					__magic_name__,	__magic_name__							=    self.model_tester.prepare_config_and_inputs_for_common()
					__magic_name__							=    3
					__magic_name__							=    'multi_label_classification'
					__magic_name__							=    input_dict['input_ids']
					__magic_name__							=    input_ids.ne(1      ).to(lowerCAmelCase__      )
					__magic_name__							=    ids_tensor(
					    [self.model_tester.batch_size, config.num_labels]  , self.model_tester.type_sequence_label_size      ).to(torch.float      )
					__magic_name__							=    FalconForSequenceClassification(lowerCAmelCase__      )
					model.to(lowerCAmelCase__      )
					model.eval()
					__magic_name__							=    model(lowerCAmelCase__  , attention_mask=lowerCAmelCase__  , labels=lowerCAmelCase__      )
					self.assertEqual(result.logits.shape  , (self.model_tester.batch_size, self.model_tester.num_labels)      )







	def 	_SCREAMING_SNAKE_CASE							(   self: Union[str, Any]      ):

					'''simple docstring'''





					for model_class in self.all_generative_model_classes:
									__magic_name__,	__magic_name__							=    self.model_tester.prepare_config_and_inputs_for_common()

									# If it doesn't support cache, pass the test
									if not hasattr(lowerCAmelCase__  , 'use_cache'      ):
													return

									__magic_name__							=    model_class(lowerCAmelCase__      ).to(lowerCAmelCase__      )
									if "use_cache" not in inputs:
													__magic_name__							=    True
									__magic_name__							=    model(**lowerCAmelCase__      )

									# If "past_key_values" is not returned, pass the test (e.g. RWKV uses a different cache name and format)
									if "past_key_values" not in outputs:
													return

									__magic_name__							=    (
									    getattr(lowerCAmelCase__  , 'decoder_layers'  , lowerCAmelCase__      )
									    or getattr(lowerCAmelCase__  , 'num_decoder_layers'  , lowerCAmelCase__      )
									    or config.num_hidden_layers
									)
									__magic_name__							=    getattr(lowerCAmelCase__  , 'num_kv_heads'  , config.num_attention_heads      )
									__magic_name__							=    getattr(lowerCAmelCase__  , 'd_model'  , config.hidden_size      )
									__magic_name__							=    embed_dim // num_attention_heads

									__magic_name__							=    outputs['past_key_values']
									self.assertEqual(len(lowerCAmelCase__      )  , lowerCAmelCase__      )

									__magic_name__,	__magic_name__							=    inputs['input_ids'].shape
									for i in range(lowerCAmelCase__      ):
													if config.new_decoder_architecture:
																	__magic_name__							=    config.num_attention_heads
													elif config.multi_query:
																	__magic_name__							=    1
													self.assertEqual(len(past_kv[0]      )  , 2      )  # K V for the decoder = 2
													self.assertEqual(
													    past_kv[i][0].shape  , (batch_size, num_attention_heads, seq_length, per_head_embed_dim)      )
													self.assertEqual(
													    past_kv[i][1].shape  , (batch_size, num_attention_heads, seq_length, per_head_embed_dim)      )




@require_torch
class 				__UpperCamelCase				(					unittest.TestCase			):







	@slow
	def 	_SCREAMING_SNAKE_CASE							(   self: Optional[Any]      ):

					'''simple docstring'''





					__magic_name__							=    AutoTokenizer.from_pretrained('Rocketknight1/falcon-rw-1b'      )
					__magic_name__							=    FalconForCausalLM.from_pretrained('Rocketknight1/falcon-rw-1b'      )
					model.eval()
					model.to(lowerCAmelCase__      )
					__magic_name__							=    tokenizer('My favorite food is'  , return_tensors='pt'      ).to(lowerCAmelCase__      )

					__magic_name__							=    (
					    'My favorite food is pizza. I love it so much that I have a pizza party every year for my birthday.'
					)

					__magic_name__							=    model.generate(**lowerCAmelCase__  , do_sample=lowerCAmelCase__  , max_new_tokens=19      )
					__magic_name__							=    tokenizer.batch_decode(lowerCAmelCase__      )[0]

					self.assertEqual(lowerCAmelCase__  , lowerCAmelCase__      )







	@slow
	def 	_SCREAMING_SNAKE_CASE							(   self: Optional[int]      ):

					'''simple docstring'''





					for repo in ["Rocketknight1/tiny-random-falcon-7b", "Rocketknight1/tiny-random-falcon-40b"]:
									__magic_name__							=    AutoTokenizer.from_pretrained(lowerCAmelCase__      )
									__magic_name__							=    FalconForCausalLM.from_pretrained(lowerCAmelCase__      )
									model.eval()
									model.to(lowerCAmelCase__      )
									__magic_name__							=    tokenizer('My favorite food is'  , return_tensors='pt'      ).to(lowerCAmelCase__      )

									# We just test that these run without errors - the models are randomly initialized
									# and so the actual text outputs will be garbage
									model.generate(**lowerCAmelCase__  , do_sample=lowerCAmelCase__  , max_new_tokens=4      )
									model.generate(**lowerCAmelCase__  , do_sample=lowerCAmelCase__  , max_new_tokens=4      )
									model.generate(**lowerCAmelCase__  , num_beams=2  , max_new_tokens=4      )







	@slow
	def 	_SCREAMING_SNAKE_CASE							(   self: List[str]      ):

					'''simple docstring'''





					with torch.no_grad():
									for repo in [
									    "Rocketknight1/falcon-rw-1b",
									    "Rocketknight1/tiny-random-falcon-7b",
									    "Rocketknight1/tiny-random-falcon-40b",
									]:
													__magic_name__							=    AutoTokenizer.from_pretrained(lowerCAmelCase__      )
													__magic_name__							=    FalconForCausalLM.from_pretrained(lowerCAmelCase__      )
													model.eval()
													model.to(device=lowerCAmelCase__      )
													__magic_name__							=    tokenizer('My favorite food is'  , return_tensors='pt'      ).to(lowerCAmelCase__      )

													# Test results are the same with and without cache
													__magic_name__							=    model.generate(**lowerCAmelCase__  , do_sample=lowerCAmelCase__  , max_new_tokens=20  , use_cache=lowerCAmelCase__      )
													__magic_name__							=    model.generate(**lowerCAmelCase__  , do_sample=lowerCAmelCase__  , max_new_tokens=20  , use_cache=lowerCAmelCase__      )
													self.assertTrue((outputs_cache - outputs_no_cache).sum().item() == 0      )







import argparse
from pathlib import Path

from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration




def 					_lowercase     (				a_				:					str					,a_				:					str					,a_				:					str					,a_				:					Path					,a_				:					str = None					,a_				:					str = None					,a_				:					str = None					,)				->	Tuple:




					'''simple docstring'''







					if config_name_or_path is None:
										__magic_name__							=    'facebook/rag-token-base' if model_type == 'rag_token' else 'facebook/rag-sequence-base'

					if generator_tokenizer_name_or_path is None:
										__magic_name__							=    generator_name_or_path

					if question_encoder_tokenizer_name_or_path is None:
										__magic_name__							=    question_encoder_name_or_path

					__magic_name__							=    RagTokenForGeneration if model_type == 'rag_token' else RagSequenceForGeneration

					# Save model.
					__magic_name__							=    RagConfig.from_pretrained(a_				)
					__magic_name__							=    AutoConfig.from_pretrained(a_				)
					__magic_name__							=    AutoConfig.from_pretrained(a_				)

					__magic_name__							=    gen_config
					__magic_name__							=    question_encoder_config

					__magic_name__							=    model_class.from_pretrained_question_encoder_generator(
					    a_					,a_					,config=a_				)
					rag_model.save_pretrained(a_				)

					# Sanity check.
					model_class.from_pretrained(a_				)

					# Save tokenizers.
					__magic_name__							=    AutoTokenizer.from_pretrained(a_				)
					gen_tokenizer.save_pretrained(dest_dir / 'generator_tokenizer/'				)
					__magic_name__							=    AutoTokenizer.from_pretrained(a_				)
					question_encoder_tokenizer.save_pretrained(dest_dir / 'question_encoder_tokenizer/'				)


if __name__ == "__main__":
						A__						=							argparse.ArgumentParser()
						parser.add_argument(
						    "--model_type",
						    choices=["rag_sequence", "rag_token"],
						    required=True,
						    type=str,
						    help="RAG model type: rag_sequence, rag_token",
						)
						parser.add_argument("--dest", type=str, required=True, help="Path to the output checkpoint directory.")
						parser.add_argument("--generator_name_or_path", type=str, required=True, help="Generator model identifier")
						parser.add_argument(
						    "--question_encoder_name_or_path", type=str, required=True, help="Question encoder model identifier"
						)

						parser.add_argument(
						    "--generator_tokenizer_name_or_path",
						    type=str,
						    help="Generator tokenizer identifier, if not specified, resolves to ``generator_name_or_path``",
						)
						parser.add_argument(
						    "--question_encoder_tokenizer_name_or_path",
						    type=str,
						    help="Question encoder tokenizer identifier, if not specified, resolves to ``question_encoder_name_or_path``",
						)
						parser.add_argument(
						    "--config_name_or_path",
						    type=str,
						    help=(
						        "Identifier of the model config to use, if not provided, resolves to a base config for a given"
						        " ``model_type``"
						    ),
						)

						A__						=							parser.parse_args()

						A__						=							Path(args.dest)
						dest_dir.mkdir(exist_ok=True)

						consolidate(
						    args.model_type,
						    args.generator_name_or_path,
						    args.question_encoder_name_or_path,
						    dest_dir,
						    args.config_name_or_path,
						    args.generator_tokenizer_name_or_path,
						    args.question_encoder_tokenizer_name_or_path,
						)




