


from typing import List, Optional, Tuple, Union

import torch
from torch import nn
from torch.nn import CrossEntropyLoss

from ... import AutoBackbone
from ...modeling_outputs import SemanticSegmenterOutput
from ...modeling_utils import PreTrainedModel
from ...utils import add_start_docstrings, add_start_docstrings_to_model_forward, replace_return_docstrings
from ...utils.backbone_utils import BackboneMixin
from .configuration_upernet import UperNetConfig


a					  =     [
    'openmmlab/upernet-convnext-tiny',
    # See all UperNet models at https://huggingface.co/models?filter=upernet
]

# General docstring
a					  =     'UperNetConfig'







class        UpperCamelCase__   (	nn.Module   ):

					def __init__(     self       :   int							,					UpperCamelCase__       :   int							,					UpperCamelCase__       :   int							,					UpperCamelCase__       :   Union[int, Tuple[int, int]]							,					UpperCamelCase__       :   Union[int, Tuple[int, int], str] = 0							,					UpperCamelCase__       :   bool = False							,					UpperCamelCase__       :   Union[int, Tuple[int, int]] = 1							,					):






										'''simple docstring'''






										super().__init__()
										lowercase_  							=			nn.Convad(
										    in_channels=UpperCamelCase__							,					out_channels=UpperCamelCase__							,					kernel_size=UpperCamelCase__							,					padding=UpperCamelCase__							,					bias=UpperCamelCase__							,					dilation=UpperCamelCase__							,					)
										lowercase_  							=			nn.BatchNormad(UpperCamelCase__       )
										lowercase_  							=			nn.ReLU()







					def   UpperCAmelCase__       (     self       :   int							,					UpperCamelCase__       :   torch.Tensor       ):






										'''simple docstring'''






										lowercase_  							=			self.conv(UpperCamelCase__       )
										lowercase_  							=			self.batch_norm(UpperCamelCase__       )
										lowercase_  							=			self.activation(UpperCamelCase__       )

										return output







class        UpperCamelCase__   (	nn.Module   ):

					def __init__(     self       :   Dict							,					UpperCamelCase__       :   int							,					UpperCamelCase__       :   int							,					UpperCamelCase__       :   int       ):






										'''simple docstring'''






										super().__init__()
										lowercase_  							=			[
										    nn.AdaptiveAvgPoolad(UpperCamelCase__       ),
										    UperNetConvModule(UpperCamelCase__							,					UpperCamelCase__							,					kernel_size=1       ),
										]
										for i, layer in enumerate(self.layers       ):
															self.add_module(str(UpperCamelCase__       )							,					UpperCamelCase__       )







					def   UpperCAmelCase__       (     self       :   str							,					UpperCamelCase__       :   torch.Tensor       ):






										'''simple docstring'''






										lowercase_  							=			input
										for layer in self.layers:
															lowercase_  							=			layer(UpperCamelCase__       )
										return hidden_state







class        UpperCamelCase__   (	nn.Module   ):

					def __init__(     self       :   str							,					UpperCamelCase__       :   Tuple[int, ...]							,					UpperCamelCase__       :   int							,					UpperCamelCase__       :   int							,					UpperCamelCase__       :   bool       ):






										'''simple docstring'''






										super().__init__()
										lowercase_  							=			pool_scales
										lowercase_  							=			align_corners
										lowercase_  							=			in_channels
										lowercase_  							=			channels
										lowercase_  							=			[]
										for i, pool_scale in enumerate(UpperCamelCase__       ):
															lowercase_  							=			UperNetPyramidPoolingBlock(pool_scale=UpperCamelCase__							,					in_channels=UpperCamelCase__							,					channels=UpperCamelCase__       )
															self.blocks.append(UpperCamelCase__       )
															self.add_module(str(UpperCamelCase__       )							,					UpperCamelCase__       )







					def   UpperCAmelCase__       (     self       :   Tuple							,					UpperCamelCase__       :   torch.Tensor       ):






										'''simple docstring'''






										lowercase_  							=			[]
										for ppm in self.blocks:
															lowercase_  							=			ppm(UpperCamelCase__       )
															lowercase_  							=			nn.functional.interpolate(
															    UpperCamelCase__							,					size=x.size()[2:]							,					mode="""bilinear"""							,					align_corners=self.align_corners       )
															ppm_outs.append(UpperCamelCase__       )
										return ppm_outs







