



import os
import re
import unicodedata
from shutil import copyfile
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union

import sentencepiece as spm

from ...tokenization_utils import PreTrainedTokenizer
from ...utils import is_torch_available, logging


if is_torch_available():
     import torch


if TYPE_CHECKING:
     from transformers.pipelines.conversational import Conversation


SCREAMING_SNAKE_CASE_:int					=						logging.get_logger(__name__)
SCREAMING_SNAKE_CASE_:Optional[int]					=						{"""vocab_file""": """spiece.model"""}

SCREAMING_SNAKE_CASE_:List[Any]					=						{
    """vocab_file""": {
        """AI-Sweden/gpt-sw3-126m""": """https://huggingface.co/AI-Sweden/gpt-sw3-126m/resolve/main/spiece.model""",
        """AI-Sweden/gpt-sw3-350m""": """https://huggingface.co/AI-Sweden/gpt-sw3-350m/resolve/main/spiece.model""",
        """AI-Sweden/gpt-sw3-1.6b""": """https://huggingface.co/AI-Sweden/gpt-sw3-1.6b/resolve/main/spiece.model""",
        """AI-Sweden/gpt-sw3-6.7b""": """https://huggingface.co/AI-Sweden/gpt-sw3-6.7b/resolve/main/spiece.model""",
        """AI-Sweden/gpt-sw3-20b""": """https://huggingface.co/AI-Sweden/gpt-sw3-20b/resolve/main/spiece.model""",
    }
}

SCREAMING_SNAKE_CASE_:Dict					=						{
    """AI-Sweden/gpt-sw3-126m""": 2_048,
    """AI-Sweden/gpt-sw3-350m""": 2_048,
    """AI-Sweden/gpt-sw3-1.6b""": 2_048,
    """AI-Sweden/gpt-sw3-6.7b""": 2_048,
    """AI-Sweden/gpt-sw3-20b""": 2_048,
}






