code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
from datetime import datetime import requests def __magic_name__ ( A : str ): '''simple docstring''' a = "https://downloadgram.net/wp-json/wppress/video-downloader/video?url=" a = requests.get(base_url + url ).json()[0]["urls"][0]["src"] return requests.get(A ...
107
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .to...
168
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase : Dict = { 'configuration_git': ['GIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GitConfig', 'GitVisionConfig'], 'processing_git': ['...
354
'''simple docstring''' from __future__ import annotations def lowerCAmelCase_ ( snake_case__ ): '''simple docstring''' A : List[str] = 2 A : Dict = [] while i * i <= n: if n % i: i += 1 else:...
311
0
'''simple docstring''' from sklearn.metrics import mean_squared_error import datasets lowerCamelCase : int = "\\n@article{scikit-learn,\n title={Scikit-learn: Machine Learning in {P}ython},\n author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.\n and Thirion, B. and Grisel,...
47
'''simple docstring''' def _A ( ): return [list(range(1000 - i , -1000 - i , -1 ) ) for i in range(1000 )] __A = generate_large_matrix() __A = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [-1, -1, -2, -3]], [[3, 2], [1, 0]], [[7, 7, ...
164
0
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase = logging.get_logger(__name__) _lowerCAmelCase = { '''google/pix2struct-textcaps-base''': ( '''https:/...
363
'''simple docstring''' _lowerCAmelCase = '''Input must be a string of 8 numbers plus letter''' _lowerCAmelCase = '''TRWAGMYFPDXBNJZSQVHLCKE''' def _SCREAMING_SNAKE_CASE ( UpperCamelCase ): """simple docstring""" if not isinstance(UpperCamelCase , U...
184
0
from math import sqrt def __magic_name__ ( A : int ): '''simple docstring''' a = 0 for i in range(1, int(sqrt(A ) + 1 ) ): if n % i == 0 and i != sqrt(A ): total += i + n // i elif i == sqrt(A ): total += i return total - n ...
107
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __lowerCAmelCase : List[str] = { 'configuration_resnet': ['RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ResNetConfig', '...
107
1
import unittest from transformers import RoFormerTokenizer, RoFormerTokenizerFast from transformers.testing_utils import require_rjieba, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_rjieba @require_tokenizers class __snake_case ( lowerCamelCase__ , ...
78
import gc import random import unittest import numpy as np import torch from diffusers import ( DDIMScheduler, KandinskyVaaControlnetPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_numpy, slow, torch_device from diff...
78
1
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging ...
161
'''simple docstring''' import math import unittest def snake_case ( UpperCAmelCase )-> bool: """simple docstring""" assert isinstance(UpperCAmelCase , UpperCAmelCase ) and ( number >= 0 ), "'number' must been an int and posi...
161
1
"""simple docstring""" from queue import Queue from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from ..models.auto import AutoTokenizer class snake_case : def UpperCAmelCase__ ( self , __UpperCAmelCase) ->str: raise NotImplementedError() def ...
303
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils i...
303
1
'''simple docstring''' from __future__ import annotations def lowercase ( __magic_name__ ): '''simple docstring''' if len(__magic_name__ ) == 0: return [] UpperCAmelCase , UpperCAmelCase : List[str] = min(__magic_name__ ), ma...
311
'''simple docstring''' import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", datefmt="%m/%d/%Y %H:%M:%S", level=loggi...
311
1
"""simple docstring""" import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin...
69
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE_ : Tuple = { 'configuration_nllb_moe': [ 'NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'NllbMoeConfig', ...
69
1
import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, ...
5
from __future__ import annotations A : Union[str, Any] = { "A": ["B", "C", "E"], "B": ["A", "D", "E"], "C": ["A", "F", "G"], "D": ["B"], "E": ["A", "B", "D"], "F": ["C"], "G": ["C"], } class _lowercase : """simple docstring""" ...
184
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, res...
326
"""simple docstring""" from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def lowercase ( _SCREAMING_SNAKE_CASE : int ): '''simple docstring''' _UpperCAmelCase = int(number**0.5 ) return n...
326
1
"""simple docstring""" import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home snake_case_ = HUGGINGFACE_HUB_CACHE snake_case_ = """config.json""" snake_case_ = """diffusion_pytorch_model.bin""" snake_case_ = ...
78
"""simple docstring""" import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokenizers.p...
78
1
'''simple docstring''' import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class __lowerCAmelCase : """simple docstring""" def __init__( self : List[Any] , ...
358
'''simple docstring''' import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class __lowerCAmelCase ( unittest.TestCase ): """simple docstring""" def snake_cas...
287
0
from timeit import timeit def a__ ( snake_case ): """simple docstring""" if number < 0: raise ValueError('''the value of input must not be negative''' ) __SCREAMING_SNAKE_CASE : Optional[Any] = 0 while number: number &= number - 1 result += 1 return result def a...
303
import sys from collections import defaultdict class __UpperCamelCase : """simple docstring""" def __init__( self : Union[str, Any] ): """simple docstring""" __SCREAMING_SNAKE_CASE : Optional[int] = [] def UpperCAmelCas...
303
1
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case__ = logging.get_logger(__name__) snake_case__ = { """RUCAIBox/mvp""": """https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json""",...
4
'''simple docstring''' import argparse from collections import OrderedDict from pathlib import Path import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision.transforms import functional as F from transformers import DetrImageProcessor, TableTransforme...
4
1
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> Union[str, Any]: return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase=0 ) -> List[str]: retur...
69
"""simple docstring""" from __future__ import annotations def UpperCAmelCase ( UpperCAmelCase ) -> None: create_state_space_tree(UpperCAmelCase , [] , 0 , [0 for i in range(len(UpperCAmelCase ) )] ) def UpperCAmelCase ( UpperCAmel...
69
1
"""simple docstring""" from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, ...
133
"""simple docstring""" import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class SCREAMING_SNAKE_CASE__ ( lowercase ):...
133
1
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) ...
326
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class _lowerCamelCase ( unittest.TestCase ): """simple docstring""" UpperCAmelCase_ : str =JukeboxTokenizer UpperCAmelCase_ : Tuple ={...
326
1
import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCAmelCase : Union[str, Any] = logging.get_logger(__name__) _lowerCAmelCase : Tuple = {'''vocab_file''': '''vocab.json'''} _lowerCAmelCase ...
355
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : int = logging.get_logger(__name__) _lowerCAmelCase : Dict = { '''microsoft/git-base''': '''https://huggingface.co/microsoft/git-base/resol...
70
0
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, Features, Value from .base import TaskTemplate @dataclass(frozen=__SCREAMING_SNAKE_CASE ) class A__(__SCREAMING_SNAKE_CASE ): """simple docstring""" _A : str ...
248
_lowerCamelCase ={ "joule": 1.0, "kilojoule": 1_0_0_0, "megajoule": 1_0_0_0_0_0_0, "gigajoule": 1_0_0_0_0_0_0_0_0_0, "wattsecond": 1.0, "watthour": 3_6_0_0, "kilowatthour": 3_6_0_0_0_0_0, "newtonmeter": 1.0, "calorie_nutr": 4_1_8_6.8, "kilocalorie_nutr": 4_1_8_6_8_0_0.0_0...
287
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { 'asapp/sew-d-tiny-100k': 'https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main...
360
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase_ = { 'configuration...
247
0
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case =logging.get_logger(__name__) __snake_case ={ """RUCAIBox/mvp""": """https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json""", } ...
4
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case =logging.get_logger(__name__) __snake_case ={ """facebook/s2t-wav2vec2-large-en-de""": ( """https://huggingface.co/facebook/s2t-wav2vec2-large-en-d...
4
1
import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print("""Googling.....""") SCREAMING_SNAKE_CASE__ = """https://www.google.com/search?q=""" + """ """.join(sys.argv[1:]) SCREAMING_SNAKE_CASE__ ...
297
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_gpta import GPTaTokenizer if TYPE_CHECKING:...
297
1
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class __lowerCAmelCase ( unittest.TestCase ): ...
133
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Dataset from tr...
133
1
from __future__ import annotations from math import pi def __A (__A : float , __A : float , __A : float ) -> dict[str, float]: """simple docstring""" if (inductance, frequency, reactance).count(0 ) != 1: ...
354
from timeit import timeit def A (__A : int ) -> int: """simple docstring""" if number < 0: raise ValueError('''the value of input must not be negative''' ) UpperCAmelCase_ = 0 while number: number ...
7
0
"""simple docstring""" from __future__ import annotations from typing import Any def lowercase_ ( _snake_case ): create_state_space_tree(_snake_case ,[] ,0 ) def lowercase_ ( _snake_case ,_snake_case ,_snake_case ): if index == len(_snake_case ): ...
25
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class UpperCAmelCase : def __init__( self : str , __snake_case : Any ) -> str: _lowerCAmelCase = str(id_ ) _lo...
70
0
'''simple docstring''' import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase_ ( _SCREAMING_SNAKE_CASE ): '''simple docstring''' _lowercase : str = (DDPMScheduler,) def _lowercase ...
229
'''simple docstring''' # Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position _lowercase = """2.13.1""" import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version.parse("""3.7""...
229
1
import random def lowerCamelCase_ ( _a , _a ): """simple docstring""" lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ : Tuple = [], [], [] for element in data: if element < pivot: less.append(lowercase_ ...
131
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( lowercase_ ) -> list[int]: if length <= 0 or not isinstance(lowercase_ , lowercase_ ): raise ValueError("Length must be a positive integer." ) return [n * (2 * n - 1) for n in range(lowercase_ )] if __name__ == "__ma...
247
0
from collections.abc import Generator def A ( ): '''simple docstring''' _lowerCAmelCase , _lowerCAmelCase : int = 0, 1 while True: _lowerCAmelCase , _lowerCAmelCase : List[str] = b, a + b ...
300
import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor _snake_case = logging.get_logger(__name__) class UpperCAmelCase_ ( a): def __init__( self, *__a, **__a): '''simple docstring''' warnings....
300
1
'''simple docstring''' from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class a__: lowercase__ = 42 lowercase__ = None lowercase__ = None lowerCAmelCase: Optional[Any] = namedtuple('CoinsDistri...
297
'''simple docstring''' from typing import Optional from torch import nn from .transformer_ad import TransformeraDModel, TransformeraDModelOutput class a__( nn.Module ): def __init__( self : Any , __snake_case : int = 16 , __snake_case : int = 88 , __snake_...
297
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase : int = logging.get_logger(__name__) UpperCamelCase : int = { """google/switch-base-8""": """https://huggingface.co/google/switch-base-8/blob/main/config...
365
'''simple docstring''' import copy import random from transformers import CLIPTokenizer class UpperCamelCase ( a_ ): """simple docstring""" def __init__( self : Union[str, Any] , *UpperCAmelCase_ : Dict , **UpperCAmelCase_ : Any): """s...
345
0
from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked befor...
71
import os # Precomputes a list of the 100 first triangular numbers lowercase_ = [int(0.5 * n * (n + 1)) for n in range(1, 101)] def _snake_case( ) -> int: '''simple docstring''' A__ = os.path.dirname(os.path.realpath(SCREAMING_SNAKE_CASE__...
7
0
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() def __UpperCamelCase...
367
from .glue import GlueDataset, GlueDataTrainingArguments from .language_modeling import ( LineByLineTextDataset, LineByLineWithRefDataset, LineByLineWithSOPTextDataset, TextDataset, TextDatasetForNextSentencePrediction, ) from .squad import SquadDataset, SquadDataTrainingArguments
90
0
'''simple docstring''' from __future__ import annotations from typing import Any class _lowercase ( UpperCAmelCase__ ): '''simple docstring''' pass class _lowercase : '''simple docstring''' def __init__( self : str ...
229
'''simple docstring''' import numpy as np import qiskit def UpperCamelCase_ ( snake_case_ : int = 8 , snake_case_ : int | None = None ) -> str: '''simple docstring''' __lowerCAmelCase = np.random.default_rng(see...
229
1
# Copyright 2021 The HuggingFace 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.0 # # Unless...
354
from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tens...
125
0
_lowerCAmelCase : Optional[Any] = 65_521 def __snake_case ( _lowerCAmelCase : str ) -> int: A_ : str = 1 A_ : List[str] = 0 for plain_chr in plain_text: A_ : Optional[Any] = (a + ord(_lowerCAmelCase )) % MOD_ADLER A_ ...
300
from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature from ....file_utils import Pa...
300
1
'''simple docstring''' from math import factorial def __magic_name__ ( __UpperCAmelCase = 100 ) -> int: '''simple docstring''' return sum(map(__UpperCAmelCase, str(factorial(__UpperCAmelCase ) ) ) ) if __name__ == "__main__": print(solution(int(input('Enter t...
72
'''simple docstring''' import pytest import datasets # Import fixture modules as plugins a : int = ['tests.fixtures.files', 'tests.fixtures.hub', 'tests.fixtures.fsspec'] def __magic_name__ ( __UpperCAmelCase, __UpperCAmelCase ) -> Tuple: '''simple docstring''' for it...
72
1
'''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_o...
31
'''simple docstring''' import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow UpperCAmelCase_ = logging.getLogger() @unittest.skip("""Temporarily disab...
346
0
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class __magic_name__ ( __UpperCAmelCase ): def __init__( self : Optional[int] , snake_case__ ...
351
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.set_verbo...
172
0
"""simple docstring""" from math import factorial def _SCREAMING_SNAKE_CASE (__lowerCAmelCase = 1_00 ) -> int: '''simple docstring''' return sum(int(UpperCamelCase__ ) for x in str(factorial(UpperCamelCase__ ) ) ) if __name__ == "__main__...
136
class __lowerCAmelCase : """simple docstring""" def __init__( self ) -> Any: '''simple docstring''' __lowerCamelCase = 0 __lowerCamelCase = 0 __lowerCamelCase = {} def lowercase_...
90
0
import argparse import os import re import tensorflow as tf import torch from transformers import BertConfig, BertModel from transformers.utils import logging logging.set_verbosity_info() lowercase_ = logging.get_logger(__name__) def __lowerCAmelCase ( __SCREAMING_SNAKE_CASE : Opt...
20
# 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.0 # # Unless required by appl...
20
1
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_utils import FrozenDi...
38
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case_ : Union[str, Any] = { "configuration_mask2former": [ "MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "M...
125
0
import os import sys import unittest lowercase : Tuple = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, fin...
151
import qiskit def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : int = 2) -> qiskit.result.counts.Counts: '''simple docstring''' __UpperCamelCase : List[str] = qubits # Using Aer's simulator __UpperCamelCase : i...
151
1
"""simple docstring""" from abc import ABC, abstractmethod from typing import List, Optional class __snake_case ( _lowercase): def __init__( self : str ): """simple docstring""" self.test() def SCREAMING_SNAKE_CASE ( self : ...
72
"""simple docstring""" from ....configuration_utils import PretrainedConfig from ....utils import logging lowerCAmelCase__ = logging.get_logger(__name__) # TODO: upload to AWS lowerCAmelCase__ = { '''yjernite/retribert-base-uncased''': ( '''https://huggingface.co/yjernite/re...
72
1
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET...
301
import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput def lowerCamelCase__ ...
301
1
from typing import Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention from ...modeling_utils i...
283
"""simple docstring""" import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCL...
172
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase_ : Dict = logging.get_logger(__name__) UpperCamelCase_ : Union...
142
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase_ : List[Any] = { '''configuration_convbert''': ['''CONVBERT...
142
1
import os import sys import unittest lowercase : Any = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, find...
20
import contextlib import os import sqlitea import pytest from datasets import Dataset, Features, Value from datasets.io.sql import SqlDatasetReader, SqlDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases, require_sqlalchemy def _snake_case( SCREAMING_SN...
20
1
"""simple docstring""" import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def a__ ( ): SCREAMING_SNAKE_CASE_ : Dict = ArgumentParser( descripti...
362
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class __lowercase : """simple docstring""" _UpperCAmelCase = 42 ...
162
0
'''simple docstring''' import pytest from datasets.splits import SplitDict, SplitInfo from datasets.utils.py_utils import asdict @pytest.mark.parametrize( 'split_dict' , [ SplitDict(), SplitDict({'train': SplitInfo(name='train' , num_bytes=13_37 , num_exam...
151
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_mul...
151
1
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils import is_xformers_availab...
353
"""simple docstring""" from pathlib import Path import fire from tqdm import tqdm def A_ ( _lowerCAmelCase : str="ro", _lowerCAmelCase : Optional[Any]="en", _lowerCAmelCase : Union[str, Any]="wmt16", _lowerCAmelCase : int=None ): """simple...
153
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available, ) SCREAMING_SNAKE_CASE_ = { '''configuration_speecht5''': [ '''SPEECHT5_PRETRAINED_CONFIG_ARCHI...
301
"""simple docstring""" def lowercase (_lowerCAmelCase ): __lowerCAmelCase = [[0 for _ in range(_lowerCAmelCase )] for _ in range(m + 1 )] for i in range(m + 1 ): __lowerCAmelCase = 1 for n in range(m + 1 ): for k in range(1 , _lowe...
301
1
from __future__ import annotations import bisect def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase, _UpperCAmelCase = 0, _UpperCAmelCase = -1 ) -> int: '''simple docstring''' if hi < 0: lowerCAmelCase : str = len(_UpperCAmelCase ) while lo...
323
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A : List[Any] = { '''configuration_xlm_roberta'''...
323
1
_A : Optional[Any] = {'a': ['c', 'b'], 'b': ['d', 'e'], 'c': [], 'd': [], 'e': []} _A : List[Any] = ['a', 'b', 'c', 'd', 'e'] def _a ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ) -> Tuple: """simple docstring""" lowerCamelCase__ : Li...
142
from __future__ import annotations from typing import Any class __SCREAMING_SNAKE_CASE : def __init__( self : Tuple , A : int = 6 ) ->None: lowerCamelCase__ : Node | None = None lowerCamelCase__ : Node | None = ...
142
1
'''simple docstring''' 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 ...
365
'''simple docstring''' import copy import random from transformers import CLIPTokenizer class UpperCamelCase ( a_ ): """simple docstring""" def __init__( self : Union[str, Any] , *UpperCAmelCase_ : Dict , **UpperCAmelCase_ : Any): """s...
345
0
'''simple docstring''' import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCamelCase_ (unittest.TestC...
31
'''simple docstring''' from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class A__ : lowercase = 42 lowercase = None lowercase = None def...
162
0
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, sl...
331
'''simple docstring''' def a__ ( a__ ): """simple docstring""" __SCREAMING_SNAKE_CASE = len(a__ ) while cur > 1: # Find the maximum number in arr __SCREAMING_SNAKE_CASE = arr.index(max(arr[0:cur] ) ) # Reverse from...
331
1
import re from filelock import FileLock try: import nltk __lowerCAmelCase : str = True except (ImportError, ModuleNotFoundError): __lowerCAmelCase : Tuple = False if NLTK_AVAILABLE: with FileLock('.lock') as lock: nltk.download('punkt', qu...
88
"""simple docstring""" def a__ ( _SCREAMING_SNAKE_CASE = 1_000 ): """simple docstring""" return sum(2 * a * ((a - 1) // 2) for a in range(3 , n + 1 ) ) if __name__ == "__main__": print(solution())
153
0
"""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/LIC...
365
"""simple docstring""" import os import unicodedata 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 SPIECE_UNDERLINE, logging __A = logging.get_l...
341
0
'''simple docstring''' from __future__ import annotations import bisect def __A ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ = 0 , lowerCamelCase_ = -1 ): """simple docstring""" if hi < 0: SCREAMING_SNAKE_CASE : Any ...
323
'''simple docstring''' from typing import Optional from .. import Features, NamedSplit from ..packaged_modules.text.text import Text from ..utils.typing import NestedDataStructureLike, PathLike from .abc import AbstractDatasetReader class UpperCamelCase__ ( lowercase_ ): """simple docst...
323
1
'''simple docstring''' import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis from lavis.models import load_model_and_preprocess from PIL import Image ...
55
'''simple docstring''' import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def a_ ( ): lowerCAmelCase = ArgumentParser( description=( 'PyTorch T...
55
1
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE :Optional[Any] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE :str = { 'huggingface/time-series-transformer-tourism-monthly': ( ...
15
from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig UpperCamelCase_ = { '''susnato/ernie-m-base_pytorch''': '''https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json''', '''susnato/ernie-m-large_pytorch''': '''htt...
345
0
"""simple docstring""" import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def _snake_case ( UpperCAmelCase_ : Optional[Any] , UpperCAmelCase_ : Optional[An...
363
"""simple docstring""" from typing import Any class a : """simple docstring""" def __init__( self: List[Any] , UpperCamelCase: Any ): """simple docstring""" A__ = data A__ = None ...
69
0
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, slo...
331
'''simple docstring''' import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex from .utils import requ...
331
1
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def UpperCamelCase ( ) -> Dict: '''simple docstring''' lowercase_ :str = { '''repo_name''': ['''test...
361
# We ignore warnings about stepping the scheduler since we step it ourselves during gradient accumulation import warnings from .state import AcceleratorState, GradientState warnings.filterwarnings("ignore", category=UserWarning, module="torch.optim.lr_scheduler") class UpperCamelCas...
252
0
"""simple docstring""" def _A ( lowercase = "The quick brown fox jumps over the lazy dog" , ): """simple docstring""" a =set() # Replace all the whitespace in our sentence a =input_str.replace(''' ''' , '''''' ) for alpha in ...
81
'''simple docstring''' import uuid from typing import Any, Dict, List, Optional, Union from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf if is_torch_available(): import torch __...
341
0
'''simple docstring''' import warnings from functools import wraps from typing import Callable def SCREAMING_SNAKE_CASE_ (UpperCamelCase ): @wraps(UpperCamelCase ) def _inner_fn(*UpperCamelCase , **UpperCamelCase ): warnings....
351
'''simple docstring''' from collections import deque class _lowercase : def __init__( self: int , UpperCamelCase__: str , UpperCamelCase__: int , UpperCamelCase__: int ): lowerCamelCase__ : int ...
129
0
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer a_ : Optional[Any] = {"""vocab_file""": """vocab.txt""", """tokeni...
55
'''simple docstring''' from __future__ import annotations from fractions import Fraction def __snake_case ( UpperCAmelCase_ : int , UpperCAmelCase_ : int ): return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) ...
55
1
def _A ( SCREAMING_SNAKE_CASE : int ): """simple docstring""" a__ : Any =(1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def _A ( SCREAMING_SNAKE_CASE : int = 5_000 ): """simple docstring""" a__ : Optiona...
148
from math import acos, sin from typing import List, Tuple, Union import numpy as np import torch from PIL import Image from ...models import AutoencoderKL, UNetaDConditionModel from ...schedulers import DDIMScheduler, DDPMScheduler from ...utils import randn_tensor from ..pipeline_utils import A...
148
1
"""simple docstring""" from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm...
78
"""simple docstring""" import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py __UpperCamelCase = '''src/transformers''' # This ...
69
0
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, OptionalDependencyNotAvailable, is_flax_available, is_k_diffusion_available, is_k_diffusion_version, is_onn...
193
import os import unittest from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, BertTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.test...
193
1
'''simple docstring''' import qiskit def lowerCamelCase (_SCREAMING_SNAKE_CASE : int , _SCREAMING_SNAKE_CASE : int ): __a : Any = qiskit.Aer.get_backend('aer_simulator' ) __a : int = qiskit.QuantumCircuit(4 , 2 ) ...
27
def __lowerCamelCase ( lowerCamelCase__ : Any , lowerCamelCase__ : Optional[int] ): '''simple docstring''' return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def __lowerCamelCase ( lowerCamelCase__ : List[str] , lowerCamelCase__ ...
252
0
"""simple docstring""" import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debug.me...
226
"""simple docstring""" import sys import turtle def lowercase ( A_ , A_ )-> tuple[float, float]: '''simple docstring''' return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def lowercase ( A_ , A_ , A_ , A_ , ...
226
1
import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version lowerCAmelCase__ :Union[str, Any] = version.parse(importlib_metadata.version('''nltk''')) if NLTK_VERSION >= version.Version('''3.6.4'''): from nltk import word_tokenize...
329
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ ="""Speech2TextFeatureExtractor""" snake_case_ ="""Speech2TextTokenizer""" def __init__(self ,__lo...
129
0
'''simple docstring''' from math import sqrt def UpperCAmelCase ( lowerCamelCase_ :Optional[int] ): '''simple docstring''' snake_case_ : Any = 0 for i in range(1 , int(sqrt(lowercase__ ) + 1 ) ): if n % i == 0 and i != sqrt(lowercase__ ): total ...
362
'''simple docstring''' def UpperCAmelCase ( lowerCamelCase_ :list ): '''simple docstring''' if len(lowerCamelCase_ ) <= 1: return lst snake_case_ : Union[str, Any] = 1 while i < len(lowerCamelCase_ ): if lst[i - 1] <= lst[i]: i += 1 else: ...
8
0
"""simple docstring""" def UpperCamelCase__ ( lowercase__ : str ): snake_case : Dict = 0 for ch in input_str: snake_case : List[str] = ord(lowercase__ ) snake_case : Tuple = pow(2 , lowercase__ ) # If we already turn...
148
"""simple docstring""" import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = { "facebook/mask2former-swin-small-coco-instance": ( "https://huggingface....
148
1
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_common ...
360
'''simple docstring''' import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def _UpperCamelCase...
83
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__: str = { 'configuration_owlvit': [ ...
193
class SCREAMING_SNAKE_CASE__ : def __init__( self,__lowerCamelCase ): A__ = set_counts A__ = max(__lowerCamelCase ) A__ = len(__lowerCamelCase ) A__ = [1] * num_sets A__ = ...
193
1
import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCase = { '''facebook/encodec_24khz''': '''https://huggingface.co/fa...
350
import os def __lowerCamelCase ( __magic_name__ : str = "input.txt" ): with open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) ) as input_file: a__: str =[ [int(__magic_name__ ) for element in line.split("," )] ...
42
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __A ={ "configuration_blip": [ "BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "BlipConfig", ...
226
import argparse import shlex import runhouse as rh if __name__ == "__main__": # Refer to https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup for cloud access # setup instructions, if using on-demand hardware # If user passes --user <user> --hos...
226
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase = logging.get_logger(__name__) _lowerCAmelCase = { 'google/vivit-b-16x2-kinetics400': ( 'https://huggingface.co/google/vivit-b-16x2-kinetics400/resolv...
356
'''simple docstring''' from __future__ import annotations from fractions import Fraction def UpperCamelCase ( a , a ) -> bool: '''simple docstring''' return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) def Up...
98
0
"""simple docstring""" import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) A : List[str] = { "sample_size": 3_2, "in_channels": 3, "out_channels": 3, "layers_per_block": 2, "num_cla...
57
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as ...
8
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_albert import...
351
from json import JSONDecodeError # Workaround for requests.exceptions.JSONDecodeError import requests def UpperCAmelCase_ ( __UpperCAmelCase : str = "isbn/0140328726" ) -> dict: SCREAMING_SNAKE_CASE_ = olid.strip().strip('/' ) # Remove leading/trailing whit...
210
0
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnal...
251
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : int = logging.get_logger(__name__) snake_case_ : Optional[Any] = { 'RUCAIBox/mvp': 'https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json', } c...
83
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer a__ : List[Any] = {'''vocab_file''': '''vocab.txt''', '''tokenizer_file''': '''tokenizer.json...
19
import unittest import numpy as np import torch from diffusers import DDIMPipeline, DDIMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, slow, torch_device from ..pipeline_params import UNCONDITIONAL_IMAGE_GENERATION_BATCH_PARAMS, UNCONDITIONAL_IMAGE_GENER...
19
1
from __future__ import annotations class _lowerCamelCase: def __init__( self, lowerCamelCase=None) -> Optional[int]: """simple docstring""" _lowercase : Optional[Any] = data _lowercase : List[str] = None ...
21
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @...
42
0
'''simple docstring''' from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets lowerCamelCase : List[Any] = "\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding},\n ...
371
'''simple docstring''' from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets lowerCamelCase : List[Any] = "\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding},\n ...
114
0
def _a ( SCREAMING_SNAKE_CASE_ : List[str] ): __lowerCAmelCase , __lowerCAmelCase = [], [] while len(SCREAMING_SNAKE_CASE_ ) > 1: __lowerCAmelCase , __lowerCAmelCase = min(SCREAMING_SNAKE_CASE_ ), max(SCREAMING_SNAKE_CASE_ ...
92
"""simple docstring""" import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ : Optional[int] = logging.get_logger(__name__) class snake_case ( __UpperCAmelCase ): ...
98
0
import itertools import os from collections import Counter, defaultdict from concurrent.futures import ThreadPoolExecutor, as_completed import numpy as np import datasets from .execute import check_correctness lowerCAmelCase__ : Tuple ="\\n@misc{chen2021evaluating,\n title={Evalu...
350
def a__ ( A__ ): SCREAMING_SNAKE_CASE_ : Optional[Any] = 0 SCREAMING_SNAKE_CASE_ : Union[str, Any] = len(A__ ) for i in range(n - 1 ): for j in range(i + 1, A__ ): if arr[i] > arr[j]: num_inversions...
162
0
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, ...
40
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTesterMixin if...
210
0
'''simple docstring''' import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex fr...
363
'''simple docstring''' import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def ...
249
0
import os import re 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 __A =logging.get_logger(__name__) __A ={'''vocab_file''': '''spiece.model'''} __A ...
19
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A ={'''configuration_xglm''': ['''XGLM_PRETRAINED_CONFIG_ARCHIVE_MAP'''...
19
1
"""simple docstring""" from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class _A : snake_case__ : int snake_case__ : Node | ...
32
"""simple docstring""" def UpperCAmelCase__ ( lowerCAmelCase__ :int ) -> bool: '''simple docstring''' lowercase = n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(2_7)) print(perfect_cub...
32
1
"""simple docstring""" import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_a...
33
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_d...
114
0
def _SCREAMING_SNAKE_CASE ( lowercase : float , lowercase : float , lowercase : int ): '''simple docstring''' if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: ...
370
import argparse import os import sys from unittest.mock import patch import pytorch_lightning as pl import timeout_decorator import torch from distillation import SummarizationDistiller, distill_main from finetune import SummarizationModule, main from transformers import MarianMTModel from trans...
208
0
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import torch cla...
63
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase__ ) -> list[list[float]]: A_ = [] for data in source_data: for i, el in enumerate(UpperCAmelCase__ ): if len(UpperCAmelCase__ ) < i + 1: data_lists.appen...
162
0
import pprint import requests A : int = 'https://zenquotes.io/api' def UpperCamelCase ( ) -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def UpperCamelCase ( ) -> list: ...
353
A : Union[str, Any] = [ (1_0_0_0, 'M'), (9_0_0, 'CM'), (5_0_0, 'D'), (4_0_0, 'CD'), (1_0_0, 'C'), (9_0, 'XC'), (5_0, 'L'), (4_0, 'XL'), (1_0, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I'), ] def UpperCamelCase ( __mag...
146
0
import inspect import unittest from transformers import ViTMSNConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester...
95
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except Opt...
249
0
"""simple docstring""" from queue import Queue from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from ..models.auto import AutoTokenizer class UpperCamelCase_ : """simple docstring""" def UpperCAmelCase_ ( self : Tuple , UpperCAmelCase__ : Lis...
357
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMSched...
195
0