class        UpperCamelCase__   (	nn.Module   ):

					def __init__(     self       :   List[str]							,					UpperCamelCase__       :   List[Any]							,					UpperCamelCase__       :   Optional[int]       ):






										'''simple docstring'''






										super().__init__()

										lowercase_  							=			config
										lowercase_  							=			config.pool_scales  # e.g. (1, 2, 3, 6)
										lowercase_  							=			in_channels
										lowercase_  							=			config.hidden_size
										lowercase_  							=			False
										lowercase_  							=			nn.Convad(self.channels							,					config.num_labels							,					kernel_size=1       )

										# PSP Module
										lowercase_  							=			UperNetPyramidPoolingModule(
										    self.pool_scales							,					self.in_channels[-1]							,					self.channels							,					align_corners=self.align_corners							,					)
										lowercase_  							=			UperNetConvModule(
										    self.in_channels[-1] + len(self.pool_scales       ) * self.channels							,					self.channels							,					kernel_size=3							,					padding=1							,					)
										# FPN Module
										lowercase_  							=			nn.ModuleList()
										lowercase_  							=			nn.ModuleList()
										for in_channels in self.in_channels[:-1]:  # skip the top layer
															lowercase_  							=			UperNetConvModule(UpperCamelCase__							,					self.channels							,					kernel_size=1       )
															lowercase_  							=			UperNetConvModule(self.channels							,					self.channels							,					kernel_size=3							,					padding=1       )
															self.lateral_convs.append(UpperCamelCase__       )
															self.fpn_convs.append(UpperCamelCase__       )

										lowercase_  							=			UperNetConvModule(
										    len(self.in_channels       ) * self.channels							,					self.channels							,					kernel_size=3							,					padding=1							,					)

					def   UpperCAmelCase__       (     self       :   List[str]       ):






										'''simple docstring'''






										self.apply(self._init_weights       )

					def   UpperCAmelCase__       (     self       :   Optional[int]							,					UpperCamelCase__       :   Optional[int]       ):






										'''simple docstring'''






										if isinstance(UpperCamelCase__							,					nn.Convad       ):
															module.weight.data.normal_(mean=0.0							,					std=self.config.initializer_range       )
															if module.bias is not None:
																				module.bias.data.zero_()

					def   UpperCAmelCase__       (     self       :   Union[str, Any]							,					UpperCamelCase__       :   List[Any]       ):






										'''simple docstring'''






										lowercase_  							=			inputs[-1]
										lowercase_  							=			[x]
										psp_outs.extend(self.psp_modules(UpperCamelCase__       )       )
										lowercase_  							=			torch.cat(UpperCamelCase__							,					dim=1       )
										lowercase_  							=			self.bottleneck(UpperCamelCase__       )

										return output







					def   UpperCAmelCase__       (     self       :   Dict							,					UpperCamelCase__       :   torch.Tensor       ):






										'''simple docstring'''






										lowercase_  							=			[lateral_conv(encoder_hidden_states[i]       ) for i, lateral_conv in enumerate(self.lateral_convs       )]

										laterals.append(self.psp_forward(UpperCamelCase__       )       )

										# build top-down path
										lowercase_  							=			len(UpperCamelCase__       )
										for i in range(used_backbone_levels - 1							,					0							,					-1       ):
															lowercase_  							=			laterals[i - 1].shape[2:]
															lowercase_  							=			laterals[i - 1] + nn.functional.interpolate(
															    laterals[i]							,					size=UpperCamelCase__							,					mode="""bilinear"""							,					align_corners=self.align_corners       )

										# build outputs
										lowercase_  							=			[self.fpn_convs[i](laterals[i]       ) for i in range(used_backbone_levels - 1       )]
										# append psp feature
										fpn_outs.append(laterals[-1]       )

										for i in range(used_backbone_levels - 1							,					0							,					-1       ):
															lowercase_  							=			nn.functional.interpolate(
															    fpn_outs[i]							,					size=fpn_outs[0].shape[2:]							,					mode="""bilinear"""							,					align_corners=self.align_corners       )
										lowercase_  							=			torch.cat(UpperCamelCase__							,					dim=1       )
										lowercase_  							=			self.fpn_bottleneck(UpperCamelCase__       )
										lowercase_  							=			self.classifier(UpperCamelCase__       )

										return output







