


import functools
import math

import flax.linen as nn
import jax
import jax.numpy as jnp
def 							_UpperCAmelCase       (UpperCamelCase__  :						Tuple       ,							UpperCamelCase__  :						Dict       ,							UpperCamelCase__  :						Optional[Any]       ,							UpperCamelCase__  :						List[str]       ,							UpperCamelCase__  :						int = 4096		):
       _A					,    _A					,    _A   : List[str]       					=				key.shape[-3:]
       _A   : Union[str, Any]       					=				value.shape[-1]
       _A   : Dict       					=				min(UpperCamelCase__       ,							UpperCamelCase__		)
       _A   : List[Any]       					=				query / jnp.sqrt(UpperCamelCase__		)

       @functools.partial(jax.checkpoint       ,							prevent_cse=UpperCamelCase__		)
       def summarize_chunk(UpperCamelCase__  :						List[str]       ,							UpperCamelCase__  :						Union[str, Any]       ,							UpperCamelCase__  :						List[str]		):
              _A   : Optional[Any]       					=				jnp.einsum("...qhd,...khd->...qhk"       ,							UpperCamelCase__       ,							UpperCamelCase__       ,							precision=UpperCamelCase__		)

              _A   : Tuple       					=				jnp.max(UpperCamelCase__       ,							axis=-1       ,							keepdims=UpperCamelCase__		)
              _A   : Union[str, Any]       					=				jax.lax.stop_gradient(UpperCamelCase__		)
              _A   : str       					=				jnp.exp(attn_weights - max_score		)

              _A   : Union[str, Any]       					=				jnp.einsum("...vhf,...qhv->...qhf"       ,							UpperCamelCase__       ,							UpperCamelCase__       ,							precision=UpperCamelCase__		)
              _A   : Tuple       					=				jnp.einsum("...qhk->...qh"       ,							UpperCamelCase__		)

              return (exp_values, exp_weights.sum(axis=-1		), max_score)

       def chunk_scanner(UpperCamelCase__  :						Optional[int]		):
              # julienne key array
              _A   : Any       					=				jax.lax.dynamic_slice(
                  operand=UpperCamelCase__       ,							start_indices=[0] * (key.ndim - 3) + [chunk_idx, 0, 0]       ,							slice_sizes=list(key.shape[:-3]		) + [key_chunk_size, num_heads, k_features]       ,							)

              # julienne value array
              _A   : Optional[Any]       					=				jax.lax.dynamic_slice(
                  operand=UpperCamelCase__       ,							start_indices=[0] * (value.ndim - 3) + [chunk_idx, 0, 0]       ,							slice_sizes=list(value.shape[:-3]		) + [key_chunk_size, num_heads, v_features]       ,							)

              return summarize_chunk(UpperCamelCase__       ,							UpperCamelCase__       ,							UpperCamelCase__		)

       _A					,    _A					,    _A   : int       					=				jax.lax.map(f=UpperCamelCase__       ,							xs=jnp.arange(0       ,							UpperCamelCase__       ,							UpperCamelCase__		)		)

       _A   : str       					=				jnp.max(UpperCamelCase__       ,							axis=0       ,							keepdims=UpperCamelCase__		)
       _A   : Optional[Any]       					=				jnp.exp(chunk_max - global_max		)

       chunk_values *= jnp.expand_dims(UpperCamelCase__       ,							axis=-1		)
       chunk_weights *= max_diffs

       _A   : Optional[Any]       					=				chunk_values.sum(axis=0		)
       _A   : Optional[int]       					=				jnp.expand_dims(UpperCamelCase__       ,							-1		).sum(axis=0		)

       return all_values / all_weights