class SCREAMING_SNAKE_CASE__					(		SCREAMING_SNAKE_CASE__   ):




    '''simple docstring'''






    __lowerCamelCase      :			List[str] =				VOCAB_FILES_NAMES
    __lowerCamelCase      :			Optional[int] =				PRETRAINED_VOCAB_FILES_MAP
    __lowerCamelCase      :			Tuple =				PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
    __lowerCamelCase      :			int =				["input_ids", "attention_mask"]






    def __init__(	self,		lowerCamelCase__,		lowerCamelCase__=False,		lowerCamelCase__=False,		lowerCamelCase__=False,		lowerCamelCase__=None,		lowerCamelCase__=None,		lowerCamelCase__=None,		lowerCamelCase__=None,		lowerCamelCase__ = None,		**lowerCamelCase__,		):
        A			:	List[str]										=       {} if sp_model_kwargs is None else sp_model_kwargs

        A			:	Optional[int]										=       kwargs.get("""name_or_path"""		)
        if name_or_path is None:
            logger.warning(
                """name_or_path not provided, will work for all GPTSw3 models except gpt-sw3-7b,"""
                """ you are testing the model, this can safely be ignored"""		)
            A			:	str										=       """None"""

        # Default definitions for our 2 tokenizer versions, with None-checks to enable proper testing
        A			:	Tuple										=       """<|endoftext|>""" if eos_token is None else eos_token
        A			:	Optional[int]										=       """<unk>""" if unk_token is None else unk_token
        if "gpt-sw3-7b" in name_or_path:
            A			:	int										=       unk_token if pad_token is None else pad_token
            A			:	Union[str, Any]										=       eos_token if bos_token is None else bos_token
        else:
            A			:	int										=       """<pad>""" if pad_token is None else pad_token
            A			:	Tuple										=       """<s>""" if bos_token is None else bos_token

        super().__init__(
            do_lower_case=lowerCamelCase__,		remove_space=lowerCamelCase__,		keep_accents=lowerCamelCase__,		bos_token=lowerCamelCase__,		eos_token=lowerCamelCase__,		unk_token=lowerCamelCase__,		pad_token=lowerCamelCase__,		sp_model_kwargs=self.sp_model_kwargs,		**lowerCamelCase__,		)

        A			:	int										=       do_lower_case
        A			:	str										=       remove_space
        A			:	Dict										=       keep_accents
        A			:	Optional[int]										=       vocab_file

        A			:	Optional[Any]										=       spm.SentencePieceProcessor(**self.sp_model_kwargs		)
        self.sp_model.Load(lowerCamelCase__		)

        # Used for whitespace normalization in input texts
        # fmt : off
        A			:	Dict										=       {""" """, """ """, """ """, """ """, """ """, """　""", """ """, """ """, """ """, """ """, """￼""", """"""}
        # fmt : on

        # Regular expression to remove non-printing characters (e.g. some unicode control chars) in preprocessing
        A			:	Tuple										=       re.compile(
            f'''[{"".join(map(lowerCamelCase__,		list(range(0,		9		)		) + list(range(11,		32		)		) + list(range(127,		160		)		) + [160, 173, 8203]		)		)}]'''		)






    def __getstate__(	self		):
        A			:	Tuple										=       self.__dict__.copy()
        A			:	List[Any]										=       None
        return state






    def __setstate__(	self,		lowerCamelCase__		):
        A			:	List[Any]										=       d

        # for backward compatibility
        if not hasattr(self,		"""sp_model_kwargs"""		):
            A			:	str										=       {}

        A			:	Optional[Any]										=       spm.SentencePieceProcessor(**self.sp_model_kwargs		)
        self.sp_model.Load(self.vocab_file		)






    @property
    # Copied from transformers.models.albert.tokenization_albert.AlbertTokenizer.vocab_size
    def       _lowerCAmelCase (	self		):
        return len(self.sp_model		)






    def       _lowerCAmelCase (	self,		lowerCamelCase__		):
        A			:	Tuple										=       self.non_printing_characters_re.sub("""""",		lowerCamelCase__		)

        # Normalize whitespaces
        A			:	List[Any]										=       """""".join([char if char not in self.whitespaces else """ """ for char in text]		)

        # NFC Unicode normalization
        A			:	Optional[int]										=       unicodedata.normalize("""NFC""",		lowerCamelCase__		)
        return text






    def       _lowerCAmelCase (	self,		lowerCamelCase__,		**lowerCamelCase__		):
        A			:	str										=       self.preprocess_text(lowerCamelCase__		)
        return self.sp_model.encode(lowerCamelCase__,		out_type=lowerCamelCase__		)






    def       _lowerCAmelCase (	self,		lowerCamelCase__		):
        return self.sp_model.PieceToId(lowerCamelCase__		)






    def       _lowerCAmelCase (	self,		lowerCamelCase__		):
        return self.sp_model.IdToPiece(lowerCamelCase__		)






    @staticmethod
    def       _lowerCAmelCase (	lowerCamelCase__		):
        return out_string






    def       _lowerCAmelCase (	self,		lowerCamelCase__		):
        A			:	str										=       []
        A			:	Tuple										=       """"""
        A			:	Dict										=       False
        for token in tokens:
            # make sure that special tokens are not decoded using sentencepiece model
            if token in self.all_special_tokens:
                # TODO: Check if this is needed, as it ensures that decode(encode(doc)) != doc by adding extra whitespace in the decoded document
                if not prev_is_special:
                    out_string += " "

                out_string += self.sp_model.decode(lowerCamelCase__		) + token
                A			:	Union[str, Any]										=       True
                A			:	List[Any]										=       []
            else:
                current_sub_tokens.append(lowerCamelCase__		)
                A			:	int										=       False
        out_string += self.sp_model.decode(lowerCamelCase__		)

        return out_string






    def       _lowerCAmelCase (	self		):
        A			:	List[str]										=       {self.convert_ids_to_tokens(lowerCamelCase__		): i for i in range(self.vocab_size		)}
        vocab.update(self.added_tokens_encoder		)
        return vocab






    def       _lowerCAmelCase (	self,		lowerCamelCase__,		lowerCamelCase__ = None		):
        if not os.path.isdir(lowerCamelCase__		):
            logger.error(f'''Vocabulary path ({save_directory}) should be a directory'''		)
            return
        A			:	Tuple										=       os.path.join(
            lowerCamelCase__,		(filename_prefix + """-""" if filename_prefix else """""") + VOCAB_FILES_NAMES["""vocab_file"""]		)

        if os.path.abspath(self.vocab_file		) != os.path.abspath(lowerCamelCase__		) and os.path.isfile(self.vocab_file		):
            copyfile(self.vocab_file,		lowerCamelCase__		)
        elif not os.path.isfile(self.vocab_file		):
            with open(lowerCamelCase__,		"""wb"""		) as fi:
                A			:	Optional[int]										=       self.sp_model.serialized_model_proto()
                fi.write(lowerCamelCase__		)

        return (out_vocab_file,)






    def       _lowerCAmelCase (	self,		lowerCamelCase__,		lowerCamelCase__ = False		):

        if isinstance(lowerCamelCase__,		lowerCamelCase__		):
            A			:	Tuple										=       self.preprocess_text(lowerCamelCase__		)
            A			:	Dict										=       self.sp_model.encode(lowerCamelCase__		)
        else:
            A			:	Tuple										=       [self.preprocess_text(lowerCamelCase__		) for t in text]
            A			:	Union[str, Any]										=       self.sp_model.encode(lowerCamelCase__		)

        if return_tensors is True or return_tensors == "pt":
            A			:	Optional[Any]										=       torch.tensor(lowerCamelCase__		)

        return token_ids






    def       _lowerCAmelCase (	self,		lowerCamelCase__		):
        return self.sp_model.decode(lowerCamelCase__		)






    def       _lowerCAmelCase (	self,		lowerCamelCase__		):
        A			:	Optional[Any]										=       [f'''User: {text}''' if is_user else f'''Bot: {text}''' for is_user, text in conversation.iter_texts()]
        A			:	Any										=       (
            f'''{self.eos_token}{self.bos_token}''' + f'''{self.bos_token}'''.join(lowerCamelCase__		) + f'''{self.bos_token}Bot:'''
        )
        return self.encode(text=lowerCamelCase__		)







