code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
import copy import os import cva import numpy as np from matplotlib import pyplot as plt class lowercase : def __init__( self): lowercase = '''''' lowercase = '''''' lowercase = [] lowercase = 0 ...
101
"""simple docstring""" from string import ascii_uppercase _A = {str(ord(c) - 5_5): c for c in ascii_uppercase} def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> str: if isinstance(__UpperCAmelCase , __UpperCAmelCase ): raise TypeEr...
242
0
"""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 SCREAMING_SNAKE_CASE : Dict = logging.get_logger(__name__) SCREAMING_S...
102
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase = 0 ) -> list: lowerCAmelCase__ : Optional[Any] = length or len(__UpperCAmelCase ) lowerCAmelCase__ : int = False for i in range(length - 1 ): ...
242
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING A__ : Tuple = logging.get_logger(__name__) A__ : List[str] ...
103
"""simple docstring""" import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def lowercase_ ( __UpperCAmelCase ) ->...
242
0
'''simple docstring''' from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def _A ( A__ , A__ , A__ , A__ , A__ ): """simple docstring""" __lowercase = cva.getAffineTransform(A__ , A__ ) return c...
104
"""simple docstring""" import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) fro...
242
0
"""simple docstring""" import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) fr...
105
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _A = logging.get_logger(__name__) _A = { """SenseTime/deformable-detr""": """https://huggingface.co/sensetime/deformable-detr/r...
242
0
"""simple docstring""" import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenize...
106
"""simple docstring""" def lowercase_ ( __UpperCAmelCase = 1000 ) -> int: lowerCAmelCase__ : Optional[Any] = 2**power lowerCAmelCase__ : Optional[int] = str(__UpperCAmelCase ) lowerCAmelCase__ : Optional[int] = list(__Upper...
242
0
import inspect import unittest from transformers import RegNetConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_common import ConfigTester from ......
107
"""simple docstring""" import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accele...
242
0
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase__ = { '''configuration_trajectory_transformer''': [ '''TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Traj...
108
"""simple docstring""" import math def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> int: lowerCAmelCase__ : Any = len(__UpperCAmelCase ) lowerCAmelCase__ : int = int(math.floor(math.sqrt(__UpperCAmelCase ) ) ) ...
242
0
"""simple docstring""" import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer A: str = logging.getLogger(__name__) def _snake_case ( ): UpperCAmelCase : List[str] = argparse.ArgumentParser( description="""Prepa...
109
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig _A = logging.get_logger(__name__) class _lowerCamelCase : def __init__( sel...
242
0
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class lowercase__ ( a_ , unittest.TestCase ): A__ : List[Any] =CTRLTokenizer A__ : ...
176
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: def count_of_possible_combinations(__UpperCAmelCase ) -> int: if target < 0: return 0 if target == 0: r...
242
0
'''simple docstring''' from __future__ import annotations from random import choice def _A ( snake_case ) -> Optional[Any]: return choice(__UpperCAmelCase ) def _A ( snake_case , snake_case ) -> int: _lowercase : List[str] = random_pivot(__UpperC...
250
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
242
0
def __magic_name__ ( ): '''simple docstring''' for n in range(1 , 1_000_000 ): yield n * (n + 1) // 2 def __magic_name__ ( __a : List[Any] ): '''simple docstring''' UpperCamelCase__ = 1 UpperCamelCase__ = 2 ...
244
"""simple docstring""" from typing import Any import numpy as np def lowercase_ ( __UpperCAmelCase ) -> bool: return np.array_equal(__UpperCAmelCase , matrix.conjugate().T ) def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> Any: ...
242
0
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig __A = logging.get_logger(__name__) __A = { '''Intel/dpt-large''': '''https://huggingface.co/Intel/dpt-large/resolve/main/config.json''', # See all DPT ...
135
"""simple docstring""" from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _lowerCamelCase ( a_ ): def _lowerCAmelCase ( self : Any ) -> str: """simple docstring""" return [ ...
242
0
import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(a_ ) , """Tatoeba directory d...
209
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( ...
242
0
'''simple docstring''' import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": lowerCamelCase : Dict = argparse.ArgumentParser() parser.add_argument( '--checkpoint_path', defaul...
2
"""simple docstring""" import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transf...
242
0
import os from datetime import datetime as dt from github import Github lowerCAmelCase__ : Tuple = [ '''good first issue''', '''feature request''', '''wip''', ] def UpperCamelCase__ ( ) -> List[str]: snake_case__ : List[str] = Github(os.environ[...
143
"""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 _A = logging.get_logger(__name__) _A = { """face...
242
0
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class _SCREAMING_SNAKE_CASE ( a_ ): '''simple docstring''' lowercase_ = (DDPMParallelScheduler,) def SCREAMING_SNAKE_CASE_ (self : Dict , **UpperCAmelCase_ ...
10
"""simple docstring""" from __future__ import annotations import bisect def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase = 0 , __UpperCAmelCase = -1 ) -> int: if hi < 0: lowerCAmelCase__ : Union[str, Any] = len(__Uppe...
242
0
from sklearn.metrics import mean_squared_error import datasets __UpperCAmelCase = '''\ @article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. and Thirion, B. and Grisel, O. and Blondel, M. and Pr...
119
"""simple docstring""" import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax...
242
0
import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.stable_diffusion_s...
259
"""simple docstring""" from __future__ import annotations def lowercase_ ( __UpperCAmelCase ) -> int: if not nums: return 0 lowerCAmelCase__ : List[Any] = nums[0] lowerCAmelCase__ : List[str] = 0 for num in nums[1:]: ...
242
0
def a ( A__ : Optional[Any] ) -> str: """simple docstring""" return "".join(chr(ord(__UpperCAmelCase ) - 32 ) if 'a' <= char <= 'z' else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
205
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowercase_ ( ) -> Optional[int]: lowerCAmelCase__ : Dict = { """repo_name""": ["""test_repo1""...
242
0
import unittest from datasets import load_dataset from transformers import BloomTokenizerFast from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class lowercase__ ( a_ , unittest.TestCase ): A__ : ...
176
"""simple docstring""" import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoT...
242
0
'''simple docstring''' import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch from diffusers.configuration_utils import ConfigMixin, register_to_config from diffusers.schedulers.scheduling_utils import SchedulerMixin from diffusers.utils import ...
250
"""simple docstring""" from itertools import product def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> list[int]: lowerCAmelCase__ : Union[str, Any] = sides_number lowerCAmelCase__ : Optional[int] = max_face_number * dice_number ...
242
0
import copy import random from transformers import CLIPTokenizer class __A( a_ ): """simple docstring""" def __init__(self , *SCREAMING_SNAKE_CASE_ , **SCREAMING_SNAKE_CASE_ ): super().__init__(*SCREAMING_SNAKE_CASE_ , **SCREAMING_SNAKE_CASE_ ) Upper...
244
"""simple docstring""" from string import ascii_uppercase _A = {str(ord(c) - 5_5): c for c in ascii_uppercase} def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> str: if isinstance(__UpperCAmelCase , __UpperCAmelCase ): raise TypeEr...
242
0
"""simple docstring""" import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": __A = argparse.ArgumentParser() parser.add_argument('''--dump_path''', default=None, type=...
135
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase = 0 ) -> list: lowerCAmelCase__ : Optional[Any] = length or len(__UpperCAmelCase ) lowerCAmelCase__ : int = False for i in range(length - 1 ): ...
242
0
def lowerCAmelCase__(__snake_case ) -> bool: '''simple docstring''' if number < 0: raise ValueError('''number must not be negative''' ) return number & (number - 1) == 0 if __name__ == "__main__": import doctest doctest.testmod()
209
"""simple docstring""" import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def lowercase_ ( __UpperCAmelCase ) ->...
242
0
'''simple docstring''' def _SCREAMING_SNAKE_CASE (A = 1_000 ) -> int: """simple docstring""" lowercase__ = 2**power lowercase__ = str(__UpperCAmelCase ) lowercase__ = list(__UpperCAmelCase ) lowercase__ ...
2
"""simple docstring""" import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) fro...
242
0
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Accelera...
143
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _A = logging.get_logger(__name__) _A = { """SenseTime/deformable-detr""": """https://huggingface.co/sensetime/deformable-detr/r...
242
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "alibaba-damo/mgp-str-base": "https://huggingface.co/alibaba-damo/mgp-str-base/resolve/main/config.json", } class _SCREAMING_SNAKE_CASE ( a_ ): ...
10
"""simple docstring""" def lowercase_ ( __UpperCAmelCase = 1000 ) -> int: lowerCAmelCase__ : Optional[Any] = 2**power lowerCAmelCase__ : Optional[int] = str(__UpperCAmelCase ) lowerCAmelCase__ : Optional[int] = list(__Upper...
242
0
import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_RECORDS_FILENAME, RealmRetr...
119
"""simple docstring""" import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accele...
242
0
import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class UpperCAmelCase_ ( unittest.TestCase ): """sim...
259
"""simple docstring""" import math def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> int: lowerCAmelCase__ : Any = len(__UpperCAmelCase ) lowerCAmelCase__ : int = int(math.floor(math.sqrt(__UpperCAmelCase ) ) ) ...
242
0
from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse('3.8'): import importlib_metadata else: import importlib.metadata as importlib_metadata lowercase_ =...
205
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig _A = logging.get_logger(__name__) class _lowerCamelCase : def __init__( sel...
242
0
import shutil import tempfile import unittest import numpy as np import pytest from transformers import is_speech_available, is_vision_available from transformers.testing_utils import require_torch if is_vision_available(): from transformers import TvltImageProcessor if is_speech_available(): from transfo...
176
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: def count_of_possible_combinations(__UpperCAmelCase ) -> int: if target < 0: return 0 if target == 0: r...
242
0
'''simple docstring''' def _A ( snake_case ) -> str: return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
250
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
242
0
import collections import importlib.util import os import re from pathlib import Path lowerCamelCase_ = '''src/transformers''' # Matches is_xxx_available() lowerCamelCase_ = re.compile(r'''is\_([a-z_]*)_available()''') # Catches a one-line _import_struct = {xxx} lowerCamelCase_ = re.c...
244
"""simple docstring""" from typing import Any import numpy as np def lowercase_ ( __UpperCAmelCase ) -> bool: return np.array_equal(__UpperCAmelCase , matrix.conjugate().T ) def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> Any: ...
242
0
"""simple docstring""" import unittest from transformers import SPIECE_UNDERLINE, ReformerTokenizer, ReformerTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_...
135
"""simple docstring""" from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _lowerCamelCase ( a_ ): def _lowerCAmelCase ( self : Any ) -> str: """simple docstring""" return [ ...
242
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _a = { "configuration_clip": [ "CLIP_PRETRAINED_CONFIG_...
209
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( ...
242
0
'''simple docstring''' import os def _SCREAMING_SNAKE_CASE () -> Tuple: """simple docstring""" lowercase__ = os.path.dirname(os.path.realpath(__UpperCAmelCase ) ) lowercase__ = os.path.join(__UpperCAmelCase , '''triangle.txt''' )...
2
"""simple docstring""" import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transf...
242
0
lowerCAmelCase__ : Optional[int] = [0, 2, 4, 6, 8] lowerCAmelCase__ : Tuple = [1, 3, 5, 7, 9] def UpperCamelCase__ ( A__ , A__ , A__ , A__ ) -> int: if remaining_length == 0: if digits[0] == 0 or digits[-1] == 0: return 0 for i in range(l...
143
"""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 _A = logging.get_logger(__name__) _A = { """face...
242
0
from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy __A = logging.get_logger(__name__) class _SCREAMING_SNA...
10
"""simple docstring""" from __future__ import annotations import bisect def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase = 0 , __UpperCAmelCase = -1 ) -> int: if hi < 0: lowerCAmelCase__ : Union[str, Any] = len(__Uppe...
242
0
import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.version import Version __UpperCAmelCase = ge...
119
"""simple docstring""" import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax...
242
0
import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMSchedule...
259
"""simple docstring""" from __future__ import annotations def lowercase_ ( __UpperCAmelCase ) -> int: if not nums: return 0 lowerCAmelCase__ : List[Any] = nums[0] lowerCAmelCase__ : List[str] = 0 for num in nums[1:]: ...
242
0
def a ( A__ : Optional[Any] , A__ : int , A__ : Dict ) -> int: """simple docstring""" def count_of_possible_combinations(A__ : List[str] ) -> int: if target < 0: return 0 if target == 0: ...
205
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowercase_ ( ) -> Optional[int]: lowerCAmelCase__ : Dict = { """repo_name""": ["""test_repo1""...
242
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __snake_case = { """configuration_nllb_moe""": [ """NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NllbMoeConfig""", ] } try: if not is_torch_available(): ...
176
"""simple docstring""" import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoT...
242
0
'''simple docstring''' from __future__ import annotations from collections.abc import MutableSequence class a__ : def __init__( self , _UpperCamelCase , _UpperCamelCase ): """simple docstring""" if len(_UpperCamelCase ) != degree + 1: raise ValueError( ...
250
"""simple docstring""" from itertools import product def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> list[int]: lowerCAmelCase__ : Union[str, Any] = sides_number lowerCAmelCase__ : Optional[int] = max_face_number * dice_number ...
242
0
import multiprocessing from typing import TYPE_CHECKING, Optional, Union from .. import Dataset, Features, config from ..formatting import query_table from ..packaged_modules.sql.sql import Sql from ..utils import logging from .abc import AbstractDatasetInputStream if TYPE_CHECKING: import sqlitea import s...
244
"""simple docstring""" from string import ascii_uppercase _A = {str(ord(c) - 5_5): c for c in ascii_uppercase} def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> str: if isinstance(__UpperCAmelCase , __UpperCAmelCase ): raise TypeEr...
242
0
"""simple docstring""" import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class _snake_case ( datasets.BeamBasedBuilder ): def lowerCamelCase...
135
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase = 0 ) -> list: lowerCAmelCase__ : Optional[Any] = length or len(__UpperCAmelCase ) lowerCAmelCase__ : int = False for i in range(length - 1 ): ...
242
0
import argparse from torch import nn # transformers_old should correspond to branch `save_old_prophetnet_model_structure` here # original prophetnet_checkpoints are saved under `patrickvonplaten/..._old` respectively from transformers_old.modeling_prophetnet import ( ProphetNetForConditionalGeneration as Pr...
209
"""simple docstring""" import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def lowercase_ ( __UpperCAmelCase ) ->...
242
0
'''simple docstring''' from typing import Any def _SCREAMING_SNAKE_CASE (A ) -> list[Any]: """simple docstring""" if not input_list: return [] lowercase__ = [input_list.count(__UpperCAmelCase ) for value in input_list] lowe...
2
"""simple docstring""" import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) fro...
242
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ : List[Any] = logging.get_logger(__name__) lowerCAmelCase__ ...
143
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _A = logging.get_logger(__name__) _A = { """SenseTime/deformable-detr""": """https://huggingface.co/sensetime/deformable-detr/r...
242
0
import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( TEXT_GUIDED_IMAGE_I...
10
"""simple docstring""" def lowercase_ ( __UpperCAmelCase = 1000 ) -> int: lowerCAmelCase__ : Optional[Any] = 2**power lowerCAmelCase__ : Optional[int] = str(__UpperCAmelCase ) lowerCAmelCase__ : Optional[int] = list(__Upper...
242
0
import tensorflow as tf from ...tf_utils import shape_list class lowerCAmelCase_ ( tf.keras.layers.Layer ): def __init__( self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_=1, SCREAMING_SNAKE_CASE_=False, **S...
119
"""simple docstring""" import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accele...
242
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin if is_torch_available(): import torch if is_vision_avail...
259
"""simple docstring""" import math def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> int: lowerCAmelCase__ : Any = len(__UpperCAmelCase ) lowerCAmelCase__ : int = int(math.floor(math.sqrt(__UpperCAmelCase ) ) ) ...
242
0
def a ( A__ : List[str] ) -> bool: """simple docstring""" if not isinstance(__UpperCAmelCase , __UpperCAmelCase ): _lowercase =F'''Input value of [number={number}] must be an integer''' raise TypeError(__UpperCAmelCa...
205
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig _A = logging.get_logger(__name__) class _lowerCamelCase : def __init__( sel...
242
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = { """weiweishi/roc-bert-base-zh""": """https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json""", } class lowercase__ ( ...
176
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: def count_of_possible_combinations(__UpperCAmelCase ) -> int: if target < 0: return 0 if target == 0: r...
242
0
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _snake_case = logging.get_logger(__name__) _snake_case = '▁' _snake_case =...
250
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
242
0
import warnings from ...utils import logging from .image_processing_deformable_detr import DeformableDetrImageProcessor lowerCamelCase_ = logging.get_logger(__name__) class __A( a_ ): """simple docstring""" def __init__(self , *SCREAMING_SNAKE_CASE_ , **SCREAMING_SNAKE_...
244
"""simple docstring""" from typing import Any import numpy as np def lowercase_ ( __UpperCAmelCase ) -> bool: return np.array_equal(__UpperCAmelCase , matrix.conjugate().T ) def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> Any: ...
242
0
"""simple docstring""" from ..models.auto import AutoModelForSeqaSeqLM, AutoTokenizer from .base import PipelineTool __A = { '''Acehnese Arabic''': '''ace_Arab''', '''Acehnese Latin''': '''ace_Latn''', '''Mesopotamian Arabic''': '''acm_Arab''', '''Ta\'izzi-Adeni Arabic''': '''acq_Arab''', ...
135
"""simple docstring""" from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _lowerCamelCase ( a_ ): def _lowerCAmelCase ( self : Any ) -> str: """simple docstring""" return [ ...
242
0
import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available from ...test_backbone_com...
209
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( ...
242
0
'''simple docstring''' import gc import unittest from transformers import MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, FillMaskPipeline, pipeline from transformers.pipelines import PipelineException from transformers.testing_utils import ( is_pipeline_test, is_torch_available, nested_si...
2
"""simple docstring""" import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transf...
242
0
def UpperCamelCase__ ( A__ ) -> Optional[int]: if not head: return True # split the list to two parts snake_case__ : List[str] = head.next, head while fast and fast.next: snake_case__ : Any = fast.next.next snake_ca...
143
"""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 _A = logging.get_logger(__name__) _A = { """face...
242
0
import importlib.util import json import os import warnings from dataclasses import dataclass, field import torch from ..training_args import TrainingArguments from ..utils import cached_property, is_sagemaker_dp_enabled, logging __A = logging.get_logger(__name__) def lowerCAmelCase_ ( ...
10
"""simple docstring""" from __future__ import annotations import bisect def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase = 0 , __UpperCAmelCase = -1 ) -> int: if hi < 0: lowerCAmelCase__ : Union[str, Any] = len(__Uppe...
242
0
from math import factorial def UpperCamelCase ( snake_case__ : Tuple = 20 ) -> int: UpperCamelCase : str = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... UpperCamelCase : Optional[int] = n // 2 return int(factorial(__UpperC...
119
"""simple docstring""" import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax...
242
0
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTimestepEmbedding,...
259
"""simple docstring""" from __future__ import annotations def lowercase_ ( __UpperCAmelCase ) -> int: if not nums: return 0 lowerCAmelCase__ : List[Any] = nums[0] lowerCAmelCase__ : List[str] = 0 for num in nums[1:]: ...
242
0
import os import sys import warnings from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen from ....
205
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowercase_ ( ) -> Optional[int]: lowerCAmelCase__ : Dict = { """repo_name""": ["""test_repo1""...
242
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = { """vinvino02/glpn-kitti""": """https://huggingface.co/vinvino02/glpn-kitti/resolve/main/config.json""", # See all GLPN models at https://huggingface.c...
176
"""simple docstring""" import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoT...
242
0
'''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 _snake_case = logging.get_logger(__name__) _snake_case = { 'facebook/de...
250
"""simple docstring""" from itertools import product def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> list[int]: lowerCAmelCase__ : Union[str, Any] = sides_number lowerCAmelCase__ : Optional[int] = max_face_number * dice_number ...
242
0
from __future__ import annotations import bisect def __magic_name__ ( __a : Any , __a : Optional[int] , __a : Tuple = 0 , __a : Union[str, Any] = -1 ): '''simple docstring''' if hi < 0: UpperCamelCase__ = len(__U...
244
"""simple docstring""" from string import ascii_uppercase _A = {str(ord(c) - 5_5): c for c in ascii_uppercase} def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> str: if isinstance(__UpperCAmelCase , __UpperCAmelCase ): raise TypeEr...
242
0
"""simple docstring""" from __future__ import annotations def lowercase_ ( _lowerCamelCase: Tuple ) -> bool: '''simple docstring''' __lowerCamelCase : Optional[Any] = str(__UpperCAmelCase ) return len(__UpperCAmelCase ) == 9 and...
135
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase = 0 ) -> list: lowerCAmelCase__ : Optional[Any] = length or len(__UpperCAmelCase ) lowerCAmelCase__ : int = False for i in range(length - 1 ): ...
242
0
import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def lowerCAmelCase__(__snake_case ) -> Any: ...
209
"""simple docstring""" import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def lowercase_ ( __UpperCAmelCase ) ->...
242
0
'''simple docstring''' from typing import Any def _SCREAMING_SNAKE_CASE (A , A , A , A , A , ) -> list: """simple docstring""" _validation( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , ) # Crea...
2
"""simple docstring""" import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) fro...
242
0
import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStructProcessor, PixaStructTextCo...
143
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _A = logging.get_logger(__name__) _A = { """SenseTime/deformable-detr""": """https://huggingface.co/sensetime/deformable-detr/r...
242
0
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenProcesso...
10
"""simple docstring""" def lowercase_ ( __UpperCAmelCase = 1000 ) -> int: lowerCAmelCase__ : Optional[Any] = 2**power lowerCAmelCase__ : Optional[int] = str(__UpperCAmelCase ) lowerCAmelCase__ : Optional[int] = list(__Upper...
242
0
import unittest import numpy as np import requests from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available()...
119
"""simple docstring""" import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accele...
242
0
from __future__ import annotations def _A ( SCREAMING_SNAKE_CASE__ : Union[str, Any] ): if not nums: return 0 UpperCamelCase :List[Any] = nums[0] UpperCamelCase :List[str] = 0 for num in nums[1:]: UpperCamelCase :List[Any] ...
259
"""simple docstring""" import math def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> int: lowerCAmelCase__ : Any = len(__UpperCAmelCase ) lowerCAmelCase__ : int = int(math.floor(math.sqrt(__UpperCAmelCase ) ) ) ...
242
0
import jax.numpy as jnp from ...utils import logging from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel from .configuration_mta import MTaConfig lowercase_ = logging.get_logger(__name__) lowercase_ = 'T5Config' def a ( A__ ...
205
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig _A = logging.get_logger(__name__) class _lowerCamelCase : def __init__( sel...
242
0
def _lowercase ( UpperCamelCase_ , UpperCamelCase_ ) -> str: '''simple docstring''' if not isinstance(__UpperCAmelCase , __UpperCAmelCase ): raise ValueError('iterations must be defined as integers' ) if not isinstance(__UpperCAmelCase , __UpperCAmelCase ) or not numbe...
176
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: def count_of_possible_combinations(__UpperCAmelCase ) -> int: if target < 0: return 0 if target == 0: r...
242
0
'''simple docstring''' from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets _snake_case = '\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding},\n author={Wang, Alex an...
250
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
242
0
import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import version from torch import nn from ...
244
"""simple docstring""" from typing import Any import numpy as np def lowercase_ ( __UpperCAmelCase ) -> bool: return np.array_equal(__UpperCAmelCase , matrix.conjugate().T ) def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> Any: ...
242
0
"""simple docstring""" from __future__ import annotations def lowercase_ ( _lowerCamelCase: Optional[int] , _lowerCamelCase: List[Any] ) -> list[tuple[int, int]]: '''simple docstring''' __lowerCamelCase : Optional[int] = position ...
135
"""simple docstring""" from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _lowerCamelCase ( a_ ): def _lowerCAmelCase ( self : Any ) -> str: """simple docstring""" return [ ...
242
0
from typing import List import numpy as np def lowerCAmelCase__(__snake_case ) -> int: '''simple docstring''' lowerCamelCase__ = {key: len(__UpperCAmelCase ) for key, value in gen_kwargs.items() if isinstance(__UpperCAmelCase ,__UpperCAmelCase )} if l...
209
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( ...
242
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase : Tuple = logging.get_logger(__name__) lowerCamelCase : int = { '...
2
"""simple docstring""" import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transf...
242
0
lowerCAmelCase__ : Any = [ '''Audio''', '''Array2D''', '''Array3D''', '''Array4D''', '''Array5D''', '''ClassLabel''', '''Features''', '''Sequence''', '''Value''', '''Image''', '''Translation''', '''TranslationVariableLanguages''', ] from .audio impo...
143
"""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 _A = logging.get_logger(__name__) _A = { """face...
242
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"} class _SCREAMING_SNAKE_CASE ( a_ ): '''simple docstring''' lowercas...
10
"""simple docstring""" from __future__ import annotations import bisect def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase = 0 , __UpperCAmelCase = -1 ) -> int: if hi < 0: lowerCAmelCase__ : Union[str, Any] = len(__Uppe...
242
0
import heapq as hq import math from collections.abc import Iterator class lowerCAmelCase_ : def __init__( self, SCREAMING_SNAKE_CASE_ ) -> Any: UpperCamelCase : Tuple = str(id_ ) UpperCamelCase : Dict = None UpperCamelCase : L...
119
"""simple docstring""" import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax...
242
0
from itertools import product def _A ( SCREAMING_SNAKE_CASE__ : List[Any] , SCREAMING_SNAKE_CASE__ : Optional[Any] ): UpperCamelCase :Union[str, Any] = sides_number UpperCamelCase :Optional[int] = max_face_number * dice_number UpperCamelCase :...
259
"""simple docstring""" from __future__ import annotations def lowercase_ ( __UpperCAmelCase ) -> int: if not nums: return 0 lowerCAmelCase__ : List[Any] = nums[0] lowerCAmelCase__ : List[str] = 0 for num in nums[1:]: ...
242
0
from __future__ import annotations from typing import Generic, TypeVar lowercase_ = TypeVar('T') class __lowerCAmelCase ( Generic[T] ): def __init__( self , lowerCAmelCase ) -> None: '''simple docstring''' _lowercase ...
205
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowercase_ ( ) -> Optional[int]: lowerCAmelCase__ : Dict = { """repo_name""": ["""test_repo1""...
242
0
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor __snake_case = logging.get_logger(__name__) class lowercase__ ( a_ ): def __init__( self : int , *UpperCAmelCase_ : Any , **UpperCAmelCase_ ...
176
"""simple docstring""" import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoT...
242
0
'''simple docstring''' from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def _A ( ) -> Optional[int]: _lowercase : Dict = { """repo_name""": ["""test_repo1""", """test_repo2""", """test_re...
250
"""simple docstring""" from itertools import product def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> list[int]: lowerCAmelCase__ : Union[str, Any] = sides_number lowerCAmelCase__ : Optional[int] = max_face_number * dice_number ...
242
0
import re import tempfile from pathlib import Path import pytest import yaml from datasets.utils.readme import ReadMe # @pytest.fixture # def example_yaml_structure(): lowerCamelCase_ = yaml.safe_load( '''\ name: \"\" allow_empty: false allow_empty_text: true subsections: - name: \"Dataset Card fo...
244
"""simple docstring""" from string import ascii_uppercase _A = {str(ord(c) - 5_5): c for c in ascii_uppercase} def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> str: if isinstance(__UpperCAmelCase , __UpperCAmelCase ): raise TypeEr...
242
0
"""simple docstring""" from . import __version__ # Backward compatibility imports, to make sure all those objects can be found in file_utils from .utils import ( CLOUDFRONT_DISTRIB_PREFIX, CONFIG_NAME, DISABLE_TELEMETRY, DUMMY_INPUTS, DUMMY_MASK, ENV_VARS_TRUE_AND_AUTO_VALUES, ENV_VARS...
135
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase = 0 ) -> list: lowerCAmelCase__ : Optional[Any] = length or len(__UpperCAmelCase ) lowerCAmelCase__ : int = False for i in range(length - 1 ): ...
242
0
import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device _a = False class __A ( unittest.TestCase ): '''simple docstr...
209
"""simple docstring""" import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def lowercase_ ( __UpperCAmelCase ) ->...
242
0
'''simple docstring''' from math import factorial lowerCamelCase : List[Any] = {str(d): factorial(d) for d in range(10)} def _SCREAMING_SNAKE_CASE (A ) -> int: """simple docstring""" return sum(DIGIT_FACTORIAL[d] for d in str(__UpperCAmelCase ...
2
"""simple docstring""" import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) fro...
242
0
import baseaa def UpperCamelCase__ ( A__ ) -> bytes: return baseaa.aaaencode(string.encode('utf-8' ) ) def UpperCamelCase__ ( A__ ) -> str: return baseaa.aaadecode(__UpperCAmelCase ).decode('utf-8' ) if __name__ == "__main__": import doctest d...
143
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _A = logging.get_logger(__name__) _A = { """SenseTime/deformable-detr""": """https://huggingface.co/sensetime/deformable-detr/r...
242
0
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class _SCREAMING_SNAKE_CASE ( a_ ): '''simple docstring''' lowercase_ = "Speech2TextFeatureExtractor" lowercase_ = "Speech2TextTokenizer" def __init__(self : List[str] ,...
10
"""simple docstring""" def lowercase_ ( __UpperCAmelCase = 1000 ) -> int: lowerCAmelCase__ : Optional[Any] = 2**power lowerCAmelCase__ : Optional[int] = str(__UpperCAmelCase ) lowerCAmelCase__ : Optional[int] = list(__Upper...
242
0
import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def UpperCamelCase ( snake_case__ : List[Any] ) -> Dict: UpperCamelCase : Optional[int] = [ """encoder.version""", """decoder.version""", """mode...
119
"""simple docstring""" import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accele...
242
0
def _A ( SCREAMING_SNAKE_CASE__ : List[str] , SCREAMING_SNAKE_CASE__ : Tuple ): if b == 0: return 1 if (b % 2) == 0: return actual_power(__UpperCAmelCase , int(b / 2 ) ) * actual_power(__UpperCAmelCase , int(b / 2 ) ) else: ...
259
"""simple docstring""" import math def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> int: lowerCAmelCase__ : Any = len(__UpperCAmelCase ) lowerCAmelCase__ : int = int(math.floor(math.sqrt(__UpperCAmelCase ) ) ) ...
242
0
import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device lowercase_ = False class __lowerCAmelCase ( unittest.TestCase ):...
205
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig _A = logging.get_logger(__name__) class _lowerCamelCase : def __init__( sel...
242
0
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch if is_tf_available(): ...
176
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: def count_of_possible_combinations(__UpperCAmelCase ) -> int: if target < 0: return 0 if target == 0: r...
242
0
'''simple docstring''' from __future__ import annotations def _A ( snake_case ) -> list[int]: _lowercase : List[Any] = [True] * limit _lowercase : Dict = False _lowercase : Optional[Any] = False _lowercase : Union[str, Any] =...
250
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
242
0
from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split lowerCamelCase_ = datasets.load_iris() lowerCamelCase_ = np.array(data['''data''']) lowerCamelCase_ = np.array(data['''target''']) lowerCamelCase_ ...
244
"""simple docstring""" from typing import Any import numpy as np def lowercase_ ( __UpperCAmelCase ) -> bool: return np.array_equal(__UpperCAmelCase , matrix.conjugate().T ) def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> Any: ...
242
0