





import json
import os
import re
import unicodedata
from json.encoder import INFINITY
from typing import Any, Dict, List, Optional, Tuple, Union

import numpy as np
import regex

from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...tokenization_utils_base import BatchEncoding
from ...utils import TensorType, is_flax_available, is_tf_available, is_torch_available, logging
from ...utils.generic import _is_jax, _is_numpy


__lowerCAmelCase :Tuple     =    logging.get_logger(__name__)

__lowerCAmelCase :str     =    {
    'artists_file': 'artists.json',
    'lyrics_file': 'lyrics.json',
    'genres_file': 'genres.json',
}

__lowerCAmelCase :Any     =    {
    'artists_file': {
        'jukebox': 'https://huggingface.co/ArthurZ/jukebox/blob/main/artists.json',
    },
    'genres_file': {
        'jukebox': 'https://huggingface.co/ArthurZ/jukebox/blob/main/genres.json',
    },
    'lyrics_file': {
        'jukebox': 'https://huggingface.co/ArthurZ/jukebox/blob/main/lyrics.json',
    },
}

__lowerCAmelCase :str     =    {
    'jukebox': 5_12,
}






class        _a(    __A    ):
		lowerCamelCase__     :Any   				=		VOCAB_FILES_NAMES
		lowerCamelCase__     :Union[str, Any]   				=		PRETRAINED_VOCAB_FILES_MAP
		lowerCamelCase__     :int   				=		PRETRAINED_LYRIC_TOKENS_SIZES
		lowerCamelCase__     :Optional[int]   				=		['input_ids', 'attention_mask']







		def __init__(    self ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case=["v3", "v2", "v2"] ,						__snake_case=5_1_2 ,						__snake_case=5 ,						__snake_case="<|endoftext|>" ,						**__snake_case ,						)      ->      str:


							'''simple docstring'''

							_snake_case       :					List[Any]				       =   AddedToken(__snake_case ,						lstrip=__snake_case ,						rstrip=__snake_case				) if isinstance(__snake_case ,						__snake_case				) else unk_token
							super().__init__(
							    unk_token=__snake_case ,						n_genres=__snake_case ,						version=__snake_case ,						max_n_lyric_tokens=__snake_case ,						**__snake_case ,						)
							_snake_case       :					List[Any]				       =   version
							_snake_case       :					Optional[Any]				       =   max_n_lyric_tokens
							_snake_case       :					Optional[int]				       =   n_genres

							with open(__snake_case ,						encoding="utf-8"				) as vocab_handle:
												_snake_case       :					List[str]				       =   json.load(__snake_case				)

							with open(__snake_case ,						encoding="utf-8"				) as vocab_handle:
												_snake_case       :					List[str]				       =   json.load(__snake_case				)

							with open(__snake_case ,						encoding="utf-8"				) as vocab_handle:
												_snake_case       :					List[str]				       =   json.load(__snake_case				)

							_snake_case       :					int				       =   r"[^A-Za-z0-9.,:;!?\-'\"()\[\] \t\n]+"
							# In v2, we had a n_vocab=80 and in v3 we missed + and so n_vocab=79 of characters.
							if len(self.lyrics_encoder				) == 7_9:
												_snake_case       :					List[str]				       =   oov.replace(r"\-'" ,						r"\-+'"				)

							_snake_case       :					List[Any]				       =   regex.compile(__snake_case				)
							_snake_case       :					Tuple				       =   {v: k for k, v in self.artists_encoder.items()}
							_snake_case       :					Optional[Any]				       =   {v: k for k, v in self.genres_encoder.items()}
							_snake_case       :					List[Any]				       =   {v: k for k, v in self.lyrics_encoder.items()}







		@property
		def        lowercase       (    self				)      ->      List[Any]:


							'''simple docstring'''

							return len(self.artists_encoder				) + len(self.genres_encoder				) + len(self.lyrics_encoder				)







		def        lowercase       (    self				)      ->      Optional[Any]:


							'''simple docstring'''

							return dict(self.artists_encoder ,						self.genres_encoder ,						self.lyrics_encoder				)







		def        lowercase       (    self ,						__snake_case ,						__snake_case ,						__snake_case				)      ->      List[Any]:


							'''simple docstring'''

							_snake_case       :					List[str]				       =   [self.artists_encoder.get(__snake_case ,						0				) for artist in list_artists]
							for genres in range(len(__snake_case				)				):
												_snake_case       :					List[Any]				       =   [self.genres_encoder.get(__snake_case ,						0				) for genre in list_genres[genres]]
												_snake_case       :					Union[str, Any]				       =   list_genres[genres] + [-1] * (self.n_genres - len(list_genres[genres]				))

							_snake_case       :					Tuple				       =   [[self.lyrics_encoder.get(__snake_case ,						0				) for character in list_lyrics[0]], [], []]
							return artists_id, list_genres, lyric_ids







		def        lowercase       (    self ,						__snake_case				)      ->      Any:


							'''simple docstring'''

							return list(__snake_case				)







		def        lowercase       (    self ,						__snake_case ,						__snake_case ,						__snake_case ,						**__snake_case				)      ->      List[str]:


							'''simple docstring'''

							_snake_case       , _snake_case       , _snake_case       :					Tuple				       =   self.prepare_for_tokenization(__snake_case ,						__snake_case ,						__snake_case				)
							_snake_case       :					str				       =   self._tokenize(__snake_case				)
							return artist, genre, lyrics







		def        lowercase       (    self ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case = False				)      ->      Tuple[str, str, str, Dict[str, Any]]:


							'''simple docstring'''

							for idx in range(len(self.version				)				):
												if self.version[idx] == "v3":
																	_snake_case       :					Dict				       =   artists[idx].lower()
																	_snake_case       :					Any				       =   [genres[idx].lower()]
												else:
																	_snake_case       :					List[Any]				       =   self._normalize(artists[idx]				) + ".v2"
																	_snake_case       :					Union[str, Any]				       =   [
																	    self._normalize(__snake_case				) + ".v2" for genre in genres[idx].split("_"				)
																	]  # split is for the full dictionary with combined genres

							if self.version[0] == "v2":
												_snake_case       :					List[Any]				       =   regex.compile(r"[^A-Za-z0-9.,:;!?\-'\"()\[\] \t\n]+"				)
												_snake_case       :					int				       =   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,:;!?-+'\"()[] \t\n"
												_snake_case       :					Tuple				       =   {vocab[index]: index + 1 for index in range(len(__snake_case				)				)}
												_snake_case       :					Union[str, Any]				       =   0
												_snake_case       :					Tuple				       =   len(__snake_case				) + 1
												_snake_case       :					Dict				       =   self.vocab
												_snake_case       :					Dict				       =   {v: k for k, v in self.vocab.items()}
												_snake_case       :					Optional[Any]				       =   ""
							else:
												_snake_case       :					Optional[Any]				       =   regex.compile(r"[^A-Za-z0-9.,:;!?\-+'\"()\[\] \t\n]+"				)

							_snake_case       :					Optional[Any]				       =   self._run_strip_accents(__snake_case				)
							_snake_case       :					str				       =   lyrics.replace("\\" ,						"\n"				)
							_snake_case       :					str				       =   self.out_of_vocab.sub("" ,						__snake_case				), [], []
							return artists, genres, lyrics







		def        lowercase       (    self ,						__snake_case				)      ->      str:


							'''simple docstring'''

							_snake_case       :					Union[str, Any]				       =   unicodedata.normalize("NFD" ,						__snake_case				)
							_snake_case       :					Optional[Any]				       =   []
							for char in text:
												_snake_case       :					List[Any]				       =   unicodedata.category(__snake_case				)
												if cat == "Mn":
																	continue
												output.append(__snake_case				)
							return "".join(__snake_case				)







		def        lowercase       (    self ,						__snake_case				)      ->      str:


							'''simple docstring'''

							_snake_case       :					Any				       =   (
							    [chr(__snake_case				) for i in range(ord("a"				) ,						ord("z"				) + 1				)]
							    + [chr(__snake_case				) for i in range(ord("A"				) ,						ord("Z"				) + 1				)]
							    + [chr(__snake_case				) for i in range(ord("0"				) ,						ord("9"				) + 1				)]
							    + ["."]
							)
							_snake_case       :					List[Any]				       =   frozenset(__snake_case				)
							_snake_case       :					List[Any]				       =   re.compile(r"_+"				)
							_snake_case       :					str				       =   "".join([c if c in accepted else "_" for c in text.lower()]				)
							_snake_case       :					Optional[int]				       =   pattern.sub("_" ,						__snake_case				).strip("_"				)
							return text







		def        lowercase       (    self ,						__snake_case				)      ->      str:


							'''simple docstring'''

							return " ".join(__snake_case				)







		def        lowercase       (    self ,						__snake_case ,						__snake_case = None ,						__snake_case = False				)      ->      Optional[Any]:


							'''simple docstring'''

							if not isinstance(__snake_case ,						__snake_case				):
												_snake_case       :					int				       =   TensorType(__snake_case				)

							# Get a function reference for the correct framework
							if tensor_type == TensorType.TENSORFLOW:
												if not is_tf_available():
																	raise ImportError(
																	    "Unable to convert output to TensorFlow tensors format, TensorFlow is not installed."				)
												import tensorflow as tf

												_snake_case       :					Optional[int]				       =   tf.constant
												_snake_case       :					int				       =   tf.is_tensor
							elif tensor_type == TensorType.PYTORCH:
												if not is_torch_available():
																	raise ImportError("Unable to convert output to PyTorch tensors format, PyTorch is not installed."				)
												import torch

												_snake_case       :					List[Any]				       =   torch.tensor
												_snake_case       :					Optional[int]				       =   torch.is_tensor
							elif tensor_type == TensorType.JAX:
												if not is_flax_available():
																	raise ImportError("Unable to convert output to JAX tensors format, JAX is not installed."				)
												import jax.numpy as jnp  # noqa: F811

												_snake_case       :					List[str]				       =   jnp.array
												_snake_case       :					Any				       =   _is_jax
							else:
												_snake_case       :					Dict				       =   np.asarray
												_snake_case       :					str				       =   _is_numpy

							# Do the tensor conversion in batch

							try:
												if prepend_batch_axis:
																	_snake_case       :					Union[str, Any]				       =   [inputs]

												if not is_tensor(__snake_case				):
																	_snake_case       :					Any				       =   as_tensor(__snake_case				)
							except:  # noqa E722
												raise ValueError(
												    "Unable to create tensor, you should probably activate truncation and/or padding "
												    "with 'padding=True' 'truncation=True' to have batched tensors with the same length."				)

							return inputs







		def __call__(    self ,						__snake_case ,						__snake_case ,						__snake_case="" ,						__snake_case="pt"				)      ->      BatchEncoding:


							'''simple docstring'''

							_snake_case       :					str				       =   [0, 0, 0]
							_snake_case       :					Union[str, Any]				       =   [artist] * len(self.version				)
							_snake_case       :					Optional[Any]				       =   [genres] * len(self.version				)

							_snake_case       , _snake_case       , _snake_case       :					Tuple				       =   self.tokenize(__snake_case ,						__snake_case ,						__snake_case				)
							_snake_case       , _snake_case       , _snake_case       :					Any				       =   self._convert_token_to_id(__snake_case ,						__snake_case ,						__snake_case				)

							_snake_case       :					Dict				       =   [-INFINITY] * len(full_tokens[-1]				)
							_snake_case       :					str				       =   [
							    self.convert_to_tensors(
							        [input_ids + [artists_id[i]] + genres_ids[i] + full_tokens[i]] ,						tensor_type=__snake_case				)
							    for i in range(len(self.version				)				)
							]
							return BatchEncoding({"input_ids": input_ids, "attention_masks": attention_masks}				)







		def        lowercase       (    self ,						__snake_case ,						__snake_case = None				)      ->      Tuple[str]:


							'''simple docstring'''

							if not os.path.isdir(__snake_case				):
												logger.error(f"""Vocabulary path ({save_directory}) should be a directory"""				)
												return

							_snake_case       :					Dict				       =   os.path.join(
							    __snake_case ,						(filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["artists_file"]				)
							with open(__snake_case ,						"w" ,						encoding="utf-8"				) as f:
												f.write(json.dumps(self.artists_encoder ,						ensure_ascii=__snake_case				)				)

							_snake_case       :					Union[str, Any]				       =   os.path.join(
							    __snake_case ,						(filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["genres_file"]				)
							with open(__snake_case ,						"w" ,						encoding="utf-8"				) as f:
												f.write(json.dumps(self.genres_encoder ,						ensure_ascii=__snake_case				)				)

							_snake_case       :					Tuple				       =   os.path.join(
							    __snake_case ,						(filename_prefix + "-" if filename_prefix else "") + VOCAB_FILES_NAMES["lyrics_file"]				)
							with open(__snake_case ,						"w" ,						encoding="utf-8"				) as f:
												f.write(json.dumps(self.lyrics_encoder ,						ensure_ascii=__snake_case				)				)

							return (artists_file, genres_file, lyrics_file)







		def        lowercase       (    self ,						__snake_case ,						__snake_case ,						__snake_case				)      ->      Any:


							'''simple docstring'''

							_snake_case       :					Dict				       =   self.artists_decoder.get(__snake_case				)
							_snake_case       :					Dict				       =   [self.genres_decoder.get(__snake_case				) for genre in genres_index]
							_snake_case       :					Dict				       =   [self.lyrics_decoder.get(__snake_case				) for character in lyric_index]
							return artist, genres, lyrics






from __future__ import annotations

import unittest

from transformers import DistilBertConfig, is_tf_available
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
							import tensorflow as tf

							from transformers.models.distilbert.modeling_tf_distilbert import (
							    TF_DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
							    TFDistilBertForMaskedLM,
							    TFDistilBertForMultipleChoice,
							    TFDistilBertForQuestionAnswering,
							    TFDistilBertForSequenceClassification,
							    TFDistilBertForTokenClassification,
							    TFDistilBertModel,
							)






class        _a:







		def __init__(    self ,						__snake_case ,						)      ->      List[str]:


							'''simple docstring'''

							_snake_case       :					Dict				       =   parent
							_snake_case       :					Any				       =   1_3
							_snake_case       :					Union[str, Any]				       =   7
							_snake_case       :					Any				       =   True
							_snake_case       :					Optional[Any]				       =   True
							_snake_case       :					List[str]				       =   False
							_snake_case       :					str				       =   True
							_snake_case       :					int				       =   9_9
							_snake_case       :					Optional[int]				       =   3_2
							_snake_case       :					Dict				       =   2
							_snake_case       :					Optional[Any]				       =   4
							_snake_case       :					Any				       =   3_7
							_snake_case       :					Optional[int]				       =   "gelu"
							_snake_case       :					Optional[Any]				       =   0.1
							_snake_case       :					List[Any]				       =   0.1
							_snake_case       :					Any				       =   5_1_2
							_snake_case       :					Optional[int]				       =   1_6
							_snake_case       :					Dict				       =   2
							_snake_case       :					Optional[int]				       =   0.02
							_snake_case       :					Any				       =   3
							_snake_case       :					Tuple				       =   4
							_snake_case       :					str				       =   None







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


							'''simple docstring'''

							_snake_case       :					Optional[int]				       =   ids_tensor([self.batch_size, self.seq_length] ,						self.vocab_size				)

							_snake_case       :					List[Any]				       =   None
							if self.use_input_mask:
												_snake_case       :					Tuple				       =   random_attention_mask([self.batch_size, self.seq_length]				)

							_snake_case       :					str				       =   None
							_snake_case       :					Optional[Any]				       =   None
							_snake_case       :					Any				       =   None
							if self.use_labels:
												_snake_case       :					Union[str, Any]				       =   ids_tensor([self.batch_size] ,						self.type_sequence_label_size				)
												_snake_case       :					List[str]				       =   ids_tensor([self.batch_size, self.seq_length] ,						self.num_labels				)
												_snake_case       :					List[Any]				       =   ids_tensor([self.batch_size] ,						self.num_choices				)

							_snake_case       :					Optional[Any]				       =   DistilBertConfig(
							    vocab_size=self.vocab_size ,						dim=self.hidden_size ,						n_layers=self.num_hidden_layers ,						n_heads=self.num_attention_heads ,						hidden_dim=self.intermediate_size ,						hidden_act=self.hidden_act ,						dropout=self.hidden_dropout_prob ,						attention_dropout=self.attention_probs_dropout_prob ,						max_position_embeddings=self.max_position_embeddings ,						initializer_range=self.initializer_range ,						)

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







		def        lowercase       (    self ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case				)      ->      Tuple:


							'''simple docstring'''

							_snake_case       :					str				       =   TFDistilBertModel(config=__snake_case				)
							_snake_case       :					Dict				       =   {"input_ids": input_ids, "attention_mask": input_mask}

							_snake_case       :					Union[str, Any]				       =   model(__snake_case				)

							_snake_case       :					Union[str, Any]				       =   [input_ids, input_mask]

							_snake_case       :					int				       =   model(__snake_case				)

							self.parent.assertEqual(result.last_hidden_state.shape ,						(self.batch_size, self.seq_length, self.hidden_size)				)







		def        lowercase       (    self ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case				)      ->      str:


							'''simple docstring'''

							_snake_case       :					str				       =   TFDistilBertForMaskedLM(config=__snake_case				)
							_snake_case       :					Optional[Any]				       =   {"input_ids": input_ids, "attention_mask": input_mask}
							_snake_case       :					Tuple				       =   model(__snake_case				)
							self.parent.assertEqual(result.logits.shape ,						(self.batch_size, self.seq_length, self.vocab_size)				)







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


							'''simple docstring'''

							_snake_case       :					int				       =   TFDistilBertForQuestionAnswering(config=__snake_case				)
							_snake_case       :					Any				       =   {
							    "input_ids": input_ids,
							    "attention_mask": input_mask,
							}
							_snake_case       :					Tuple				       =   model(__snake_case				)
							self.parent.assertEqual(result.start_logits.shape ,						(self.batch_size, self.seq_length)				)
							self.parent.assertEqual(result.end_logits.shape ,						(self.batch_size, self.seq_length)				)







		def        lowercase       (    self ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case				)      ->      str:


							'''simple docstring'''

							_snake_case       :					Dict				       =   self.num_labels
							_snake_case       :					Dict				       =   TFDistilBertForSequenceClassification(__snake_case				)
							_snake_case       :					Dict				       =   {"input_ids": input_ids, "attention_mask": input_mask}
							_snake_case       :					Optional[Any]				       =   model(__snake_case				)
							self.parent.assertEqual(result.logits.shape ,						(self.batch_size, self.num_labels)				)







		def        lowercase       (    self ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case				)      ->      Dict:


							'''simple docstring'''

							_snake_case       :					str				       =   self.num_choices
							_snake_case       :					List[str]				       =   TFDistilBertForMultipleChoice(__snake_case				)
							_snake_case       :					Optional[int]				       =   tf.tile(tf.expand_dims(__snake_case ,						1				) ,						(1, self.num_choices, 1)				)
							_snake_case       :					int				       =   tf.tile(tf.expand_dims(__snake_case ,						1				) ,						(1, self.num_choices, 1)				)
							_snake_case       :					str				       =   {
							    "input_ids": multiple_choice_inputs_ids,
							    "attention_mask": multiple_choice_input_mask,
							}
							_snake_case       :					List[Any]				       =   model(__snake_case				)
							self.parent.assertEqual(result.logits.shape ,						(self.batch_size, self.num_choices)				)







		def        lowercase       (    self ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case ,						__snake_case				)      ->      Dict:


							'''simple docstring'''

							_snake_case       :					List[str]				       =   self.num_labels
							_snake_case       :					int				       =   TFDistilBertForTokenClassification(__snake_case				)
							_snake_case       :					Any				       =   {"input_ids": input_ids, "attention_mask": input_mask}
							_snake_case       :					Any				       =   model(__snake_case				)
							self.parent.assertEqual(result.logits.shape ,						(self.batch_size, self.seq_length, self.num_labels)				)







		def        lowercase       (    self				)      ->      Tuple:


							'''simple docstring'''

							_snake_case       :					List[str]				       =   self.prepare_config_and_inputs()
							((_snake_case)       , (_snake_case)       , (_snake_case)       , (_snake_case)       , (_snake_case)       , (_snake_case))       :					List[str]				       =   config_and_inputs
							_snake_case       :					Optional[int]				       =   {"input_ids": input_ids, "attention_mask": input_mask}
							return config, inputs_dict






@require_tf
class        _a(    __A	,   __A	,   unittest.TestCase    ):
		lowerCamelCase__     :str   				=		(
		    (
		        TFDistilBertModel,
		        TFDistilBertForMaskedLM,
		        TFDistilBertForQuestionAnswering,
		        TFDistilBertForSequenceClassification,
		        TFDistilBertForTokenClassification,
		        TFDistilBertForMultipleChoice,
		    )
		    if is_tf_available()
		    else None
		)
		lowerCamelCase__     :Tuple   				=		(
		    {
		        'feature-extraction': TFDistilBertModel,
		        'fill-mask': TFDistilBertForMaskedLM,
		        'question-answering': TFDistilBertForQuestionAnswering,
		        'text-classification': TFDistilBertForSequenceClassification,
		        'token-classification': TFDistilBertForTokenClassification,
		        'zero-shot': TFDistilBertForSequenceClassification,
		    }
		    if is_tf_available()
		    else {}
		)
		lowerCamelCase__     :Tuple   				=		False
		lowerCamelCase__     :Any   				=		False







		def        lowercase       (    self				)      ->      int:


							'''simple docstring'''

							_snake_case       :					Optional[Any]				       =   TFDistilBertModelTester(self				)
							_snake_case       :					str				       =   ConfigTester(self ,						config_class=__snake_case ,						dim=3_7				)







		def        lowercase       (    self				)      ->      List[Any]:


							'''simple docstring'''

							self.config_tester.run_common_tests()







		def        lowercase       (    self				)      ->      List[Any]:


							'''simple docstring'''

							_snake_case       :					Dict				       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_distilbert_model(*__snake_case				)







		def        lowercase       (    self				)      ->      Any:


							'''simple docstring'''

							_snake_case       :					Any				       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_distilbert_for_masked_lm(*__snake_case				)







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


							'''simple docstring'''

							_snake_case       :					str				       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_distilbert_for_question_answering(*__snake_case				)







		def        lowercase       (    self				)      ->      Dict:


							'''simple docstring'''

							_snake_case       :					List[Any]				       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_distilbert_for_sequence_classification(*__snake_case				)







		def        lowercase       (    self				)      ->      Dict:


							'''simple docstring'''

							_snake_case       :					List[str]				       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_distilbert_for_multiple_choice(*__snake_case				)







		def        lowercase       (    self				)      ->      List[Any]:


							'''simple docstring'''

							_snake_case       :					Dict				       =   self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_distilbert_for_token_classification(*__snake_case				)







		@slow
		def        lowercase       (    self				)      ->      Tuple:


							'''simple docstring'''

							for model_name in list(TF_DISTILBERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]				):
												_snake_case       :					Any				       =   TFDistilBertModel.from_pretrained(__snake_case				)
												self.assertIsNotNone(__snake_case				)






@require_tf
class        _a(    unittest.TestCase    ):







		@slow
		def        lowercase       (    self				)      ->      List[str]:


							'''simple docstring'''

							_snake_case       :					Any				       =   TFDistilBertModel.from_pretrained("distilbert-base-uncased"				)
							_snake_case       :					int				       =   tf.constant([[0, 1, 2, 3, 4, 5]]				)
							_snake_case       :					Dict				       =   model(__snake_case				)[0]

							_snake_case       :					str				       =   [1, 6, 7_6_8]
							self.assertEqual(output.shape ,						__snake_case				)

							_snake_case       :					Optional[Any]				       =   tf.constant(
							    [
							        [
							            [0.19_26_18_85, -0.13_73_29_55, 0.4_11_97_99],
							            [0.22_15_01_56, -0.07_42_26_61, 0.39_03_72_04],
							            [0.22_75_60_18, -0.0_89_64_14, 0.3_70_14_67],
							        ]
							    ]				)
							tf.debugging.assert_near(output[:, :3, :3] ,						__snake_case ,						atol=1E-4				)