


'''simple docstring'''



import inspect
import unittest

import numpy as np

from tests.test_modeling_common import floats_tensor
from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available
from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device
from transformers.utils import cached_property

from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
	import torch

	from transformers import MaskFormerForInstanceSegmentation, MaskFormerModel

	if is_vision_available():
		from transformers import MaskFormerImageProcessor

if is_vision_available():
	from PIL import Image






class  UpperCamelCase__:




				def __init__(	self    :				int   ,					lowerCAmelCase    :				Dict   ,					lowerCAmelCase    :				List[Any]=2   ,					lowerCAmelCase    :				List[Any]=True   ,					lowerCAmelCase    :				Optional[int]=False   ,					lowerCAmelCase    :				Union[str, Any]=10   ,					lowerCAmelCase    :				Dict=3   ,					lowerCAmelCase    :				str=32 * 4   ,					lowerCAmelCase    :				int=32 * 6   ,					lowerCAmelCase    :				Optional[int]=4   ,					lowerCAmelCase    :				Any=32   ,					)->  Any:

										"""simple docstring"""




										UpperCAmelCase         =			parent
										UpperCAmelCase         =			batch_size
										UpperCAmelCase         =			is_training
										UpperCAmelCase         =			use_auxiliary_loss
										UpperCAmelCase         =			num_queries
										UpperCAmelCase         =			num_channels
										UpperCAmelCase         =			min_size
										UpperCAmelCase         =			max_size
										UpperCAmelCase         =			num_labels
										UpperCAmelCase         =			mask_feature_size




				def   a__(	self    :				Tuple   )->  Any:

										"""simple docstring"""




										UpperCAmelCase         =			floats_tensor([self.batch_size, self.num_channels, self.min_size, self.max_size]   ).to(
										    snake_case_   )

										UpperCAmelCase         =			torch.ones([self.batch_size, self.min_size, self.max_size]   ,					device=snake_case_   )

										UpperCAmelCase         =			(
										    torch.rand([self.batch_size, self.num_labels, self.min_size, self.max_size]   ,					device=snake_case_   ) > 0.5
										).float()
										UpperCAmelCase         =			(torch.rand((self.batch_size, self.num_labels)   ,					device=snake_case_   ) > 0.5).long()

										UpperCAmelCase         =			self.get_config()
										return config, pixel_values, pixel_mask, mask_labels, class_labels




				def   a__(	self    :				List[str]   )->  Optional[int]:

										"""simple docstring"""




										return MaskFormerConfig.from_backbone_and_decoder_configs(
										    backbone_config=SwinConfig(
										        depths=[1, 1, 1, 1]   ,					)   ,					decoder_config=DetrConfig(
										        decoder_ffn_dim=128   ,					num_queries=self.num_queries   ,					decoder_attention_heads=2   ,					d_model=self.mask_feature_size   ,					)   ,					mask_feature_size=self.mask_feature_size   ,					fpn_feature_size=self.mask_feature_size   ,					num_channels=self.num_channels   ,					num_labels=self.num_labels   ,					)




				def   a__(	self    :				Optional[Any]   )->  Dict:

										"""simple docstring"""




										UpperCAmelCase       ,       UpperCAmelCase       ,       UpperCAmelCase       ,       UpperCAmelCase       ,       UpperCAmelCase         =			self.prepare_config_and_inputs()
										UpperCAmelCase         =			{'''pixel_values''': pixel_values, '''pixel_mask''': pixel_mask}
										return config, inputs_dict




				def   a__(	self    :				Tuple   ,					lowerCAmelCase    :				Union[str, Any]   ,					lowerCAmelCase    :				List[Any]   )->  int:

										"""simple docstring"""




										UpperCAmelCase         =			output.encoder_hidden_states
										UpperCAmelCase         =			output.pixel_decoder_hidden_states
										UpperCAmelCase         =			output.transformer_decoder_hidden_states

										self.parent.assertTrue(len(snake_case_   )   ,					len(config.backbone_config.depths   )   )
										self.parent.assertTrue(len(snake_case_   )   ,					len(config.backbone_config.depths   )   )
										self.parent.assertTrue(len(snake_case_   )   ,					config.decoder_config.decoder_layers   )




				def   a__(	self    :				Dict   ,					lowerCAmelCase    :				List[Any]   ,					lowerCAmelCase    :				str   ,					lowerCAmelCase    :				Optional[Any]   ,					lowerCAmelCase    :				Optional[Any]=False   )->  Optional[Any]:

										"""simple docstring"""




										with torch.no_grad():
																UpperCAmelCase         =			MaskFormerModel(config=snake_case_   )
																model.to(snake_case_   )
																model.eval()

																UpperCAmelCase         =			model(pixel_values=snake_case_   ,					pixel_mask=snake_case_   )
																UpperCAmelCase         =			model(snake_case_   ,					output_hidden_states=snake_case_   )
										# the correct shape of output.transformer_decoder_hidden_states ensure the correcteness of the
										# encoder and pixel decoder
										self.parent.assertEqual(
										    output.transformer_decoder_last_hidden_state.shape   ,					(self.batch_size, self.num_queries, self.mask_feature_size)   ,					)
										# let's ensure the other two hidden state exists
										self.parent.assertTrue(output.pixel_decoder_last_hidden_state is not None   )
										self.parent.assertTrue(output.encoder_last_hidden_state is not None   )

										if output_hidden_states:
																self.check_output_hidden_state(snake_case_   ,					snake_case_   )





				def   a__(	self    :				List[str]   ,					lowerCAmelCase    :				Any   ,					lowerCAmelCase    :				Tuple   ,					lowerCAmelCase    :				str   ,					lowerCAmelCase    :				Any   ,					lowerCAmelCase    :				List[Any]   )->  str:

										"""simple docstring"""




										UpperCAmelCase         =			MaskFormerForInstanceSegmentation(config=snake_case_   )
										model.to(snake_case_   )
										model.eval()

										def comm_check_on_output(lowerCAmelCase    :				Tuple   ):
																# let's still check that all the required stuff is there
																self.parent.assertTrue(result.transformer_decoder_last_hidden_state is not None   )
																self.parent.assertTrue(result.pixel_decoder_last_hidden_state is not None   )
																self.parent.assertTrue(result.encoder_last_hidden_state is not None   )
																# okay, now we need to check the logits shape
																# due to the encoder compression, masks have a //4 spatial size
																self.parent.assertEqual(
																    result.masks_queries_logits.shape   ,					(self.batch_size, self.num_queries, self.min_size // 4, self.max_size // 4)   ,					)
																# + 1 for null class
																self.parent.assertEqual(
																    result.class_queries_logits.shape   ,					(self.batch_size, self.num_queries, self.num_labels + 1)   )

										with torch.no_grad():
																UpperCAmelCase         =			model(pixel_values=snake_case_   ,					pixel_mask=snake_case_   )
																UpperCAmelCase         =			model(snake_case_   )

																comm_check_on_output(snake_case_   )

																UpperCAmelCase         =			model(
																    pixel_values=snake_case_   ,					pixel_mask=snake_case_   ,					mask_labels=snake_case_   ,					class_labels=snake_case_   )

										comm_check_on_output(snake_case_   )

										self.parent.assertTrue(result.loss is not None   )
										self.parent.assertEqual(result.loss.shape   ,					torch.Size([1]   )   )







@require_torch
class  UpperCamelCase__(     _a		,       _a		,       unittest.TestCase ):
				__magic_name__       :   Union[str, Any]							= (MaskFormerModel, MaskFormerForInstanceSegmentation) if is_torch_available() else ()
				__magic_name__       :   List[Any]							= (
				    {"""feature-extraction""": MaskFormerModel, """image-segmentation""": MaskFormerForInstanceSegmentation}
				    if is_torch_available()
				    else {}
				)

				__magic_name__       :   Union[str, Any]							= False
				__magic_name__       :   Optional[int]							= False
				__magic_name__       :   int							= False
				__magic_name__       :   List[Any]							= False




				def   a__(	self    :				Any   )->  Union[str, Any]:

										"""simple docstring"""




										UpperCAmelCase         =			MaskFormerModelTester(self   )
										UpperCAmelCase         =			ConfigTester(self   ,					config_class=snake_case_   ,					has_text_modality=snake_case_   )




				def   a__(	self    :				Any   )->  Any:

										"""simple docstring"""




										self.config_tester.run_common_tests()




				def   a__(	self    :				Optional[Any]   )->  Optional[int]:

										"""simple docstring"""




										UpperCAmelCase       ,       UpperCAmelCase         =			self.model_tester.prepare_config_and_inputs_for_common()
										self.model_tester.create_and_check_maskformer_model(snake_case_   ,					**snake_case_   ,					output_hidden_states=snake_case_   )




				def   a__(	self    :				List[str]   )->  str:

										"""simple docstring"""




										UpperCAmelCase         =			self.model_tester.prepare_config_and_inputs()
										self.model_tester.create_and_check_maskformer_instance_segmentation_head_model(*snake_case_   )




				@unittest.skip(reason='''MaskFormer does not use inputs_embeds'''   )
				def   a__(	self    :				Dict   )->  Union[str, Any]:

										"""simple docstring"""




										pass




				@unittest.skip(reason='''MaskFormer does not have a get_input_embeddings method'''   )
				def   a__(	self    :				Tuple   )->  str:

										"""simple docstring"""




										pass




				@unittest.skip(reason='''MaskFormer is not a generative model'''   )
				def   a__(	self    :				Optional[Any]   )->  int:

										"""simple docstring"""




										pass




				@unittest.skip(reason='''MaskFormer does not use token embeddings'''   )
				def   a__(	self    :				Any   )->  int:

										"""simple docstring"""




										pass




				@require_torch_multi_gpu
				@unittest.skip(
				    reason='''MaskFormer has some layers using `add_module` which doesn\'t work well with `nn.DataParallel`'''   )
				def   a__(	self    :				Optional[int]   )->  Dict:

										"""simple docstring"""




										pass




				@unittest.skip('''Will be fixed soon by reducing the size of the model used for common tests.'''   )
				def   a__(	self    :				Any   )->  Any:

										"""simple docstring"""




										pass




				def   a__(	self    :				Union[str, Any]   )->  List[Any]:

										"""simple docstring"""




										UpperCAmelCase       ,       UpperCAmelCase         =			self.model_tester.prepare_config_and_inputs_for_common()

										for model_class in self.all_model_classes:
																UpperCAmelCase         =			model_class(snake_case_   )
																UpperCAmelCase         =			inspect.signature(model.forward   )
																# signature.parameters is an OrderedDict => so arg_names order is deterministic
																UpperCAmelCase         =			[*signature.parameters.keys()]

																UpperCAmelCase         =			['''pixel_values''']
																self.assertListEqual(arg_names[:1]   ,					snake_case_   )




				@slow
				def   a__(	self    :				str   )->  Dict:

										"""simple docstring"""




										for model_name in ["facebook/maskformer-swin-small-coco"]:
																UpperCAmelCase         =			MaskFormerModel.from_pretrained(snake_case_   )
																self.assertIsNotNone(snake_case_   )




				def   a__(	self    :				Any   )->  int:

										"""simple docstring"""




										UpperCAmelCase         =			(self.model_tester.min_size,) * 2
										UpperCAmelCase         =			{
										    '''pixel_values''': torch.randn((2, 3, *size)   ,					device=snake_case_   ),
										    '''mask_labels''': torch.randn((2, 10, *size)   ,					device=snake_case_   ),
										    '''class_labels''': torch.zeros(2   ,					10   ,					device=snake_case_   ).long(),
										}

										UpperCAmelCase         =			MaskFormerForInstanceSegmentation(MaskFormerConfig()   ).to(snake_case_   )
										UpperCAmelCase         =			model(**snake_case_   )
										self.assertTrue(outputs.loss is not None   )




				def   a__(	self    :				Optional[int]   )->  Dict:

										"""simple docstring"""




										UpperCAmelCase       ,       UpperCAmelCase         =			self.model_tester.prepare_config_and_inputs_for_common()
										self.model_tester.create_and_check_maskformer_model(snake_case_   ,					**snake_case_   ,					output_hidden_states=snake_case_   )




				def   a__(	self    :				Union[str, Any]   )->  List[str]:

										"""simple docstring"""




										UpperCAmelCase       ,       UpperCAmelCase         =			self.model_tester.prepare_config_and_inputs_for_common()

										for model_class in self.all_model_classes:
																UpperCAmelCase         =			model_class(snake_case_   ).to(snake_case_   )
																UpperCAmelCase         =			model(**snake_case_   ,					output_attentions=snake_case_   )
																self.assertTrue(outputs.attentions is not None   )




				def   a__(	self    :				Any   )->  str:

										"""simple docstring"""




										if not self.model_tester.is_training:
																return
										# only MaskFormerForInstanceSegmentation has the loss
										UpperCAmelCase         =			self.all_model_classes[1]
										UpperCAmelCase       ,       UpperCAmelCase       ,       UpperCAmelCase       ,       UpperCAmelCase       ,       UpperCAmelCase         =			self.model_tester.prepare_config_and_inputs()

										UpperCAmelCase         =			model_class(snake_case_   )
										model.to(snake_case_   )
										model.train()

										UpperCAmelCase         =			model(snake_case_   ,					mask_labels=snake_case_   ,					class_labels=snake_case_   ).loss
										loss.backward()





				def   a__(	self    :				Union[str, Any]   )->  int:

										"""simple docstring"""




										UpperCAmelCase         =			self.all_model_classes[1]
										UpperCAmelCase       ,       UpperCAmelCase       ,       UpperCAmelCase       ,       UpperCAmelCase       ,       UpperCAmelCase         =			self.model_tester.prepare_config_and_inputs()
										UpperCAmelCase         =			True
										UpperCAmelCase         =			True

										UpperCAmelCase         =			model_class(snake_case_   )
										model.to(snake_case_   )
										model.train()

										UpperCAmelCase         =			model(snake_case_   ,					mask_labels=snake_case_   ,					class_labels=snake_case_   )

										UpperCAmelCase         =			outputs.encoder_hidden_states[0]
										encoder_hidden_states.retain_grad()

										UpperCAmelCase         =			outputs.pixel_decoder_hidden_states[0]
										pixel_decoder_hidden_states.retain_grad()
										# we requires_grad=True in inputs_embeds (line 2152), the original implementation don't
										UpperCAmelCase         =			outputs.transformer_decoder_hidden_states[0]
										transformer_decoder_hidden_states.retain_grad()

										UpperCAmelCase         =			outputs.attentions[0]
										attentions.retain_grad()

										outputs.loss.backward(retain_graph=snake_case_   )

										self.assertIsNotNone(encoder_hidden_states.grad   )
										self.assertIsNotNone(pixel_decoder_hidden_states.grad   )
										self.assertIsNotNone(transformer_decoder_hidden_states.grad   )
										self.assertIsNotNone(attentions.grad   )







_lowercase    :    Any			 =  1E-4


def    lowerCamelCase__   ( ):




						'''simple docstring'''






						UpperCAmelCase         =			Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png'''  )
						return image






@require_vision
@slow
class  UpperCamelCase__(     unittest.TestCase ):




				@cached_property
				def   a__(	self    :				List[str]   )->  Optional[Any]:

										"""simple docstring"""




										return (
										    MaskFormerImageProcessor.from_pretrained('''facebook/maskformer-swin-small-coco'''   )
										    if is_vision_available()
										    else None
										)




				def   a__(	self    :				Tuple   )->  Optional[Any]:

										"""simple docstring"""




										UpperCAmelCase         =			MaskFormerModel.from_pretrained('''facebook/maskformer-swin-small-coco'''   ).to(snake_case_   )
										UpperCAmelCase         =			self.default_image_processor
										UpperCAmelCase         =			prepare_img()
										UpperCAmelCase         =			image_processor(snake_case_   ,					return_tensors='''pt'''   ).to(snake_case_   )
										UpperCAmelCase         =			inputs['''pixel_values'''].shape
										# check size is divisible by 32
										self.assertTrue((inputs_shape[-1] % 32) == 0 and (inputs_shape[-2] % 32) == 0   )
										# check size
										self.assertEqual(snake_case_   ,					(1, 3, 800, 1088)   )

										with torch.no_grad():
																UpperCAmelCase         =			model(**snake_case_   )

										UpperCAmelCase         =			torch.tensor(
										    [[-0.0482, 0.9228, 0.4951], [-0.2547, 0.8017, 0.8527], [-0.0069, 0.3385, -0.0089]]   ).to(snake_case_   )
										self.assertTrue(
										    torch.allclose(
										        outputs.encoder_last_hidden_state[0, 0, :3, :3]   ,					snake_case_   ,					atol=snake_case_   )   )

										UpperCAmelCase         =			torch.tensor(
										    [[-0.8422, -0.8434, -0.9718], [-1.0144, -0.5565, -0.4195], [-1.0038, -0.4484, -0.1961]]   ).to(snake_case_   )
										self.assertTrue(
										    torch.allclose(
										        outputs.pixel_decoder_last_hidden_state[0, 0, :3, :3]   ,					snake_case_   ,					atol=snake_case_   )   )

										UpperCAmelCase         =			torch.tensor(
										    [[0.2852, -0.0159, 0.9735], [0.6254, 0.1858, 0.8529], [-0.0680, -0.4116, 1.8413]]   ).to(snake_case_   )
										self.assertTrue(
										    torch.allclose(
										        outputs.transformer_decoder_last_hidden_state[0, :3, :3]   ,					snake_case_   ,					atol=snake_case_   )   )




				def   a__(	self    :				Tuple   )->  Optional[int]:

										"""simple docstring"""




										UpperCAmelCase         =			(
										    MaskFormerForInstanceSegmentation.from_pretrained('''facebook/maskformer-swin-small-coco'''   )
										    .to(snake_case_   )
										    .eval()
										)
										UpperCAmelCase         =			self.default_image_processor
										UpperCAmelCase         =			prepare_img()
										UpperCAmelCase         =			image_processor(snake_case_   ,					return_tensors='''pt'''   ).to(snake_case_   )
										UpperCAmelCase         =			inputs['''pixel_values'''].shape
										# check size is divisible by 32
										self.assertTrue((inputs_shape[-1] % 32) == 0 and (inputs_shape[-2] % 32) == 0   )
										# check size
										self.assertEqual(snake_case_   ,					(1, 3, 800, 1088)   )

										with torch.no_grad():
																UpperCAmelCase         =			model(**snake_case_   )
										# masks_queries_logits
										UpperCAmelCase         =			outputs.masks_queries_logits
										self.assertEqual(
										    masks_queries_logits.shape   ,					(1, model.config.decoder_config.num_queries, inputs_shape[-2] // 4, inputs_shape[-1] // 4)   ,					)
										UpperCAmelCase         =			[
										    [-1.3737124, -1.7724937, -1.9364233],
										    [-1.5977281, -1.9867939, -2.1523695],
										    [-1.5795398, -1.9269832, -2.093942],
										]
										UpperCAmelCase         =			torch.tensor(snake_case_   ).to(snake_case_   )
										self.assertTrue(torch.allclose(masks_queries_logits[0, 0, :3, :3]   ,					snake_case_   ,					atol=snake_case_   )   )
										# class_queries_logits
										UpperCAmelCase         =			outputs.class_queries_logits
										self.assertEqual(
										    class_queries_logits.shape   ,					(1, model.config.decoder_config.num_queries, model.config.num_labels + 1)   )
										UpperCAmelCase         =			torch.tensor(
										    [
										        [1.6512E00, -5.2572E00, -3.3519E00],
										        [3.6169E-02, -5.9025E00, -2.9313E00],
										        [1.0766E-04, -7.7630E00, -5.1263E00],
										    ]   ).to(snake_case_   )
										self.assertTrue(torch.allclose(outputs.class_queries_logits[0, :3, :3]   ,					snake_case_   ,					atol=snake_case_   )   )




				def   a__(	self    :				int   )->  List[str]:

										"""simple docstring"""




										UpperCAmelCase         =			(
										    MaskFormerForInstanceSegmentation.from_pretrained('''facebook/maskformer-resnet101-coco-stuff'''   )
										    .to(snake_case_   )
										    .eval()
										)
										UpperCAmelCase         =			self.default_image_processor
										UpperCAmelCase         =			prepare_img()
										UpperCAmelCase         =			image_processor(snake_case_   ,					return_tensors='''pt'''   ).to(snake_case_   )
										UpperCAmelCase         =			inputs['''pixel_values'''].shape
										# check size is divisible by 32
										self.assertTrue((inputs_shape[-1] % 32) == 0 and (inputs_shape[-2] % 32) == 0   )
										# check size
										self.assertEqual(snake_case_   ,					(1, 3, 800, 1088)   )

										with torch.no_grad():
																UpperCAmelCase         =			model(**snake_case_   )
										# masks_queries_logits
										UpperCAmelCase         =			outputs.masks_queries_logits
										self.assertEqual(
										    masks_queries_logits.shape   ,					(1, model.config.decoder_config.num_queries, inputs_shape[-2] // 4, inputs_shape[-1] // 4)   ,					)
										UpperCAmelCase         =			[[-0.9046, -2.6366, -4.6062], [-3.4179, -5.7890, -8.8057], [-4.9179, -7.6560, -10.7711]]
										UpperCAmelCase         =			torch.tensor(snake_case_   ).to(snake_case_   )
										self.assertTrue(torch.allclose(masks_queries_logits[0, 0, :3, :3]   ,					snake_case_   ,					atol=snake_case_   )   )
										# class_queries_logits
										UpperCAmelCase         =			outputs.class_queries_logits
										self.assertEqual(
										    class_queries_logits.shape   ,					(1, model.config.decoder_config.num_queries, model.config.num_labels + 1)   )
										UpperCAmelCase         =			torch.tensor(
										    [[4.7188, -3.2585, -2.8857], [6.6871, -2.9181, -1.2487], [7.2449, -2.2764, -2.1874]]   ).to(snake_case_   )
										self.assertTrue(torch.allclose(outputs.class_queries_logits[0, :3, :3]   ,					snake_case_   ,					atol=snake_case_   )   )





				def   a__(	self    :				Dict   )->  Any:

										"""simple docstring"""




										UpperCAmelCase         =			(
										    MaskFormerForInstanceSegmentation.from_pretrained('''facebook/maskformer-swin-small-coco'''   )
										    .to(snake_case_   )
										    .eval()
										)
										UpperCAmelCase         =			self.default_image_processor

										UpperCAmelCase         =			image_processor(
										    [np.zeros((3, 800, 1333)   ), np.zeros((3, 800, 1333)   )]   ,					segmentation_maps=[np.zeros((384, 384)   ).astype(np.floataa   ), np.zeros((384, 384)   ).astype(np.floataa   )]   ,					return_tensors='''pt'''   ,					)

										UpperCAmelCase         =			inputs['''pixel_values'''].to(snake_case_   )
										UpperCAmelCase         =			[el.to(snake_case_   ) for el in inputs['''mask_labels''']]
										UpperCAmelCase         =			[el.to(snake_case_   ) for el in inputs['''class_labels''']]

										with torch.no_grad():
																UpperCAmelCase         =			model(**snake_case_   )

										self.assertTrue(outputs.loss is not None   )









'''simple docstring'''



from argparse import ArgumentParser

from . import BaseTransformersCLICommand


def    lowerCamelCase__   ( A     :    List[Any]  ):




						'''simple docstring'''






						return DownloadCommand(args.model   ,     args.cache_dir   ,     args.force   ,     args.trust_remote_code  )






class  UpperCamelCase__(     lowerCAmelCase ):




				@staticmethod
				def   a__(	lowerCAmelCase    :				ArgumentParser   )->  Optional[Any]:

										"""simple docstring"""




										UpperCAmelCase         =			parser.add_parser('''download'''   )
										download_parser.add_argument(
										    '''--cache-dir'''   ,					type=lowerCAmelCase   ,					default=lowerCAmelCase   ,					help='''Path to location to store the models'''   )
										download_parser.add_argument(
										    '''--force'''   ,					action='''store_true'''   ,					help='''Force the model to be download even if already in cache-dir'''   )
										download_parser.add_argument(
										    '''--trust-remote-code'''   ,					action='''store_true'''   ,					help='''Whether or not to allow for custom models defined on the Hub in their own modeling files. Use only if you\'ve reviewed the code as it will execute on your local machine'''   ,					)
										download_parser.add_argument('''model'''   ,					type=lowerCAmelCase   ,					help='''Name of the model to download'''   )
										download_parser.set_defaults(func=lowerCAmelCase   )




				def __init__(	self    :				Dict   ,					lowerCAmelCase    :				str   ,					lowerCAmelCase    :				str   ,					lowerCAmelCase    :				bool   ,					lowerCAmelCase    :				bool   )->  Any:

										"""simple docstring"""




										UpperCAmelCase         =			model
										UpperCAmelCase         =			cache
										UpperCAmelCase         =			force
										UpperCAmelCase         =			trust_remote_code





				def   a__(	self    :				int   )->  Optional[Any]:

										"""simple docstring"""




										from ..models.auto import AutoModel, AutoTokenizer

										AutoModel.from_pretrained(
										    self._model   ,					cache_dir=self._cache   ,					force_download=self._force   ,					trust_remote_code=self._trust_remote_code   )
										AutoTokenizer.from_pretrained(
										    self._model   ,					cache_dir=self._cache   ,					force_download=self._force   ,					trust_remote_code=self._trust_remote_code   )





