
"""simple docstring"""






import csv
import json
import os

import datasets


# TODO: Add BibTeX citation
# Find for instance the citation on arxiv or on the dataset repo/website
_lowercase							 =							'''\
@InProceedings{huggingface:dataset,
title = {A great new dataset},
author={huggingface, Inc.
},
year={2020}
}
'''

# TODO: Add description of the dataset here
# You can copy an official description
_lowercase							 =							'''\
This new dataset is designed to solve this great NLP task and is crafted with a lot of care.
'''

# TODO: Add a link to an official homepage for the dataset here
_lowercase							 =							''''''

# TODO: Add the licence for the dataset here if you can find it
_lowercase							 =							''''''

# TODO: Add link to the official dataset URLs here
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
_lowercase							 =							{
    '''first_domain''': '''https://huggingface.co/great-new-dataset-first_domain.zip''',
    '''second_domain''': '''https://huggingface.co/great-new-dataset-second_domain.zip''',
}

class 				__a    (   datasets.GeneratorBasedBuilder					):



							'''simple docstring'''







							_lowerCamelCase				: int					      =      datasets.Version("""1.1.0"""					)

							# This is an example of a dataset with multiple configurations.
							# If you don't want/need to define several sub-sets in your dataset,
							# just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.

							# If you need to make complex sub-parts in the datasets with configurable options
							# You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
							# BUILDER_CONFIG_CLASS = MyBuilderConfig

							# You will be able to load one or the other configurations in the following list with
							# data = datasets.load_dataset('my_dataset', 'first_domain')
							# data = datasets.load_dataset('my_dataset', 'second_domain')
							_lowerCamelCase				: Union[str, Any]					      =      [
							    datasets.BuilderConfig(name="""first_domain"""				,      version=__a				,      description="""This part of my dataset covers a first domain"""					),
							    datasets.BuilderConfig(name="""second_domain"""				,      version=__a				,      description="""This part of my dataset covers a second domain"""					),
							]

							_lowerCamelCase				: Union[str, Any]					      =      """first_domain"""  # It's not mandatory to have a default configuration. Just use one if it make sense.
							def      SCREAMING_SNAKE_CASE	(    self					) ->       Optional[Any]:




										'''simple docstring'''
										# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
										if self.config.name == "first_domain":  # This is the name of the configuration selected in BUILDER_CONFIGS above
													__lowercase						      =					datasets.Features(
													    {
													        "sentence": datasets.Value("string"					),
													        "option1": datasets.Value("string"					),
													        "answer": datasets.Value("string"					)
													        # These are the features of your dataset like images, labels ...
													    }					)
										else:  # This is an example to show how to have different features for "first_domain" and "second_domain"
													__lowercase						      =					datasets.Features(
													    {
													        "sentence": datasets.Value("string"					),
													        "option2": datasets.Value("string"					),
													        "second_domain_answer": datasets.Value("string"					)
													        # These are the features of your dataset like images, labels ...
													    }					)
										return datasets.DatasetInfo(
										    # This is the description that will appear on the datasets page.
										    description=_DESCRIPTION     ,						features=_lowerCamelCase     ,						homepage=_HOMEPAGE     ,						license=_LICENSE     ,						citation=_CITATION     ,						)
							def      SCREAMING_SNAKE_CASE	(    self     ,						_lowerCamelCase					) ->       Optional[int]:




										'''simple docstring'''
										__lowercase						      =					_URLS[self.config.name]
										__lowercase						      =					dl_manager.download_and_extract(_lowerCamelCase					)
										return [
										    datasets.SplitGenerator(
										        name=datasets.Split.TRAIN     ,						gen_kwargs={
										            "filepath": os.path.join(_lowerCamelCase     ,						"train.jsonl"					),
										            "split": "train",
										        }     ,						),
										    datasets.SplitGenerator(
										        name=datasets.Split.VALIDATION     ,						gen_kwargs={
										            "filepath": os.path.join(_lowerCamelCase     ,						"dev.jsonl"					),
										            "split": "dev",
										        }     ,						),
										    datasets.SplitGenerator(
										        name=datasets.Split.TEST     ,						gen_kwargs={
										            "filepath": os.path.join(_lowerCamelCase     ,						"test.jsonl"					),
										            "split": "test"
										        }     ,						),
										]





							def      SCREAMING_SNAKE_CASE	(    self     ,						_lowerCamelCase     ,						_lowerCamelCase					) ->       Optional[int]:




										'''simple docstring'''
										# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
										# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
										with open(_lowerCamelCase     ,						encoding="utf-8"					) as f:
													for key, row in enumerate(_lowerCamelCase					):
																__lowercase						      =					json.loads(_lowerCamelCase					)
																if self.config.name == "first_domain":
																			# Yields examples as (key, example) tuples
																			yield key, {
																			    "sentence": data["sentence"],
																			    "option1": data["option1"],
																			    "answer": "" if split == "test" else data["answer"],
																			}
																else:
																			yield key, {
																			    "sentence": data["sentence"],
																			    "option2": data["option2"],
																			    "second_domain_answer": "" if split == "test" else data["second_domain_answer"],
																			}







"""simple docstring"""






from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


_lowercase							 =							logging.get_logger(__name__)

_lowercase							 =							{
    '''facebook/convnext-tiny-224''': '''https://huggingface.co/facebook/convnext-tiny-224/resolve/main/config.json''',
    # See all ConvNeXT models at https://huggingface.co/models?filter=convnext
}

class 				__a    (   __a				,      __a					):



							'''simple docstring'''







							_lowerCamelCase				: List[Any]					      =      """convnext"""
							def __init__(    self     ,						_lowerCamelCase=3     ,						_lowerCamelCase=4     ,						_lowerCamelCase=4     ,						_lowerCamelCase=None     ,						_lowerCamelCase=None     ,						_lowerCamelCase="gelu"     ,						_lowerCamelCase=0.02     ,						_lowerCamelCase=1e-12     ,						_lowerCamelCase=1e-6     ,						_lowerCamelCase=0.0     ,						_lowerCamelCase=224     ,						_lowerCamelCase=None     ,						_lowerCamelCase=None     ,						**_lowerCamelCase     ,						) ->       List[str]:




										'''simple docstring'''
										super().__init__(**_lowerCamelCase					)

										__lowercase						      =					num_channels
										__lowercase						      =					patch_size
										__lowercase						      =					num_stages
										__lowercase						      =					[96, 192, 384, 768] if hidden_sizes is None else hidden_sizes
										__lowercase						      =					[3, 3, 9, 3] if depths is None else depths
										__lowercase						      =					hidden_act
										__lowercase						      =					initializer_range
										__lowercase						      =					layer_norm_eps
										__lowercase						      =					layer_scale_init_value
										__lowercase						      =					drop_path_rate
										__lowercase						      =					image_size
										__lowercase						      =					["stem"] + [f'''stage{idx}''' for idx in range(1     ,						len(self.depths					) + 1					)]
										__lowercase      ,				__lowercase						      =					get_aligned_output_features_output_indices(
										    out_features=_lowerCamelCase     ,						out_indices=_lowerCamelCase     ,						stage_names=self.stage_names					)





class 				__a    (   __a					):



							'''simple docstring'''







							_lowerCamelCase				: str					      =      version.parse("""1.11"""					)
							@property
							def      SCREAMING_SNAKE_CASE	(    self					) ->       Mapping[str, Mapping[int, str]]:




										'''simple docstring'''
										return OrderedDict(
										    [
										        ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
										    ]					)





							@property
							def      SCREAMING_SNAKE_CASE	(    self					) ->       float:




										'''simple docstring'''
										return 1e-5





