




"""simple docstring"""





import itertools
from dataclasses import dataclass
from typing import Optional

import pandas as pd
import pyarrow as pa

import datasets
from datasets.table import table_cast



@dataclass
class      a__				(	datasets.BuilderConfig   ):
			lowercase_    =	None






class      a__				(	datasets.ArrowBasedBuilder   ):
			lowercase_    =	PandasConfig


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


						"""simple docstring"""




						return datasets.DatasetInfo(features=self.config.features)


			def       a_     (      self      :    int      ,  UpperCamelCase_      :    str):


						"""simple docstring"""




						if not self.config.data_files:
									raise ValueError(F"At least one data file must be specified, but got data_files={self.config.data_files}")
						__UpperCAmelCase	: int		=					dl_manager.download_and_extract(self.config.data_files)
						if isinstance(UpperCamelCase_      ,  (str, list, tuple)):
									__UpperCAmelCase	: str		=					data_files
									if isinstance(UpperCamelCase_      ,  UpperCamelCase_):
												__UpperCAmelCase	: Dict		=					[files]
									# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
									__UpperCAmelCase	: int		=					[dl_manager.iter_files(UpperCamelCase_) for file in files]
									return [datasets.SplitGenerator(name=datasets.Split.TRAIN      ,  gen_kwargs={"files": files})]
						__UpperCAmelCase	: Tuple		=					[]
						for split_name, files in data_files.items():
									if isinstance(UpperCamelCase_      ,  UpperCamelCase_):
												__UpperCAmelCase	: List[str]		=					[files]
									# Use `dl_manager.iter_files` to skip hidden files in an extracted archive
									__UpperCAmelCase	: Union[str, Any]		=					[dl_manager.iter_files(UpperCamelCase_) for file in files]
									splits.append(datasets.SplitGenerator(name=UpperCamelCase_      ,  gen_kwargs={"files": files}))
						return splits


			def       a_     (      self      :    Any      ,  UpperCamelCase_      :    pa.Table):


						"""simple docstring"""




						if self.config.features is not None:
									# more expensive cast to support nested features with keys in a different order
									# allows str <-> int/float or str to Audio for example
									__UpperCAmelCase	: Dict		=					table_cast(UpperCamelCase_      ,  self.config.features.arrow_schema)
						return pa_table


			def       a_     (      self      :    List[str]      ,  UpperCamelCase_      :    Any):


						"""simple docstring"""




						for i, file in enumerate(itertools.chain.from_iterable(UpperCamelCase_)):
									with open(UpperCamelCase_      ,  "rb") as f:
												__UpperCAmelCase	: Optional[int]		=					pa.Table.from_pandas(pd.read_pickle(UpperCamelCase_))
												yield i, self._cast_table(UpperCamelCase_)








"""simple docstring"""





from ...configuration_utils import PretrainedConfig
from ...utils import logging


A   =       logging.get_logger(__name__)

A   =       {
    """bigcode/gpt_bigcode-santacoder""": """https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json""",
}



class      a__				(	__magic_name__   ):
			lowercase_    =	"gpt_bigcode"
			lowercase_    =	["past_key_values"]
			lowercase_    =	{
			    "hidden_size": "n_embd",
			    "max_position_embeddings": "n_positions",
			    "num_attention_heads": "n_head",
			    "num_hidden_layers": "n_layer",
			}


			def __init__(      self      :    Any      ,  UpperCamelCase_      :    Tuple=50257      ,  UpperCamelCase_      :    Dict=1024      ,  UpperCamelCase_      :    Optional[Any]=768      ,  UpperCamelCase_      :    Optional[Any]=12      ,  UpperCamelCase_      :    Any=12      ,  UpperCamelCase_      :    Optional[int]=None      ,  UpperCamelCase_      :    List[Any]="gelu_pytorch_tanh"      ,  UpperCamelCase_      :    Optional[Any]=0.1      ,  UpperCamelCase_      :    Union[str, Any]=0.1      ,  UpperCamelCase_      :    Tuple=0.1      ,  UpperCamelCase_      :    Tuple=1e-5      ,  UpperCamelCase_      :    List[str]=0.02      ,  UpperCamelCase_      :    Dict=True      ,  UpperCamelCase_      :    Optional[int]=True      ,  UpperCamelCase_      :    str=50256      ,  UpperCamelCase_      :    Union[str, Any]=50256      ,  UpperCamelCase_      :    Dict=True      ,  UpperCamelCase_      :    List[str]=True      ,  UpperCamelCase_      :    Union[str, Any]=True      ,  **UpperCamelCase_      :    Union[str, Any]      ,  ):


						"""simple docstring"""




						__UpperCAmelCase	: Tuple		=					vocab_size
						__UpperCAmelCase	: Optional[int]		=					n_positions
						__UpperCAmelCase	: Tuple		=					n_embd
						__UpperCAmelCase	: str		=					n_layer
						__UpperCAmelCase	: Dict		=					n_head
						__UpperCAmelCase	: Optional[Any]		=					n_inner
						__UpperCAmelCase	: Optional[Any]		=					activation_function
						__UpperCAmelCase	: List[str]		=					resid_pdrop
						__UpperCAmelCase	: List[Any]		=					embd_pdrop
						__UpperCAmelCase	: Optional[Any]		=					attn_pdrop
						__UpperCAmelCase	: Dict		=					layer_norm_epsilon
						__UpperCAmelCase	: List[str]		=					initializer_range
						__UpperCAmelCase	: int		=					scale_attn_weights
						__UpperCAmelCase	: Tuple		=					use_cache
						__UpperCAmelCase	: List[Any]		=					attention_softmax_in_fpaa
						__UpperCAmelCase	: Any		=					scale_attention_softmax_in_fpaa
						__UpperCAmelCase	: str		=					multi_query

						__UpperCAmelCase	: int		=					bos_token_id
						__UpperCAmelCase	: str		=					eos_token_id

						super().__init__(bos_token_id=UpperCamelCase_      ,  eos_token_id=UpperCamelCase_      ,  **UpperCamelCase_)


