


'''simple docstring'''

import json
import os
import pickle
import subprocess
from hashlib import mda
from pathlib import Path
from tempfile import gettempdir
from textwrap import dedent
from types import CodeType, FunctionType
from unittest import TestCase
from unittest.mock import patch

import pytest
from multiprocess import Pool
from packaging import version

import datasets
from datasets.fingerprint import Hasher, fingerprint_transform
from datasets.table import InMemoryTable

from .utils import (
    require_regex,
    require_spacy,
    require_spacy_model,
    require_tiktoken,
    require_torch,
    require_transformers,
)
class   __lowerCAmelCase						:





      '''simple docstring'''






      def __init__(self   :   Any       ,						UpperCamelCase   :   int			):

             '''simple docstring'''







             lowercase__				      =			foo






      def __call__(self   :   Optional[Any]			):

             '''simple docstring'''







             return self.foo






class   __lowerCAmelCase						(datasets.Dataset					):





      '''simple docstring'''






      @fingerprint_transform(inplace=UpperCamelCase			)
      def 				UpperCamelCase__		(self   :   List[Any]       ,						UpperCamelCase   :   Tuple       ,						*UpperCamelCase   :   List[str]       ,						**UpperCamelCase   :   Optional[Any]			):

             '''simple docstring'''







             return DatasetChild(self.data       ,						fingerprint=UpperCamelCase			)






      @fingerprint_transform(inplace=UpperCamelCase			)
      def 				UpperCamelCase__		(self   :   List[Any]       ,						UpperCamelCase   :   Tuple       ,						*UpperCamelCase   :   List[str]       ,						**UpperCamelCase   :   Dict			):

             '''simple docstring'''







             return DatasetChild(self.data       ,						fingerprint=UpperCamelCase			)






class   __lowerCAmelCase						:





      '''simple docstring'''






      def __init__(self   :   Any       ,						UpperCamelCase   :   Any			):

             '''simple docstring'''







             lowercase__				      =			callable



      def __call__(self   :   Optional[Any]       ,						*UpperCamelCase   :   str       ,						**UpperCamelCase   :   List[Any]			):

             '''simple docstring'''







             if self.callable is not None:
                    return self.callable(*UpperCamelCase       ,						**UpperCamelCase			)






      def __getstate__(self   :   int			):

             '''simple docstring'''







             raise pickle.PicklingError()