class        UpperCamelCase__   (	nn.Module   ):

					def __init__(     self       :   Optional[int]							,					UpperCamelCase__       :   Optional[Any]							,					UpperCamelCase__       :   int = 2							,					UpperCamelCase__       :   int = 3							,					UpperCamelCase__       :   Union[int, Tuple[int, int]] = 1       ):






										'''simple docstring'''






										super().__init__()

										lowercase_  							=			config
										lowercase_  							=			config.auxiliary_in_channels
										lowercase_  							=			config.auxiliary_channels
										lowercase_  							=			config.auxiliary_num_convs
										lowercase_  							=			config.auxiliary_concat_input
										lowercase_  							=			in_index

										lowercase_  							=			(kernel_size // 2) * dilation
										lowercase_  							=			[]
										convs.append(
										    UperNetConvModule(
										        self.in_channels							,					self.channels							,					kernel_size=UpperCamelCase__							,					padding=UpperCamelCase__							,					dilation=UpperCamelCase__       )       )
										for i in range(self.num_convs - 1       ):
															convs.append(
															    UperNetConvModule(
															        self.channels							,					self.channels							,					kernel_size=UpperCamelCase__							,					padding=UpperCamelCase__							,					dilation=UpperCamelCase__       )       )
										if self.num_convs == 0:
															lowercase_  							=			nn.Identity()
										else:
															lowercase_  							=			nn.Sequential(*UpperCamelCase__       )
										if self.concat_input:
															lowercase_  							=			UperNetConvModule(
															    self.in_channels + self.channels							,					self.channels							,					kernel_size=UpperCamelCase__							,					padding=kernel_size // 2       )

										lowercase_  							=			nn.Convad(self.channels							,					config.num_labels							,					kernel_size=1       )

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






										'''simple docstring'''






										self.apply(self._init_weights       )

					def   UpperCAmelCase__       (     self       :   Tuple							,					UpperCamelCase__       :   Union[str, Any]       ):






										'''simple docstring'''






										if isinstance(UpperCamelCase__							,					nn.Convad       ):
															module.weight.data.normal_(mean=0.0							,					std=self.config.initializer_range       )
															if module.bias is not None:
																				module.bias.data.zero_()







					def   UpperCAmelCase__       (     self       :   str							,					UpperCamelCase__       :   torch.Tensor       ):






										'''simple docstring'''






										lowercase_  							=			encoder_hidden_states[self.in_index]
										lowercase_  							=			self.convs(UpperCamelCase__       )
										if self.concat_input:
															lowercase_  							=			self.conv_cat(torch.cat([hidden_states, output]							,					dim=1       )       )
										lowercase_  							=			self.classifier(UpperCamelCase__       )
										return output







class        UpperCamelCase__   (	__magic_name__   ):
					__SCREAMING_SNAKE_CASE       :  Union[str, Any]						=   UperNetConfig
					__SCREAMING_SNAKE_CASE       :  Any						=   'pixel_values'
					__SCREAMING_SNAKE_CASE       :  str						=   True

					def   UpperCAmelCase__       (     self       :   List[str]							,					UpperCamelCase__       :   str       ):






										'''simple docstring'''






										if isinstance(UpperCamelCase__							,					UpperCamelCase__       ):
															module.backbone.init_weights()
															module.decode_head.init_weights()
															module.auxiliary_head.init_weights()

					def   UpperCAmelCase__       (     self       :   Any       ):






										'''simple docstring'''






										self.backbone.init_weights()
										self.decode_head.init_weights()
										self.auxiliary_head.init_weights()







					def   UpperCAmelCase__       (     self       :   str							,					UpperCamelCase__       :   List[str]							,					UpperCamelCase__       :   Tuple=False       ):






										'''simple docstring'''






										if isinstance(UpperCamelCase__							,					UpperCamelCase__       ):
															lowercase_  							=			value



a					  =     R'\n    Parameters:\n    This model is a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) sub-class. Use\n    it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage and\n    behavior.\n        config ([`UperNetConfig`]): Model configuration class with all the parameters of the model.\n            Initializing with a config file does not load the weights associated with the model, only the\n            configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.\n'

a					  =     R'\n    Args:\n        pixel_values (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`):\n            Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using\n            [`AutoImageProcessor`]. See [`SegformerImageProcessor.__call__`] for details.\n        output_attentions (`bool`, *optional*):\n            Whether or not to return the attentions tensors of all attention layers in case the backbone has them. See\n            `attentions` under returned tensors for more detail.\n        output_hidden_states (`bool`, *optional*):\n            Whether or not to return the hidden states of all layers of the backbone. See `hidden_states` under\n            returned tensors for more detail.\n        return_dict (`bool`, *optional*):\n            Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.\n'







@add_start_docstrings(
    'UperNet framework leveraging any vision backbone e.g. for ADE20k, CityScapes.'							,				__magic_name__							,				)
class        UpperCamelCase__   (	__magic_name__   ):

					def __init__(     self       :   List[str]							,					UpperCamelCase__       :   List[Any]       ):






										'''simple docstring'''






										super().__init__(UpperCamelCase__       )

										lowercase_  							=			AutoBackbone.from_config(config.backbone_config       )

										# Semantic segmentation head(s)
										lowercase_  							=			UperNetHead(UpperCamelCase__							,					in_channels=self.backbone.channels       )
										lowercase_  							=			UperNetFCNHead(UpperCamelCase__       ) if config.use_auxiliary_head else None

										# Initialize weights and apply final processing
										self.post_init()







					@add_start_docstrings_to_model_forward(UPERNET_INPUTS_DOCSTRING.format("""batch_size, sequence_length"""       )       )
					@replace_return_docstrings(output_type=UpperCamelCase__							,					config_class=_CONFIG_FOR_DOC       )
					def   UpperCAmelCase__       (     self       :   int							,					UpperCamelCase__       :   Optional[torch.Tensor] = None							,					UpperCamelCase__       :   Optional[bool] = None							,					UpperCamelCase__       :   Optional[bool] = None							,					UpperCamelCase__       :   Optional[torch.Tensor] = None							,					UpperCamelCase__       :   Optional[bool] = None							,					):






										'''simple docstring'''






										lowercase_  							=			return_dict if return_dict is not None else self.config.use_return_dict
										lowercase_  							=			(
										    output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
										)
										lowercase_  							=			output_attentions if output_attentions is not None else self.config.output_attentions

										lowercase_  							=			self.backbone.forward_with_filtered_kwargs(
										    UpperCamelCase__							,					output_hidden_states=UpperCamelCase__							,					output_attentions=UpperCamelCase__       )
										lowercase_  							=			outputs.feature_maps

										lowercase_  							=			self.decode_head(UpperCamelCase__       )
										lowercase_  							=			nn.functional.interpolate(UpperCamelCase__							,					size=pixel_values.shape[2:]							,					mode="""bilinear"""							,					align_corners=UpperCamelCase__       )

										lowercase_  							=			None
										if self.auxiliary_head is not None:
															lowercase_  							=			self.auxiliary_head(UpperCamelCase__       )
															lowercase_  							=			nn.functional.interpolate(
															    UpperCamelCase__							,					size=pixel_values.shape[2:]							,					mode="""bilinear"""							,					align_corners=UpperCamelCase__       )

										lowercase_  							=			None
										if labels is not None:
															if self.config.num_labels == 1:
																				raise ValueError("""The number of labels should be greater than one"""       )
															else:
																				# compute weighted loss
																				lowercase_  							=			CrossEntropyLoss(ignore_index=self.config.loss_ignore_index       )
																				lowercase_  							=			loss_fct(UpperCamelCase__							,					UpperCamelCase__       )
																				lowercase_  							=			loss_fct(UpperCamelCase__							,					UpperCamelCase__       )
																				lowercase_  							=			main_loss + self.config.auxiliary_loss_weight * auxiliary_loss

										if not return_dict:
															if output_hidden_states:
																				lowercase_  							=			(logits,) + outputs[1:]
															else:
																				lowercase_  							=			(logits,) + outputs[2:]
															return ((loss,) + output) if loss is not None else output

										return SemanticSegmenterOutput(
										    loss=UpperCamelCase__							,					logits=UpperCamelCase__							,					hidden_states=outputs.hidden_states							,					attentions=outputs.attentions							,					)






import pickle
import shutil
import tempfile
import unittest

from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow
from transformers.utils import cached_property

from ...test_tokenization_common import TokenizerTesterMixin


a					  =     get_tests_dir('fixtures/test_sentencepiece.model')







@require_sentencepiece
@require_tokenizers
class        UpperCamelCase__   (	__magic_name__							,				unittest.TestCase   ):
					__SCREAMING_SNAKE_CASE       :  List[Any]						=   XGLMTokenizer
					__SCREAMING_SNAKE_CASE       :  List[Any]						=   XGLMTokenizerFast
					__SCREAMING_SNAKE_CASE       :  List[Any]						=   True
					__SCREAMING_SNAKE_CASE       :  int						=   True

					def   UpperCAmelCase__       (     self       :   List[Any]       ):






										'''simple docstring'''






										super().setUp()

										# We have a SentencePiece fixture for testing
										lowercase_  							=			XGLMTokenizer(UpperCamelCase__							,					keep_accents=UpperCamelCase__       )
										tokenizer.save_pretrained(self.tmpdirname       )

					def   UpperCAmelCase__       (     self       :   Tuple       ):






										'''simple docstring'''






										lowercase_  							=			"""<pad>"""
										lowercase_  							=			1

										self.assertEqual(self.get_tokenizer()._convert_token_to_id(UpperCamelCase__       )							,					UpperCamelCase__       )
										self.assertEqual(self.get_tokenizer()._convert_id_to_token(UpperCamelCase__       )							,					UpperCamelCase__       )

					def   UpperCAmelCase__       (     self       :   str       ):






										'''simple docstring'''






										lowercase_  							=			list(self.get_tokenizer().get_vocab().keys()       )

										self.assertEqual(vocab_keys[0]							,					"""<s>"""       )
										self.assertEqual(vocab_keys[1]							,					"""<pad>"""       )
										self.assertEqual(len(UpperCamelCase__       )							,					1_008       )

					def   UpperCAmelCase__       (     self       :   int       ):






										'''simple docstring'''






										self.assertEqual(self.get_tokenizer().vocab_size							,					1_008       )

					def   UpperCAmelCase__       (     self       :   Tuple       ):






										'''simple docstring'''






										lowercase_  							=			XGLMTokenizer(UpperCamelCase__							,					keep_accents=UpperCamelCase__       )

										lowercase_  							=			tokenizer.tokenize("""This is a test"""       )
										self.assertListEqual(UpperCamelCase__							,					["""▁This""", """▁is""", """▁a""", """▁t""", """est"""]       )

										self.assertListEqual(
										    tokenizer.convert_tokens_to_ids(UpperCamelCase__       )							,					[value + tokenizer.fairseq_offset for value in [285, 46, 10, 170, 382]]							,					)

										lowercase_  							=			tokenizer.tokenize("""I was born in 92000, and this is falsé."""       )
										self.assertListEqual(
										    UpperCamelCase__							,					[
										        SPIECE_UNDERLINE + """I""",
										        SPIECE_UNDERLINE + """was""",
										        SPIECE_UNDERLINE + """b""",
										        """or""",
										        """n""",
										        SPIECE_UNDERLINE + """in""",
										        SPIECE_UNDERLINE + """""",
										        """9""",
										        """2""",
										        """0""",
										        """0""",
										        """0""",
										        """,""",
										        SPIECE_UNDERLINE + """and""",
										        SPIECE_UNDERLINE + """this""",
										        SPIECE_UNDERLINE + """is""",
										        SPIECE_UNDERLINE + """f""",
										        """al""",
										        """s""",
										        """é""",
										        """.""",
										    ]							,					)
										lowercase_  							=			tokenizer.convert_tokens_to_ids(UpperCamelCase__       )
										self.assertListEqual(
										    UpperCamelCase__							,					[
										        value + tokenizer.fairseq_offset
										        for value in [8, 21, 84, 55, 24, 19, 7, 2, 602, 347, 347, 347, 3, 12, 66, 46, 72, 80, 6, 2, 4]
										    ]							,					)

										lowercase_  							=			tokenizer.convert_ids_to_tokens(UpperCamelCase__       )
										self.assertListEqual(
										    UpperCamelCase__							,					[
										        SPIECE_UNDERLINE + """I""",
										        SPIECE_UNDERLINE + """was""",
										        SPIECE_UNDERLINE + """b""",
										        """or""",
										        """n""",
										        SPIECE_UNDERLINE + """in""",
										        SPIECE_UNDERLINE + """""",
										        """<unk>""",
										        """2""",
										        """0""",
										        """0""",
										        """0""",
										        """,""",
										        SPIECE_UNDERLINE + """and""",
										        SPIECE_UNDERLINE + """this""",
										        SPIECE_UNDERLINE + """is""",
										        SPIECE_UNDERLINE + """f""",
										        """al""",
										        """s""",
										        """<unk>""",
										        """.""",
										    ]							,					)

					@cached_property
					def   UpperCAmelCase__       (     self       :   str       ):






										'''simple docstring'''






										return XGLMTokenizer.from_pretrained("""facebook/xglm-564M"""       )

					def   UpperCAmelCase__       (     self       :   Dict       ):






										'''simple docstring'''






										with tempfile.NamedTemporaryFile() as f:
															shutil.copyfile(UpperCamelCase__							,					f.name       )
															lowercase_  							=			XGLMTokenizer(f.name							,					keep_accents=UpperCamelCase__       )
															lowercase_  							=			pickle.dumps(UpperCamelCase__       )
										pickle.loads(UpperCamelCase__       )

					def   UpperCAmelCase__       (     self       :   str       ):






										'''simple docstring'''






										if not self.test_rust_tokenizer:
															return

										lowercase_  							=			self.get_tokenizer()
										lowercase_  							=			self.get_rust_tokenizer()

										lowercase_  							=			"""I was born in 92000, and this is falsé."""

										lowercase_  							=			tokenizer.tokenize(UpperCamelCase__       )
										lowercase_  							=			rust_tokenizer.tokenize(UpperCamelCase__       )
										self.assertListEqual(UpperCamelCase__							,					UpperCamelCase__       )

										lowercase_  							=			tokenizer.encode(UpperCamelCase__							,					add_special_tokens=UpperCamelCase__       )
										lowercase_  							=			rust_tokenizer.encode(UpperCamelCase__							,					add_special_tokens=UpperCamelCase__       )
										self.assertListEqual(UpperCamelCase__							,					UpperCamelCase__       )

										lowercase_  							=			self.get_rust_tokenizer()
										lowercase_  							=			tokenizer.encode(UpperCamelCase__       )
										lowercase_  							=			rust_tokenizer.encode(UpperCamelCase__       )
										self.assertListEqual(UpperCamelCase__							,					UpperCamelCase__       )

					@slow
					def   UpperCAmelCase__       (     self       :   Union[str, Any]       ):






										'''simple docstring'''






										lowercase_  							=			"""Hello World!"""
										lowercase_  							=			[2, 31_227, 4_447, 35]

										self.assertListEqual(UpperCamelCase__							,					self.big_tokenizer.encode(UpperCamelCase__       )       )

					@slow
					def   UpperCAmelCase__       (     self       :   str       ):






										'''simple docstring'''






										lowercase_  							=			(
										    """This is a very long text with a lot of weird characters, such as: . , ~ ? ( ) \" [ ] ! : - . Also we will"""
										    """ add words that should not exsist and be tokenized to unk, such as saoneuhaoesuth"""
										)
										# fmt: off
										lowercase_  							=			[2, 1_018, 67, 11, 1_988, 2_617, 5_631, 278, 11, 3_407, 48, 71_630, 28_085, 4, 3_234, 157, 13, 6, 5, 6, 4, 3_526, 768, 15, 659, 57, 298, 3_983, 864, 129, 21, 6, 5, 13_675, 377, 652, 7_580, 10_341, 155, 2_817, 422, 1_666, 7, 1_674, 53, 113, 202_277, 17_892, 33, 60, 87, 4, 3_234, 157, 61, 2_667, 52_376, 19, 88, 23, 735]
										# fmt: on

										self.assertListEqual(UpperCamelCase__							,					self.big_tokenizer.encode(UpperCamelCase__       )       )







					@slow
					def   UpperCAmelCase__       (     self       :   Any       ):






										'''simple docstring'''






										lowercase_  							=			{
										    """input_ids""": [[2, 108_825, 1_163, 15, 88_010, 473, 15_898, 157, 13_672, 1_857, 312, 8, 238_021, 1_163, 53, 13_672, 1_857, 312, 8, 53_283, 182_396, 8, 18_566, 16, 36_733, 4_101, 8, 230, 244_017, 122_553, 7, 15, 132_597, 4, 293, 12_511, 7_610, 4, 3_414, 132_597, 9, 4, 32_361, 362, 4, 734, 28_512, 32_569, 18, 4, 32_361, 26_096, 14_982, 73, 18_715, 21_433, 235_261, 15, 492, 12_427, 16, 53, 18_715, 21_433, 65_454, 15, 23_659, 563, 16, 278, 597, 2_843, 595, 7_931, 182_396, 64_186, 22, 886, 595, 132_981, 53, 25_540, 3_449, 43_982, 39_901, 5_951, 878, 330, 4, 27_694, 80_269, 312, 53, 6_517, 11_780, 611, 20_408, 5], [2, 6, 132_597, 67, 42_897, 33, 592, 8, 163_729, 25_540, 361, 136_997, 109_514, 173_230, 7, 501, 60, 102_913, 196, 5_631, 235, 63_243, 473, 6, 231_757, 74, 5_277, 7_905, 53, 3_095, 37_317, 22, 454, 183_874, 5], [2, 268, 31_298, 46_530, 6, 132_935, 43_831, 7, 597, 32, 24, 3_688, 9_865, 5]],
										    """attention_mask""": [[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]
										}  # noqa: E501
										# fmt: on

										self.tokenizer_integration_test_util(
										    expected_encoding=UpperCamelCase__							,					model_name="""facebook/xglm-564M"""							,					padding=UpperCamelCase__							,					)