def 							_UpperCAmelCase       (UpperCamelCase__  :						Dict       ,							UpperCamelCase__  :						Union[str, Any]       ,							UpperCamelCase__  :						Any       ,							UpperCamelCase__  :						Any=jax.lax.Precision.HIGHEST       ,							UpperCamelCase__  :						int = 1024       ,							UpperCamelCase__  :						int = 4096		):
       _A					,    _A					,    _A   : List[str]       					=				query.shape[-3:]

       def chunk_scanner(UpperCamelCase__  :						Union[str, Any]       ,							UpperCamelCase__  :						Optional[Any]		):
              # julienne query array
              _A   : Tuple       					=				jax.lax.dynamic_slice(
                  operand=UpperCamelCase__       ,							start_indices=([0] * (query.ndim - 3)) + [chunk_idx, 0, 0]       ,							slice_sizes=list(query.shape[:-3]		) + [min(UpperCamelCase__       ,							UpperCamelCase__		), num_heads, q_features]       ,							)

              return (
                  chunk_idx + query_chunk_size,  # unused ignore it
                  _query_chunk_attention(
                      query=UpperCamelCase__       ,							key=UpperCamelCase__       ,							value=UpperCamelCase__       ,							precision=UpperCamelCase__       ,							key_chunk_size=UpperCamelCase__		),
              )

       _A					,    _A   : int       					=				jax.lax.scan(
           f=UpperCamelCase__       ,							init=0       ,							xs=UpperCamelCase__       ,							length=math.ceil(num_q / query_chunk_size		)		)

       return jnp.concatenate(UpperCamelCase__       ,							axis=-3		)  # fuse the chunked result back