import tempfile
import unittest

import numpy as np

import transformers
from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available
from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow

from ...generation.test_flax_utils import FlaxGenerationTesterMixin
from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask


if is_flax_available():
     import jax
     import jax.numpy as jnp

     from transformers.modeling_flax_pytorch_utils import (
         convert_pytorch_state_dict_to_flax,
         load_flax_weights_in_pytorch_model,
     )
     from transformers.models.gptj.modeling_flax_gptj import FlaxGPTJForCausalLM, FlaxGPTJModel

if is_torch_available():
     import torch






class SCREAMING_SNAKE_CASE__					:




    '''simple docstring'''






    def __init__(	self,		lowerCamelCase__,		lowerCamelCase__=14,		lowerCamelCase__=7,		lowerCamelCase__=True,		lowerCamelCase__=True,		lowerCamelCase__=False,		lowerCamelCase__=True,		lowerCamelCase__=99,		lowerCamelCase__=32,		lowerCamelCase__=4,		lowerCamelCase__=4,		lowerCamelCase__=4,		lowerCamelCase__=37,		lowerCamelCase__="gelu",		lowerCamelCase__=0.1,		lowerCamelCase__=0.1,		lowerCamelCase__=512,		lowerCamelCase__=0.02,		):
        A			:	List[str]										=       parent
        A			:	Any										=       batch_size
        A			:	Dict										=       seq_length
        A			:	Tuple										=       is_training
        A			:	Any										=       use_input_mask
        A			:	Any										=       use_token_type_ids
        A			:	Any										=       use_labels
        A			:	Optional[int]										=       vocab_size
        A			:	Dict										=       hidden_size
        A			:	Dict										=       rotary_dim
        A			:	Dict										=       num_hidden_layers
        A			:	Tuple										=       num_attention_heads
        A			:	Tuple										=       intermediate_size
        A			:	Union[str, Any]										=       hidden_act
        A			:	Dict										=       hidden_dropout_prob
        A			:	List[str]										=       attention_probs_dropout_prob
        A			:	Optional[int]										=       max_position_embeddings
        A			:	str										=       initializer_range
        A			:	Any										=       None
        A			:	Any										=       vocab_size - 1
        A			:	int										=       vocab_size - 1
        A			:	int										=       vocab_size - 1






    def       _lowerCAmelCase (	self		):
        A			:	str										=       ids_tensor([self.batch_size, self.seq_length],		self.vocab_size		)

        A			:	Optional[int]										=       None
        if self.use_input_mask:
            A			:	Any										=       random_attention_mask([self.batch_size, self.seq_length]		)

        A			:	int										=       GPTJConfig(
            vocab_size=self.vocab_size,		n_embd=self.hidden_size,		n_layer=self.num_hidden_layers,		n_head=self.num_attention_heads,		n_positions=self.max_position_embeddings,		use_cache=lowerCamelCase__,		bos_token_id=self.bos_token_id,		eos_token_id=self.eos_token_id,		pad_token_id=self.pad_token_id,		rotary_dim=self.rotary_dim,		)

        return (config, input_ids, input_mask)






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






    def       _lowerCAmelCase (	self,		lowerCamelCase__,		lowerCamelCase__,		lowerCamelCase__,		lowerCamelCase__		):
        A			:	Optional[int]										=       20
        A			:	Tuple										=       model_class_name(lowerCamelCase__		)

        A			:	Dict										=       model.init_cache(input_ids.shape[0],		lowerCamelCase__		)
        A			:	int										=       jnp.ones((input_ids.shape[0], max_decoder_length),		dtype="""i4"""		)

        A			:	Optional[int]										=       jnp.broadcast_to(
            jnp.arange(input_ids.shape[-1] - 1		)[None, :],		(input_ids.shape[0], input_ids.shape[-1] - 1)		)
        A			:	List[Any]										=       model(
            input_ids[:, :-1],		attention_mask=lowerCamelCase__,		past_key_values=lowerCamelCase__,		position_ids=lowerCamelCase__,		)

        A			:	List[Any]										=       jnp.array(input_ids.shape[0] * [[input_ids.shape[-1] - 1]],		dtype="""i4"""		)
        A			:	Any										=       model(
            input_ids[:, -1:],		attention_mask=lowerCamelCase__,		past_key_values=outputs_cache.past_key_values,		position_ids=lowerCamelCase__,		)

        A			:	Any										=       model(lowerCamelCase__		)

        A			:	List[Any]										=       np.max(np.abs((outputs_cache_next[0][:, -1, :5] - outputs[0][:, -1, :5])		)		)
        self.parent.assertTrue(diff < 1e-3,		msg=f'''Max diff is {diff}'''		)






    def       _lowerCAmelCase (	self,		lowerCamelCase__,		lowerCamelCase__,		lowerCamelCase__,		lowerCamelCase__		):
        A			:	Any										=       20
        A			:	Any										=       model_class_name(lowerCamelCase__		)

        A			:	Dict										=       jnp.concatenate(
            [attention_mask, jnp.zeros((attention_mask.shape[0], max_decoder_length - attention_mask.shape[1])		)],		axis=-1,		)

        A			:	str										=       model.init_cache(input_ids.shape[0],		lowerCamelCase__		)
        A			:	Any										=       jnp.broadcast_to(
            jnp.arange(input_ids.shape[-1] - 1		)[None, :],		(input_ids.shape[0], input_ids.shape[-1] - 1)		)

        A			:	Optional[int]										=       model(
            input_ids[:, :-1],		attention_mask=lowerCamelCase__,		past_key_values=lowerCamelCase__,		position_ids=lowerCamelCase__,		)
        A			:	str										=       jnp.array(input_ids.shape[0] * [[input_ids.shape[-1] - 1]],		dtype="""i4"""		)
        A			:	List[Any]										=       model(
            input_ids[:, -1:],		past_key_values=outputs_cache.past_key_values,		attention_mask=lowerCamelCase__,		position_ids=lowerCamelCase__,		)

        A			:	Union[str, Any]										=       model(lowerCamelCase__,		attention_mask=lowerCamelCase__		)

        A			:	str										=       np.max(np.abs((outputs_cache_next[0][:, -1, :5] - outputs[0][:, -1, :5])		)		)
        self.parent.assertTrue(diff < 1e-3,		msg=f'''Max diff is {diff}'''		)