class   __lowerCAmelCase						(lowercase_					):





      '''simple docstring'''






      @require_transformers
      @pytest.mark.integration
      def 				UpperCamelCase__		(self   :   List[str]			):

             '''simple docstring'''







             from transformers import AutoTokenizer

             def encode(UpperCamelCase   :   Union[str, Any]			):
                    return tokenizer(UpperCamelCase			)

             # TODO: add hash consistency tests across sessions
             lowercase__				      =			AutoTokenizer.from_pretrained('''bert-base-uncased'''			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(lambda UpperCamelCase			: tokenizer(UpperCamelCase			)			)			).hexdigest()
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             lowercase__				      =			AutoTokenizer.from_pretrained('''bert-base-cased'''			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(lambda UpperCamelCase			: tokenizer(UpperCamelCase			)			)			).hexdigest()
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             lowercase__				      =			AutoTokenizer.from_pretrained('''bert-base-uncased'''			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(lambda UpperCamelCase			: tokenizer(UpperCamelCase			)			)			).hexdigest()
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertNotEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertNotEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertNotEqual(UpperCamelCase       ,						UpperCamelCase			)



      @require_transformers
      @pytest.mark.integration
      def 				UpperCamelCase__		(self   :   Tuple			):

             '''simple docstring'''







             from transformers import AutoTokenizer

             lowercase__				      =			AutoTokenizer.from_pretrained('''gpt2'''			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             tokenizer('''Hello world !'''			)  # call once to change the tokenizer's cache
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)






      @require_regex
      def 				UpperCamelCase__		(self   :   Union[str, Any]			):

             '''simple docstring'''







             import regex

             lowercase__				      =			regex.Regex('''foo'''			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             lowercase__				      =			regex.Regex('''bar'''			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             lowercase__				      =			regex.Regex('''foo'''			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertNotEqual(UpperCamelCase       ,						UpperCamelCase			)






class   __lowerCAmelCase						(lowercase_					):





      '''simple docstring'''






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

             '''simple docstring'''







             def func():
                    return foo

             lowercase__				      =			[0]
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             lowercase__				      =			[1]
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             lowercase__				      =			[0]
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertNotEqual(UpperCamelCase       ,						UpperCamelCase			)



      def 				UpperCamelCase__		(self   :   Dict			):

             '''simple docstring'''







             def func():
                    pass

             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()

             def func():
                    pass

             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)



      def 				UpperCamelCase__		(self   :   Any			):

             '''simple docstring'''







             lowercase__				      =			mda(datasets.utils.py_utils.dumps(Foo([0]			)			)			).hexdigest()
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(Foo([1]			)			)			).hexdigest()
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(Foo([0]			)			)			).hexdigest()
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertNotEqual(UpperCamelCase       ,						UpperCamelCase			)



      def 				UpperCamelCase__		(self   :   Optional[Any]			):

             '''simple docstring'''







             lowercase__				      =			mda(datasets.utils.py_utils.dumps(Foo([0]			).__call__			)			).hexdigest()
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(Foo([1]			).__call__			)			).hexdigest()
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(Foo([0]			).__call__			)			).hexdigest()
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertNotEqual(UpperCamelCase       ,						UpperCamelCase			)



      def 				UpperCamelCase__		(self   :   Tuple			):

             '''simple docstring'''







             lowercase__				      =			(
                 '''co_argcount''',
                 '''co_kwonlyargcount''',
                 '''co_nlocals''',
                 '''co_stacksize''',
                 '''co_flags''',
                 '''co_code''',
                 '''co_consts''',
                 '''co_names''',
                 '''co_varnames''',
                 '''co_filename''',
                 '''co_name''',
                 '''co_firstlineno''',
                 '''co_lnotab''',
                 '''co_freevars''',
                 '''co_cellvars''',
             )

             def _create_code_pyaa(*UpperCamelCase   :   Tuple			):
                    if hasattr(args[-3]       ,						'''encode'''			):
                           lowercase__				      =			list(UpperCamelCase			)
                           lowercase__				      =			args[-3].encode()  # co_lnotab
                           lowercase__				      =			args[-10].encode()  # co_code
                    if hasattr(UpperCamelCase       ,						'''co_posonlyargcount'''			):
                           if len(UpperCamelCase			) == 16:
                                  return CodeType(*UpperCamelCase			)
                           elif len(UpperCamelCase			) == 15:
                                  return CodeType(args[0]       ,						0       ,						*args[1:]			)
                           return CodeType(args[0]       ,						0       ,						0       ,						*args[1:]			)
                    elif hasattr(UpperCamelCase       ,						'''co_kwonlyargcount'''			):
                           if len(UpperCamelCase			) == 16:
                                  return CodeType(args[0]       ,						*args[2:]			)
                           elif len(UpperCamelCase			) == 15:
                                  return CodeType(*UpperCamelCase			)
                           return CodeType(args[0]       ,						0       ,						*args[1:]			)
                    if len(UpperCamelCase			) == 16:
                           return CodeType(args[0]       ,						*args[3:]			)
                    elif len(UpperCamelCase			) == 15:
                           return CodeType(args[0]       ,						*args[2:]			)
                    return CodeType(*UpperCamelCase			)

             def create_ipython_func(UpperCamelCase   :   int       ,						UpperCamelCase   :   Any			):
                    def func():
                           return returned_obj

                    lowercase__				      =			func.__code__
                    # Use _create_code from dill in order to make it work for different python versions
                    if datasets.config.PY_VERSION < version.parse('''3.8'''			):
                           lowercase__				      =			_create_code_pyaa(
                               *[getattr(UpperCamelCase       ,						UpperCamelCase			) if k != '''co_filename''' else co_filename for k in code_args_pyaa]			)
                    else:
                           lowercase__				      =			code.replace(co_filename=UpperCamelCase			)
                    return FunctionType(UpperCamelCase       ,						func.__globals__       ,						func.__name__       ,						func.__defaults__       ,						func.__closure__			)

             lowercase__      ,lowercase__				      =			'''<ipython-input-2-e0383a102aae>''', [0]
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(create_ipython_func(UpperCamelCase       ,						UpperCamelCase			)			)			).hexdigest()
             lowercase__      ,lowercase__				      =			'''<ipython-input-2-e0383a102aae>''', [1]
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(create_ipython_func(UpperCamelCase       ,						UpperCamelCase			)			)			).hexdigest()
             lowercase__      ,lowercase__				      =			'''<ipython-input-5-713f6613acf3>''', [0]
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(create_ipython_func(UpperCamelCase       ,						UpperCamelCase			)			)			).hexdigest()
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertNotEqual(UpperCamelCase       ,						UpperCamelCase			)

             lowercase__      ,lowercase__				      =			os.path.join(gettempdir()       ,						'''ipykernel_12345'''       ,						'''321456789.py'''			), [0]
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(create_ipython_func(UpperCamelCase       ,						UpperCamelCase			)			)			).hexdigest()
             lowercase__      ,lowercase__				      =			os.path.join(gettempdir()       ,						'''ipykernel_12345'''       ,						'''321456789.py'''			), [1]
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(create_ipython_func(UpperCamelCase       ,						UpperCamelCase			)			)			).hexdigest()
             lowercase__      ,lowercase__				      =			os.path.join(gettempdir()       ,						'''ipykernel_12345'''       ,						'''654123987.py'''			), [0]
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(create_ipython_func(UpperCamelCase       ,						UpperCamelCase			)			)			).hexdigest()
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertNotEqual(UpperCamelCase       ,						UpperCamelCase			)






      def 				UpperCamelCase__		(self   :   Any			):

             '''simple docstring'''







             lowercase__      ,lowercase__				      =			[0], [1]

             def func():
                    return foo, bar

             lowercase__				      =			'''__main__'''

             def globalvars_mocka_side_effect(UpperCamelCase   :   Union[str, Any]       ,						*UpperCamelCase   :   Optional[int]       ,						**UpperCamelCase   :   Any			):
                    return {"foo": foo, "bar": bar}

             def globalvars_mocka_side_effect(UpperCamelCase   :   Dict       ,						*UpperCamelCase   :   Optional[int]       ,						**UpperCamelCase   :   Tuple			):
                    return {"bar": bar, "foo": foo}

             with patch('''dill.detect.globalvars'''       ,						side_effect=UpperCamelCase			) as globalvars_mocka:
                    lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
                    self.assertGreater(globalvars_mocka.call_count       ,						0			)
             with patch('''dill.detect.globalvars'''       ,						side_effect=UpperCamelCase			) as globalvars_mocka:
                    lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
                    self.assertGreater(globalvars_mocka.call_count       ,						0			)
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)