class   lowerCAmelCase__ (       nn.Module):




     '''simple docstring'''
     __SCREAMING_SNAKE_CASE						    =				42
     __SCREAMING_SNAKE_CASE						    =				8
     __SCREAMING_SNAKE_CASE						    =				64
     __SCREAMING_SNAKE_CASE						    =				0.0
     __SCREAMING_SNAKE_CASE						    =				False
     __SCREAMING_SNAKE_CASE						    =				jnp.floataa


     def 				_lowerCamelCase				(		self)    ->       Dict:
            _A   : List[Any]       					=				self.dim_head * self.heads
            _A   : Optional[Any]       					=				self.dim_head**-0.5

            # Weights were exported with old names {to_q, to_k, to_v, to_out}
            _A   : str       					=				nn.Dense(__lowerCamelCase				,		use_bias=__lowerCamelCase				,		dtype=self.dtype				,		name="to_q")
            _A   : Any       					=				nn.Dense(__lowerCamelCase				,		use_bias=__lowerCamelCase				,		dtype=self.dtype				,		name="to_k")
            _A   : int       					=				nn.Dense(__lowerCamelCase				,		use_bias=__lowerCamelCase				,		dtype=self.dtype				,		name="to_v")

            _A   : Any       					=				nn.Dense(self.query_dim				,		dtype=self.dtype				,		name="to_out_0")
            _A   : int       					=				nn.Dropout(rate=self.dropout)


     def 				_lowerCamelCase				(		self				,		__lowerCamelCase)    ->       Optional[int]:
            _A					,    _A					,    _A   : List[Any]       					=				tensor.shape
            _A   : Any       					=				self.heads
            _A   : Tuple       					=				tensor.reshape(__lowerCamelCase				,		__lowerCamelCase				,		__lowerCamelCase				,		dim // head_size)
            _A   : int       					=				jnp.transpose(__lowerCamelCase				,		(0, 2, 1, 3))
            _A   : Optional[Any]       					=				tensor.reshape(batch_size * head_size				,		__lowerCamelCase				,		dim // head_size)
            return tensor


     def 				_lowerCamelCase				(		self				,		__lowerCamelCase)    ->       Union[str, Any]:
            _A					,    _A					,    _A   : Union[str, Any]       					=				tensor.shape
            _A   : str       					=				self.heads
            _A   : Union[str, Any]       					=				tensor.reshape(batch_size // head_size				,		__lowerCamelCase				,		__lowerCamelCase				,		__lowerCamelCase)
            _A   : int       					=				jnp.transpose(__lowerCamelCase				,		(0, 2, 1, 3))
            _A   : Optional[Any]       					=				tensor.reshape(batch_size // head_size				,		__lowerCamelCase				,		dim * head_size)
            return tensor


     def __call__(		self				,		__lowerCamelCase				,		__lowerCamelCase=None				,		__lowerCamelCase=True)    ->       Any:
            _A   : Any       					=				hidden_states if context is None else context

            _A   : Optional[Any]       					=				self.query(__lowerCamelCase)
            _A   : Optional[int]       					=				self.key(__lowerCamelCase)
            _A   : Optional[Any]       					=				self.value(__lowerCamelCase)

            _A   : List[Any]       					=				self.reshape_heads_to_batch_dim(__lowerCamelCase)
            _A   : Dict       					=				self.reshape_heads_to_batch_dim(__lowerCamelCase)
            _A   : List[Any]       					=				self.reshape_heads_to_batch_dim(__lowerCamelCase)

            if self.use_memory_efficient_attention:
                   _A   : Any       					=				query_states.transpose(1				,		0				,		2)
                   _A   : Optional[Any]       					=				key_states.transpose(1				,		0				,		2)
                   _A   : str       					=				value_states.transpose(1				,		0				,		2)

                   # this if statement create a chunk size for each layer of the unet
                   # the chunk size is equal to the query_length dimension of the deepest layer of the unet

                   _A   : Optional[int]       					=				query_states.shape[-3]
                   if flatten_latent_dim % 6_4 == 0:
                          _A   : List[Any]       					=				int(flatten_latent_dim / 6_4)
                   elif flatten_latent_dim % 1_6 == 0:
                          _A   : str       					=				int(flatten_latent_dim / 1_6)
                   elif flatten_latent_dim % 4 == 0:
                          _A   : List[str]       					=				int(flatten_latent_dim / 4)
                   else:
                          _A   : Union[str, Any]       					=				int(__lowerCamelCase)

                   _A   : List[Any]       					=				jax_memory_efficient_attention(
                       __lowerCamelCase				,		__lowerCamelCase				,		__lowerCamelCase				,		query_chunk_size=__lowerCamelCase				,		key_chunk_size=4_0_9_6 * 4)

                   _A   : Optional[Any]       					=				hidden_states.transpose(1				,		0				,		2)
            else:
                   # compute attentions
                   _A   : int       					=				jnp.einsum("b i d, b j d->b i j"				,		__lowerCamelCase				,		__lowerCamelCase)
                   _A   : List[Any]       					=				attention_scores * self.scale
                   _A   : Dict       					=				nn.softmax(__lowerCamelCase				,		axis=2)

                   # attend to values
                   _A   : Any       					=				jnp.einsum("b i j, b j d -> b i d"				,		__lowerCamelCase				,		__lowerCamelCase)

            _A   : Optional[int]       					=				self.reshape_batch_dim_to_heads(__lowerCamelCase)
            _A   : int       					=				self.proj_attn(__lowerCamelCase)
            return self.dropout_layer(__lowerCamelCase				,		deterministic=__lowerCamelCase)







class   lowerCAmelCase__ (       nn.Module):




     '''simple docstring'''
     __SCREAMING_SNAKE_CASE						    =				42
     __SCREAMING_SNAKE_CASE						    =				42
     __SCREAMING_SNAKE_CASE						    =				42
     __SCREAMING_SNAKE_CASE						    =				0.0
     __SCREAMING_SNAKE_CASE						    =				False
     __SCREAMING_SNAKE_CASE						    =				jnp.floataa
     __SCREAMING_SNAKE_CASE						    =				False


     def 				_lowerCamelCase				(		self)    ->       Union[str, Any]:
            # self attention (or cross_attention if only_cross_attention is True)
            _A   : Any       					=				FlaxAttention(
                self.dim				,		self.n_heads				,		self.d_head				,		self.dropout				,		self.use_memory_efficient_attention				,		dtype=self.dtype)
            # cross attention
            _A   : str       					=				FlaxAttention(
                self.dim				,		self.n_heads				,		self.d_head				,		self.dropout				,		self.use_memory_efficient_attention				,		dtype=self.dtype)
            _A   : Dict       					=				FlaxFeedForward(dim=self.dim				,		dropout=self.dropout				,		dtype=self.dtype)
            _A   : Any       					=				nn.LayerNorm(epsilon=1e-5				,		dtype=self.dtype)
            _A   : List[Any]       					=				nn.LayerNorm(epsilon=1e-5				,		dtype=self.dtype)
            _A   : Any       					=				nn.LayerNorm(epsilon=1e-5				,		dtype=self.dtype)
            _A   : List[str]       					=				nn.Dropout(rate=self.dropout)


     def __call__(		self				,		__lowerCamelCase				,		__lowerCamelCase				,		__lowerCamelCase=True)    ->       Optional[int]:
            # self attention
            _A   : Optional[int]       					=				hidden_states
            if self.only_cross_attention:
                   _A   : Optional[int]       					=				self.attna(self.norma(__lowerCamelCase)				,		__lowerCamelCase				,		deterministic=__lowerCamelCase)
            else:
                   _A   : Dict       					=				self.attna(self.norma(__lowerCamelCase)				,		deterministic=__lowerCamelCase)
            _A   : Any       					=				hidden_states + residual

            # cross attention
            _A   : List[str]       					=				hidden_states
            _A   : Dict       					=				self.attna(self.norma(__lowerCamelCase)				,		__lowerCamelCase				,		deterministic=__lowerCamelCase)
            _A   : Union[str, Any]       					=				hidden_states + residual

            # feed forward
            _A   : Optional[int]       					=				hidden_states
            _A   : List[str]       					=				self.ff(self.norma(__lowerCamelCase)				,		deterministic=__lowerCamelCase)
            _A   : Optional[int]       					=				hidden_states + residual

            return self.dropout_layer(__lowerCamelCase				,		deterministic=__lowerCamelCase)







class   lowerCAmelCase__ (       nn.Module):




     '''simple docstring'''
     __SCREAMING_SNAKE_CASE						    =				42
     __SCREAMING_SNAKE_CASE						    =				42
     __SCREAMING_SNAKE_CASE						    =				42
     __SCREAMING_SNAKE_CASE						    =				1
     __SCREAMING_SNAKE_CASE						    =				0.0
     __SCREAMING_SNAKE_CASE						    =				False
     __SCREAMING_SNAKE_CASE						    =				False
     __SCREAMING_SNAKE_CASE						    =				jnp.floataa
     __SCREAMING_SNAKE_CASE						    =				False


     def 				_lowerCamelCase				(		self)    ->       Tuple:
            _A   : Optional[Any]       					=				nn.GroupNorm(num_groups=3_2				,		epsilon=1e-5)

            _A   : List[str]       					=				self.n_heads * self.d_head
            if self.use_linear_projection:
                   _A   : List[str]       					=				nn.Dense(__lowerCamelCase				,		dtype=self.dtype)
            else:
                   _A   : str       					=				nn.Conv(
                       __lowerCamelCase				,		kernel_size=(1, 1)				,		strides=(1, 1)				,		padding="VALID"				,		dtype=self.dtype				,		)

            _A   : Optional[int]       					=				[
                FlaxBasicTransformerBlock(
                    __lowerCamelCase				,		self.n_heads				,		self.d_head				,		dropout=self.dropout				,		only_cross_attention=self.only_cross_attention				,		dtype=self.dtype				,		use_memory_efficient_attention=self.use_memory_efficient_attention				,		)
                for _ in range(self.depth)
            ]

            if self.use_linear_projection:
                   _A   : int       					=				nn.Dense(__lowerCamelCase				,		dtype=self.dtype)
            else:
                   _A   : Any       					=				nn.Conv(
                       __lowerCamelCase				,		kernel_size=(1, 1)				,		strides=(1, 1)				,		padding="VALID"				,		dtype=self.dtype				,		)

            _A   : Optional[int]       					=				nn.Dropout(rate=self.dropout)


     def __call__(		self				,		__lowerCamelCase				,		__lowerCamelCase				,		__lowerCamelCase=True)    ->       Tuple:
            _A					,    _A					,    _A					,    _A   : Optional[int]       					=				hidden_states.shape
            _A   : Dict       					=				hidden_states
            _A   : Optional[int]       					=				self.norm(__lowerCamelCase)
            if self.use_linear_projection:
                   _A   : Any       					=				hidden_states.reshape(__lowerCamelCase				,		height * width				,		__lowerCamelCase)
                   _A   : List[Any]       					=				self.proj_in(__lowerCamelCase)
            else:
                   _A   : Optional[int]       					=				self.proj_in(__lowerCamelCase)
                   _A   : Optional[int]       					=				hidden_states.reshape(__lowerCamelCase				,		height * width				,		__lowerCamelCase)

            for transformer_block in self.transformer_blocks:
                   _A   : Dict       					=				transformer_block(__lowerCamelCase				,		__lowerCamelCase				,		deterministic=__lowerCamelCase)

            if self.use_linear_projection:
                   _A   : int       					=				self.proj_out(__lowerCamelCase)
                   _A   : int       					=				hidden_states.reshape(__lowerCamelCase				,		__lowerCamelCase				,		__lowerCamelCase				,		__lowerCamelCase)
            else:
                   _A   : List[Any]       					=				hidden_states.reshape(__lowerCamelCase				,		__lowerCamelCase				,		__lowerCamelCase				,		__lowerCamelCase)
                   _A   : Union[str, Any]       					=				self.proj_out(__lowerCamelCase)

            _A   : Tuple       					=				hidden_states + residual
            return self.dropout_layer(__lowerCamelCase				,		deterministic=__lowerCamelCase)







class   lowerCAmelCase__ (       nn.Module):




     '''simple docstring'''
     __SCREAMING_SNAKE_CASE						    =				42
     __SCREAMING_SNAKE_CASE						    =				0.0
     __SCREAMING_SNAKE_CASE						    =				jnp.floataa


     def 				_lowerCamelCase				(		self)    ->       Tuple:
            # The second linear layer needs to be called
            # net_2 for now to match the index of the Sequential layer
            _A   : Optional[int]       					=				FlaxGEGLU(self.dim				,		self.dropout				,		self.dtype)
            _A   : Dict       					=				nn.Dense(self.dim				,		dtype=self.dtype)


     def __call__(		self				,		__lowerCamelCase				,		__lowerCamelCase=True)    ->       int:
            _A   : Optional[int]       					=				self.net_a(__lowerCamelCase				,		deterministic=__lowerCamelCase)
            _A   : Any       					=				self.net_a(__lowerCamelCase)
            return hidden_states







class   lowerCAmelCase__ (       nn.Module):




     '''simple docstring'''
     __SCREAMING_SNAKE_CASE						    =				42
     __SCREAMING_SNAKE_CASE						    =				0.0
     __SCREAMING_SNAKE_CASE						    =				jnp.floataa


     def 				_lowerCamelCase				(		self)    ->       str:
            _A   : Union[str, Any]       					=				self.dim * 4
            _A   : int       					=				nn.Dense(inner_dim * 2				,		dtype=self.dtype)
            _A   : Union[str, Any]       					=				nn.Dropout(rate=self.dropout)


     def __call__(		self				,		__lowerCamelCase				,		__lowerCamelCase=True)    ->       Any:
            _A   : Optional[Any]       					=				self.proj(__lowerCamelCase)
            _A					,    _A   : str       					=				jnp.split(__lowerCamelCase				,		2				,		axis=2)
            return self.dropout_layer(hidden_linear * nn.gelu(__lowerCamelCase)				,		deterministic=__lowerCamelCase)




import importlib
import inspect
from functools import wraps
from typing import TYPE_CHECKING, Optional, Union

from .download.streaming_download_manager import (
    xbasename,
    xdirname,
    xet_parse,
    xexists,
    xgetsize,
    xglob,
    xgzip_open,
    xisdir,
    xisfile,
    xjoin,
    xlistdir,
    xnumpy_load,
    xopen,
    xpandas_read_csv,
    xpandas_read_excel,
    xPath,
    xrelpath,
    xsio_loadmat,
    xsplit,
    xsplitext,
    xwalk,
    xxml_dom_minidom_parse,
)
from .utils.logging import get_logger
from .utils.patching import patch_submodule
from .utils.py_utils import get_imports


lowerCAmelCase__   	=				get_logger(__name__)


if TYPE_CHECKING:
    from .builder import DatasetBuilder
def 							_UpperCAmelCase       (UpperCamelCase__  :						Optional[Any]       ,							UpperCamelCase__  :						Optional[Union[str, bool]] = None		):
       _A   : Dict       					=				importlib.import_module(UpperCamelCase__		)

       # TODO(QL): always update the module to add subsequent new authentication
       if hasattr(UpperCamelCase__       ,							"_patched_for_streaming"		) and module._patched_for_streaming:
              return

       def wrap_auth(UpperCamelCase__  :						Optional[int]		):
              @wraps(UpperCamelCase__		)
              def wrapper(*UpperCamelCase__  :						str       ,							**UpperCamelCase__  :						Optional[int]		):
                     return function(*UpperCamelCase__       ,							use_auth_token=UpperCamelCase__       ,							**UpperCamelCase__		)

              _A   : List[Any]       					=				"wrap_auth"
              return wrapper

       # open files in a streaming fashion
       patch_submodule(UpperCamelCase__       ,							"open"       ,							wrap_auth(UpperCamelCase__		)		).start()
       patch_submodule(UpperCamelCase__       ,							"os.listdir"       ,							wrap_auth(UpperCamelCase__		)		).start()
       patch_submodule(UpperCamelCase__       ,							"os.walk"       ,							wrap_auth(UpperCamelCase__		)		).start()
       patch_submodule(UpperCamelCase__       ,							"glob.glob"       ,							wrap_auth(UpperCamelCase__		)		).start()
       # allow to navigate in remote zip files
       patch_submodule(UpperCamelCase__       ,							"os.path.join"       ,							UpperCamelCase__		).start()
       patch_submodule(UpperCamelCase__       ,							"os.path.dirname"       ,							UpperCamelCase__		).start()
       patch_submodule(UpperCamelCase__       ,							"os.path.basename"       ,							UpperCamelCase__		).start()
       patch_submodule(UpperCamelCase__       ,							"os.path.relpath"       ,							UpperCamelCase__		).start()
       patch_submodule(UpperCamelCase__       ,							"os.path.split"       ,							UpperCamelCase__		).start()
       patch_submodule(UpperCamelCase__       ,							"os.path.splitext"       ,							UpperCamelCase__		).start()
       # allow checks on paths
       patch_submodule(UpperCamelCase__       ,							"os.path.exists"       ,							wrap_auth(UpperCamelCase__		)		).start()
       patch_submodule(UpperCamelCase__       ,							"os.path.isdir"       ,							wrap_auth(UpperCamelCase__		)		).start()
       patch_submodule(UpperCamelCase__       ,							"os.path.isfile"       ,							wrap_auth(UpperCamelCase__		)		).start()
       patch_submodule(UpperCamelCase__       ,							"os.path.getsize"       ,							wrap_auth(UpperCamelCase__		)		).start()
       patch_submodule(UpperCamelCase__       ,							"pathlib.Path"       ,							UpperCamelCase__		).start()
       # file readers
       patch_submodule(UpperCamelCase__       ,							"gzip.open"       ,							wrap_auth(UpperCamelCase__		)		).start()
       patch_submodule(UpperCamelCase__       ,							"numpy.load"       ,							wrap_auth(UpperCamelCase__		)		).start()
       patch_submodule(UpperCamelCase__       ,							"pandas.read_csv"       ,							wrap_auth(UpperCamelCase__		)       ,							attrs=["__version__"]		).start()
       patch_submodule(UpperCamelCase__       ,							"pandas.read_excel"       ,							wrap_auth(UpperCamelCase__		)       ,							attrs=["__version__"]		).start()
       patch_submodule(UpperCamelCase__       ,							"scipy.io.loadmat"       ,							wrap_auth(UpperCamelCase__		)       ,							attrs=["__version__"]		).start()
       patch_submodule(UpperCamelCase__       ,							"xml.etree.ElementTree.parse"       ,							wrap_auth(UpperCamelCase__		)		).start()
       patch_submodule(UpperCamelCase__       ,							"xml.dom.minidom.parse"       ,							wrap_auth(UpperCamelCase__		)		).start()
       _A   : Any       					=				True






def 							_UpperCAmelCase       (UpperCamelCase__  :						"DatasetBuilder"		):
       extend_module_for_streaming(builder.__module__       ,							use_auth_token=builder.use_auth_token		)
       # if needed, we also have to extend additional internal imports (like wmt14 -> wmt_utils)
       if not builder.__module__.startswith("datasets."		):  # check that it's not a packaged builder like csv
              for imports in get_imports(inspect.getfile(builder.__class__		)		):
                     if imports[0] == "internal":
                            _A   : Optional[Any]       					=				imports[1]
                            _A   : int       					=				".".join(builder.__module__.split("."		)[:-1] + [internal_import_name]		)
                            extend_module_for_streaming(UpperCamelCase__       ,							use_auth_token=builder.use_auth_token		)

    # builders can inherit from other builders that might use streaming functionality
    # (for example, ImageFolder and AudioFolder inherit from FolderBuilder which implements examples generation)
    # but these parents builders are not patched automatically as they are not instantiated, so we patch them here
       from .builder import DatasetBuilder

       _A   : Tuple       					=				[
           cls.__module__
           for cls in type(UpperCamelCase__		).__mro__[1:]  # make sure it's not the same module we've already patched
           if issubclass(cls       ,							UpperCamelCase__		) and cls.__module__ != DatasetBuilder.__module__
       ]  # check it's not a standard builder from datasets.builder
       for module in parent_builder_modules:
              extend_module_for_streaming(UpperCamelCase__       ,							use_auth_token=builder.use_auth_token		)