@require_flax
class SCREAMING_SNAKE_CASE__					(		SCREAMING_SNAKE_CASE__			,						SCREAMING_SNAKE_CASE__			,						unittest.TestCase   ):




    '''simple docstring'''






    __lowerCamelCase      :			Any =				(FlaxGPTJModel, FlaxGPTJForCausalLM) if is_flax_available() else ()
    __lowerCamelCase      :			Optional[int] =				(FlaxGPTJForCausalLM,) if is_flax_available() else ()






    def       _lowerCAmelCase (	self		):
        A			:	List[Any]										=       FlaxGPTJModelTester(self		)






    def       _lowerCAmelCase (	self		):
        for model_class_name in self.all_model_classes:
            A					,							A					,							A			:	Optional[Any]										=       self.model_tester.prepare_config_and_inputs()
            self.model_tester.check_use_cache_forward(lowerCamelCase__,		lowerCamelCase__,		lowerCamelCase__,		lowerCamelCase__		)






    def       _lowerCAmelCase (	self		):
        for model_class_name in self.all_model_classes:
            A					,							A					,							A			:	str										=       self.model_tester.prepare_config_and_inputs()
            self.model_tester.check_use_cache_forward_with_attn_mask(
                lowerCamelCase__,		lowerCamelCase__,		lowerCamelCase__,		lowerCamelCase__		)






    @tooslow
    def       _lowerCAmelCase (	self		):
        A			:	int										=       GPTaTokenizer.from_pretrained("""gpt2""",		pad_token="""<|endoftext|>""",		padding_side="""left"""		)
        A			:	Optional[int]										=       tokenizer(["""Hello this is a long string""", """Hey"""],		return_tensors="""np""",		padding=lowerCamelCase__,		truncation=lowerCamelCase__		)

        A			:	Dict										=       FlaxGPTJForCausalLM.from_pretrained("""EleutherAI/gpt-j-6B"""		)
        A			:	str										=       False
        A			:	Optional[Any]										=       model.config.eos_token_id

        A			:	Union[str, Any]										=       jax.jit(model.generate		)

        A			:	str										=       jit_generate(
            inputs["""input_ids"""],		attention_mask=inputs["""attention_mask"""],		pad_token_id=tokenizer.pad_token_id		).sequences

        A			:	Optional[Any]										=       tokenizer.batch_decode(lowerCamelCase__,		skip_special_tokens=lowerCamelCase__		)

        A			:	Tuple										=       [
            """Hello this is a long string of text.\n\nI'm trying to get the text of the""",
            """Hey, I'm a little late to the party. I'm going to""",
        ]

        self.assertListEqual(lowerCamelCase__,		lowerCamelCase__		)






    @is_pt_flax_cross_test
    def       _lowerCAmelCase (	self		):
        A					,							A			:	Optional[Any]										=       self.model_tester.prepare_config_and_inputs_for_common()

        for model_class in self.all_model_classes:
            with self.subTest(model_class.__name__		):
                # prepare inputs
                A			:	Any										=       self._prepare_for_class(lowerCamelCase__,		lowerCamelCase__		)
                A			:	Dict										=       {k: torch.tensor(v.tolist()		) for k, v in prepared_inputs_dict.items()}

                # load corresponding PyTorch class
                A			:	List[Any]										=       model_class.__name__[4:]  # Skip the "Flax" at the beginning
                A			:	str										=       getattr(lowerCamelCase__,		lowerCamelCase__		)

                A					,							A			:	Optional[int]										=       pt_inputs["""input_ids"""].shape
                A			:	List[str]										=       np.random.randint(0,		seq_length - 1,		size=(batch_size,)		)
                for batch_idx, start_index in enumerate(lowerCamelCase__		):
                    A			:	List[Any]										=       0
                    A			:	Tuple										=       1
                    A			:	Optional[int]										=       0
                    A			:	str										=       1
                A			:	Dict										=       pt_model_class(lowerCamelCase__		).eval()
                A			:	int										=       model_class(lowerCamelCase__,		dtype=jnp.floataa		)

                A			:	int										=       convert_pytorch_state_dict_to_flax(pt_model.state_dict(),		lowerCamelCase__		)
                A			:	Dict										=       fx_state

                with torch.no_grad():
                    A			:	Optional[int]										=       pt_model(**lowerCamelCase__		).to_tuple()

                A			:	str										=       fx_model(**lowerCamelCase__		).to_tuple()
                self.assertEqual(len(lowerCamelCase__		),		len(lowerCamelCase__		),		"""Output lengths differ between Flax and PyTorch"""		)
                for fx_output, pt_output in zip(lowerCamelCase__,		lowerCamelCase__		):
                    self.assert_almost_equals(fx_output[:, -1],		pt_output[:, -1].numpy(),		4e-2		)

                with tempfile.TemporaryDirectory() as tmpdirname:
                    pt_model.save_pretrained(lowerCamelCase__		)
                    A			:	Union[str, Any]										=       model_class.from_pretrained(lowerCamelCase__,		from_pt=lowerCamelCase__		)

                A			:	Any										=       fx_model_loaded(**lowerCamelCase__		).to_tuple()
                self.assertEqual(
                    len(lowerCamelCase__		),		len(lowerCamelCase__		),		"""Output lengths differ between Flax and PyTorch"""		)
                for fx_output_loaded, pt_output in zip(lowerCamelCase__,		lowerCamelCase__		):
                    self.assert_almost_equals(fx_output_loaded[:, -1],		pt_output[:, -1].numpy(),		4e-2		)






    @is_pt_flax_cross_test
    def       _lowerCAmelCase (	self		):
        A					,							A			:	Dict										=       self.model_tester.prepare_config_and_inputs_for_common()
        for model_class in self.all_model_classes:
            with self.subTest(model_class.__name__		):
                # prepare inputs
                A			:	int										=       self._prepare_for_class(lowerCamelCase__,		lowerCamelCase__		)
                A			:	List[str]										=       {k: torch.tensor(v.tolist()		) for k, v in prepared_inputs_dict.items()}

                # load corresponding PyTorch class
                A			:	Dict										=       model_class.__name__[4:]  # Skip the "Flax" at the beginning
                A			:	Dict										=       getattr(lowerCamelCase__,		lowerCamelCase__		)

                A			:	int										=       pt_model_class(lowerCamelCase__		).eval()
                A			:	int										=       model_class(lowerCamelCase__,		dtype=jnp.floataa		)

                A			:	List[str]										=       load_flax_weights_in_pytorch_model(lowerCamelCase__,		fx_model.params		)
                A					,							A			:	Optional[int]										=       pt_inputs["""input_ids"""].shape
                A			:	Optional[int]										=       np.random.randint(0,		seq_length - 1,		size=(batch_size,)		)
                for batch_idx, start_index in enumerate(lowerCamelCase__		):
                    A			:	Tuple										=       0
                    A			:	Tuple										=       1
                    A			:	str										=       0
                    A			:	int										=       1

                # make sure weights are tied in PyTorch
                pt_model.tie_weights()

                with torch.no_grad():
                    A			:	List[str]										=       pt_model(**lowerCamelCase__		).to_tuple()

                A			:	Optional[int]										=       fx_model(**lowerCamelCase__		).to_tuple()
                self.assertEqual(len(lowerCamelCase__		),		len(lowerCamelCase__		),		"""Output lengths differ between Flax and PyTorch"""		)
                for fx_output, pt_output in zip(lowerCamelCase__,		lowerCamelCase__		):
                    self.assert_almost_equals(fx_output[:, -1],		pt_output[:, -1].numpy(),		4e-2		)

                with tempfile.TemporaryDirectory() as tmpdirname:
                    fx_model.save_pretrained(lowerCamelCase__		)
                    A			:	str										=       pt_model_class.from_pretrained(lowerCamelCase__,		from_flax=lowerCamelCase__		)

                with torch.no_grad():
                    A			:	str										=       pt_model_loaded(**lowerCamelCase__		).to_tuple()

                self.assertEqual(
                    len(lowerCamelCase__		),		len(lowerCamelCase__		),		"""Output lengths differ between Flax and PyTorch"""		)
                for fx_output, pt_output in zip(lowerCamelCase__,		lowerCamelCase__		):
                    self.assert_almost_equals(fx_output[:, -1],		pt_output[:, -1].numpy(),		4e-2		)






    @tooslow
    def       _lowerCAmelCase (	self		):
        for model_class_name in self.all_model_classes:
            A			:	Union[str, Any]										=       model_class_name.from_pretrained("""EleutherAI/gpt-j-6B"""		)
            A			:	List[str]										=       model(np.ones((1, 1)		)		)
            self.assertIsNotNone(lowerCamelCase__		)