class   __lowerCAmelCase						(lowercase_					):





      '''simple docstring'''






      def 				UpperCamelCase__		(self   :   Any			):

             '''simple docstring'''







             lowercase__				      =			Hasher.hash('''hello'''			)
             lowercase__				      =			Hasher.hash('''hello'''			)
             lowercase__				      =			Hasher.hash('''there'''			)
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertNotEqual(UpperCamelCase       ,						UpperCamelCase			)



      def 				UpperCamelCase__		(self   :   str			):

             '''simple docstring'''







             lowercase__				      =			Hasher.hash(Foo('''hello'''			)			)
             lowercase__				      =			Hasher.hash(Foo('''hello'''			)			)
             lowercase__				      =			Hasher.hash(Foo('''there'''			)			)
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertNotEqual(UpperCamelCase       ,						UpperCamelCase			)



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

             '''simple docstring'''







             lowercase__				      =			Hasher()
             for x in ["hello", Foo('''hello'''			)]:
                    hasher.update(UpperCamelCase			)
             lowercase__				      =			hasher.hexdigest()
             lowercase__				      =			Hasher()
             for x in ["hello", Foo('''hello'''			)]:
                    hasher.update(UpperCamelCase			)
             lowercase__				      =			hasher.hexdigest()
             lowercase__				      =			Hasher()
             for x in ["there", Foo('''there'''			)]:
                    hasher.update(UpperCamelCase			)
             lowercase__				      =			hasher.hexdigest()
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertNotEqual(UpperCamelCase       ,						UpperCamelCase			)



      def 				UpperCamelCase__		(self   :   Any			):

             '''simple docstring'''







             with self.assertRaises(pickle.PicklingError			):
                    Hasher.hash(UnpicklableCallable(Foo('''hello'''			)			)			)



      def 				UpperCamelCase__		(self   :   Optional[Any]			):

             '''simple docstring'''







             lowercase__				      =			'''abc'''
             lowercase__				      =			[string, string]  # two strings have the same ids
             lowercase__				      =			[string, string]
             lowercase__				      =			json.loads(f"[\"{string}\", \"{string}\"]"			)  # two strings have different ids
             self.assertIs(obja[0]       ,						UpperCamelCase			)
             self.assertIs(obja[0]       ,						obja[1]			)
             self.assertIs(obja[0]       ,						UpperCamelCase			)
             self.assertIs(obja[0]       ,						obja[1]			)
             self.assertIsNot(obja[0]       ,						UpperCamelCase			)
             self.assertIsNot(obja[0]       ,						obja[1]			)
             lowercase__				      =			Hasher.hash(UpperCamelCase			)
             lowercase__				      =			Hasher.hash(UpperCamelCase			)
             lowercase__				      =			Hasher.hash(UpperCamelCase			)
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)



      @require_tiktoken
      def 				UpperCamelCase__		(self   :   Tuple			):

             '''simple docstring'''







             import tiktoken

             lowercase__				      =			tiktoken.get_encoding('''gpt2'''			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             lowercase__				      =			tiktoken.get_encoding('''r50k_base'''			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             lowercase__				      =			tiktoken.get_encoding('''gpt2'''			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertNotEqual(UpperCamelCase       ,						UpperCamelCase			)



      @require_torch
      def 				UpperCamelCase__		(self   :   Union[str, Any]			):

             '''simple docstring'''







             import torch

             lowercase__				      =			torch.tensor([1.0]			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             lowercase__				      =			torch.tensor([2.0]			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             lowercase__				      =			torch.tensor([1.0]			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertNotEqual(UpperCamelCase       ,						UpperCamelCase			)






      @require_spacy
      @require_spacy_model('''en_core_web_sm'''			)
      @require_spacy_model('''fr_core_news_sm'''			)
      @pytest.mark.integration
      def 				UpperCamelCase__		(self   :   Union[str, Any]			):

             '''simple docstring'''







             import spacy

             lowercase__				      =			spacy.load('''en_core_web_sm'''			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             lowercase__				      =			spacy.load('''fr_core_news_sm'''			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             lowercase__				      =			spacy.load('''en_core_web_sm'''			)
             lowercase__				      =			mda(datasets.utils.py_utils.dumps(UpperCamelCase			)			).hexdigest()
             self.assertEqual(UpperCamelCase       ,						UpperCamelCase			)
             self.assertNotEqual(UpperCamelCase       ,						UpperCamelCase			)






@pytest.mark.integration
def _SCREAMING_SNAKE_CASE				(A	)	->	Any:






       """simple docstring"""







       lowercase__				      =			tmp_path / '''dir1'''
       lowercase__				      =			tmp_path / '''dir2'''
       dira.mkdir()
       dira.mkdir()
       lowercase__				      =			'''script.py'''
       lowercase__				      =			dedent(
           '''
    from datasets.fingerprint import Hasher
    def foo():
        pass
    print(Hasher.hash(foo))
    '''	)
       lowercase__				      =			dira / script_filename
       lowercase__				      =			dira / script_filename
       with script_patha.open('''w'''	) as f:
              f.write(A	)
       with script_patha.open('''w'''	) as f:
              f.write(A	)
       lowercase__				      =			subprocess.check_output(['''python''', str(A	)]	)
       lowercase__				      =			subprocess.check_output(['''python''', str(A	)]	)
       assert fingerprinta == fingerprinta

def _SCREAMING_SNAKE_CASE				()	->	List[Any]:






       """simple docstring"""







       lowercase__				      =			{'''a''': [0, 1, 2]}
       lowercase__				      =			DatasetChild(InMemoryTable.from_pydict(A	)	)
       lowercase__				      =			dataset.funca()._fingerprint
       assert expected_fingerprint == dataset.funca()._fingerprint
       assert expected_fingerprint != dataset.funca()._fingerprint

       with Pool(2	) as p:
              assert expected_fingerprint == p.apply_async(dataset.funca	).get()._fingerprint
              assert expected_fingerprint != p.apply_async(dataset.funca	).get()._fingerprint

def _SCREAMING_SNAKE_CASE				()	->	List[str]:






       """simple docstring"""







       lowercase__				      =			{'''a''': [0, 1, 2]}
       class   __lowerCAmelCase						(datasets.Dataset					):





             '''simple docstring'''






             @fingerprint_transform(inplace=UpperCamelCase			)
             def 				UpperCamelCase__		(self   :   Tuple       ,						UpperCamelCase   :   Tuple			):

                    '''simple docstring'''







                    return DummyDatasetChild(self.data       ,						fingerprint=UpperCamelCase			)






       lowercase__				      =			DummyDatasetChild(InMemoryTable.from_pydict(A	)	).func()
       class   __lowerCAmelCase						(datasets.Dataset					):





             '''simple docstring'''






             @fingerprint_transform(inplace=UpperCamelCase       ,						version='''1.0.0'''			)
             def 				UpperCamelCase__		(self   :   Optional[int]       ,						UpperCamelCase   :   List[Any]			):

                    '''simple docstring'''







                    return DummyDatasetChild(self.data       ,						fingerprint=UpperCamelCase			)






       lowercase__				      =			DummyDatasetChild(InMemoryTable.from_pydict(A	)	).func()
       class   __lowerCAmelCase						(datasets.Dataset					):





             '''simple docstring'''






             @fingerprint_transform(inplace=UpperCamelCase       ,						version='''2.0.0'''			)
             def 				UpperCamelCase__		(self   :   Any       ,						UpperCamelCase   :   Dict			):

                    '''simple docstring'''







                    return DummyDatasetChild(self.data       ,						fingerprint=UpperCamelCase			)






       lowercase__				      =			DummyDatasetChild(InMemoryTable.from_pydict(A	)	).func()

       assert len({fingeprint_no_version, fingeprint_a, fingeprint_a}	) == 3

def _SCREAMING_SNAKE_CASE				()	->	Any:






       """simple docstring"""







       lowercase__				      =			Hasher()
       hasher.update(lambda A	: x	)








'''simple docstring'''

from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available


lowerCamelCase							:       Tuple  						=     {'configuration_bert_generation': ['BertGenerationConfig']}

try:
 if not is_sentencepiece_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase							:       Union[str, Any]  						=     ['BertGenerationTokenizer']

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 lowerCamelCase							:       Dict  						=     [
     'BertGenerationDecoder',
     'BertGenerationEncoder',
     'BertGenerationPreTrainedModel',
     'load_tf_weights_in_bert_generation',
 ]


if TYPE_CHECKING:
 from .configuration_bert_generation import BertGenerationConfig

 try:
  if not is_sentencepiece_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .tokenization_bert_generation import BertGenerationTokenizer

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_bert_generation import (
      BertGenerationDecoder,
      BertGenerationEncoder,
      BertGenerationPreTrainedModel,
      load_tf_weights_in_bert_generation,
  )

else:
 import sys

 lowerCamelCase							:       int  						=     _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)




