code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py __lowerC...
440
'''simple docstring''' # Copyright 2023 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 # ...
440
1
from collections import deque def SCREAMING_SNAKE_CASE_ ( UpperCAmelCase_ : Any ) -> Union[str, Any]: SCREAMING_SNAKE_CASE_ : Optional[int] =len(UpperCAmelCase_ ) SCREAMING_SNAKE_CASE_ : Any =deque() SCREAMING_SNAKE_CASE_ : ...
431
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration _lowercase = { """tiny.en""": """https://openaipublic.azureedge.net/main/whisper/models/...
431
1
"""simple docstring""" def _a ( UpperCAmelCase__ ) -> int: if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) or number < 0: raise ValueError('''Input must be a non-negative integer''' ) __SCREAMING_SNAKE_CASE = 0 while number: ...
482
"""simple docstring""" import argparse import requests import torch from PIL import Image from transformers import ViTMAEConfig, ViTMAEForPreTraining, ViTMAEImageProcessor def _a ( UpperCAmelCase__ ) -> Dict: if "cls_token" in name: __SCREAMING_SNAKE_CASE = ...
482
1
'''simple docstring''' 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 i...
707
import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class UpperCAmelCase__ ( __snake_case ): __snake_case : Optional[Any] = "M-CLIP" def __init__( self ,A__=1024 ,A__=768 ,**A__ ): _A...
332
0
'''simple docstring''' def __UpperCAmelCase ( ) -> Optional[Any]: for n in range(1 , 1_000_000): yield n * (n + 1) // 2 def __UpperCAmelCase ( lowerCamelCase_) -> List[Any]: UpperCamelCase__ : List[str] = 1 Uppe...
596
from __future__ import annotations import bisect def a_ ( __magic_name__ , __magic_name__ , __magic_name__ = 0 , __magic_name__ = -1 ) -> int: """simple docstring""" if hi < 0: snake_case : Optional[int] = len(__mag...
598
0
# 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 ...
127
import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_: Optional[int] = logging.get_logger(__name__) lowercase_: Optional[int] = { 'facebook/encodec_24khz': 'https://hugging...
127
1
"""simple docstring""" from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available():...
680
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCAmelCase__ : Union[str, Any] = TypeVar('T') UpperCAmelCase__ : List[Any] = TypeVar('U') class lowerCAmelCase_ ...
223
0
"""simple docstring""" import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home __lowercase : Tuple = HUGGINGFACE_HUB_CACHE __lowercase : Tuple = """config.json""" __lowercase : Any = """diffusion_pytorch_model.bin""" __lowercase : str ...
714
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __lowercase : Tuple = { """configuration_squeezebert""": [ """SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Squ...
66
0
'''simple docstring''' from __future__ import annotations from typing import Any class _A : def __init__( self : str , __magic_name__ : int , __magic_name__ : int , __magic_name__ : float = 0 ) -> None: """simple d...
26
'''simple docstring''' from __future__ import annotations def _a ( _lowerCamelCase , _lowerCamelCase = None , _lowerCamelCase = None ) -> None: """simple docstring""" if start is None: __snake_case : Optional[Any] ...
26
1
from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerate_available, is_accelera...
467
from __future__ import annotations import pandas as pd def __SCREAMING_SNAKE_CASE ( lowerCAmelCase: list[int] , lowerCAmelCase: list[int] , lowerCAmelCase: int ) -> list[int]: _UpperCAmelCase : List[Any] = [0] * no_of_processes _UpperCAmelCase : Dict...
467
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A = logging.get_logger(__name__) A = { """google/vivit-b-16x2-kinetics400""": ( """https://huggingface.co/google/vivit-b-16x2-kinetics400/resolve/main/config.json""" ), ...
77
'''simple docstring''' from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_star...
330
0
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, re...
32
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class _lowercase ( unittest.TestCase ): de...
32
1
def __UpperCamelCase ( lowercase__ : int , lowercase__ : int ) -> int: '''simple docstring''' return int((input_a, input_a).count(0 ) == 0 ) def __UpperCamelCase ( ) -> None: '''simple docstring''' assert and_gate(...
600
import json import os import unittest from typing import Tuple from transformers import WavaVecaPhonemeCTCTokenizer from transformers.models.wavaveca.tokenization_wavaveca import VOCAB_FILES_NAMES from transformers.models.wavaveca_phoneme.tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizerOutput fro...
600
1
import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict lowerCamelCase_ = namedtuple( "_TestCommandArgs", [ "dataset", ...
588
import math def UpperCAmelCase_ ( __UpperCamelCase ): SCREAMING_SNAKE_CASE__ =[] SCREAMING_SNAKE_CASE__ =2 SCREAMING_SNAKE_CASE__ =int(math.sqrt(__UpperCamelCase ) ) # Size of every segment SCREAMING_SNAKE_CASE__ =[True] * (end + 1) SCREAMI...
588
1
'''simple docstring''' from __future__ import annotations from typing import Generic, TypeVar SCREAMING_SNAKE_CASE_ = TypeVar('T') class a ( Generic[T] ): """simple docstring""" def __init__( self , snake_case_ ): '''simple docstring''' __Up...
523
'''simple docstring''' lowerCAmelCase : Optional[Any] = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } def A_( A : dict , A : str , A :...
3
0
'''simple docstring''' import numpy as np def lowerCAmelCase( a__ : Union[str, Any] , a__ : Tuple , a__ : Dict , a__ : List[Any] , a__ : Dict ): '''simple docstring''' lowerCamelCase__ = int(n...
700
'''simple docstring''' import pytest import datasets.config from datasets.utils.info_utils import is_small_dataset @pytest.mark.parametrize("dataset_size" , [None, 400 * 2**20, 600 * 2**20] ) @pytest.mark.parametrize("input_in_memory_max_size" , ["default", 0, 100 * 2**20, 900 * 2**20] ) def...
426
0
'''simple docstring''' import re def _lowerCAmelCase (_lowercase ): """simple docstring""" if len(re.findall("[ATCG]" , lowercase__ ) ) != len(lowercase__ ): raise ValueError("Invalid Strand" ) return dna.translate(dna.maket...
331
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension ...
630
0
import argparse import re import numpy as np import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SamConfig, SamImageProcessor, SamModel, SamProcessor, SamVisionConfig, ) __A = { """iou_prediction_...
716
"""simple docstring""" import torch import torch.nn as nn from transformers.modeling_utils import ModuleUtilsMixin from transformers.models.ta.modeling_ta import TaBlock, TaConfig, TaLayerNorm from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin cl...
173
0
import numpy as np def A__ ( SCREAMING_SNAKE_CASE_ : np.ndarray , SCREAMING_SNAKE_CASE_ : float ) -> np.ndarray: """simple docstring""" return np.where(vector > 0 , SCREAMING_SNAKE_CASE_ , (alpha * (np.exp(SCREAMING_SNAKE_CASE_ ) - 1)) ) i...
32
'''simple docstring''' import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torc...
440
0
import unittest from transformers.testing_utils import CaptureStdout from transformers.tools.python_interpreter import evaluate def __A ( _A ): """simple docstring""" return x + 2 class A_ ( unittest.TestCase ): def _UpperCAmelCase ( self : Any ...
525
import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @require_sentencepiece @require_t...
525
1
'''simple docstring''' import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .t...
502
'''simple docstring''' import requests _SCREAMING_SNAKE_CASE = '''YOUR API KEY''' def _lowerCAmelCase ( lowerCamelCase_ : str , lowerCamelCase_ : str = giphy_api_key ): __lowercase = '''+'''.join(query.split() ) __lowercase ...
502
1
from __future__ import annotations from collections.abc import MutableSequence class _UpperCAmelCase : def __init__( self , a__ , a__): if len(lowercase_) != degree + 1: raise ValueError( '''The number of coefficients should be equal to the degr...
704
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _lowercase = { "configuration_mobilevit": ["MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MobileViTConfig", "MobileViTOnnxC...
526
0
import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transformers from transformers import ( ...
154
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { '''google/fnet-base''': '''https://huggingface.co/google/fnet-base/resolve/main/config.json''', '''google/fnet-large''': '''https://huggi...
154
1
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 FlaxTimestepEmbed...
715
import glob import os import random from string import ascii_lowercase, digits import cva lowerCamelCase__ = """""" lowerCamelCase__ = """""" lowerCamelCase__ = """""" lowerCamelCase__ = 1 # (0 is vertical, 1 is horizontal) def UpperCamelCa...
291
0
def __UpperCAmelCase ( __A ) -> float: '''simple docstring''' if edge <= 0 or not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): raise ValueError("Length must be a positive." ) return 3 * ((2_5 + 1_0 * (5 ** (1...
475
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__ : List[Any] = logging.get_logger(__name__) SCREAMING_SNAKE_...
311
0
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase = logging.get_logger(__name__) ...
713
class __lowerCamelCase : """simple docstring""" def __init__( self : Optional[Any] , SCREAMING_SNAKE_CASE__ : int ) -> List[str]: lowerCAmelCase__ = n lowerCAmelCase__ = [None] * self.n lowerCAmelCase__ = 0 # index ...
125
0
"""simple docstring""" import os __lowerCAmelCase : List[str] = {'''I''': 1, '''V''': 5, '''X''': 10, '''L''': 50, '''C''': 100, '''D''': 500, '''M''': 1000} def __lowerCAmelCase ( __UpperCamelCase : str ): '''simple docstring''' ...
58
"""simple docstring""" import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def UpperCAmelCase ( a__ , a__=None ): '''simple docstring''' lowerCAmelCase :str = No...
553
0
def lowercase_ (A : int , A : list ): _enforce_args(A , A ) if n == 0: return 0 snake_case__ : Any = float('-inf' ) for i in range(1 , n + 1 ): snake_case__ : List[str] = max( ...
243
# Copyright 2023 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 required by appli...
243
1
'''simple docstring''' def _UpperCamelCase ( __UpperCamelCase ) -> list: if len(__UpperCamelCase ) <= 1: return [tuple(__UpperCamelCase )] lowerCamelCase_ = [] def generate(__UpperCamelCase ,__UpperCamelCase ): lowerCamelCase_ = [0] * n ...
42
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('>=', '4.25.0')): raise OptionalDependencyNotAvailable() exce...
64
0
import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() UpperCAmelCase__ = logging....
704
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, PixaStructTextConfig, ...
362
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Tuple = logging.get_logger(__name__) A_ : Dict = {'''ctrl''': '''https://huggingface.co/ctrl/resolve/main/config.json'''} class __snake_case ( lowerCamelCase__ ):...
38
from timeit import timeit _lowerCAmelCase : Tuple = { '''MALAYALAM''': True, '''String''': False, '''rotor''': True, '''level''': True, '''A''': True, '''BB''': True, '''ABC''': False, '''amanaplanacanalpanama''': True, # "a man a plan a canal panama" } # En...
454
0
from math import loga def __lowerCamelCase ( __a : int ) -> int: if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(__a , __a ): raise TypeError("Input value must be a 'int' type" ) return 0 if (a == 0) else int(loga(a & -a ) ) if __n...
594
import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print("Googling.....") lowerCAmelCase__ = "https://www.google.com/search?q=" + " ".join(sys.argv[1:]) lowerCAmelCase__ = requests.get(url, header...
594
1
"""simple docstring""" import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlowBenchmark, Tens...
346
"""simple docstring""" def a__ ( __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ) -> float: if principal <= 0: raise Exception("Principal borrowed must be > 0" ) if rate_per_annum < 0: raise Exception("Rate of interest m...
346
1
"""simple docstring""" import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils imp...
704
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices a :List[Any] = logging.get_logger(__name__) a :Optional[int] = { "microsoft/focalnet-tiny":...
12
0
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 SCREAMING_SNAKE_CASE ( UpperCAme...
605
"""simple docstring""" from __future__ import annotations import bisect def _lowerCAmelCase ( lowerCamelCase__ : list[int], lowerCamelCase__ : int, lowerCamelCase__ : int = 0, lowerCamelCase__ : int = -1 ) -> int: if hi < 0: _SCREAMING_SNAKE_CASE :...
572
0
from __future__ import annotations import requests def a__ ( snake_case__ ) -> Union[str, Any]: lowerCamelCase = F'https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty' return requests.get(A_ ).json() def a__ ( snake_case__ = ...
710
"""simple docstring""" def a__ ( snake_case__ ) -> list: if n_term == "": return [] lowerCamelCase = [] for temp in range(int(snake_case__ ) ): series.append(F'1/{temp + 1}' if series else """1""" ) return series if __name__ == "_...
533
0
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTes...
205
import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class __lowerCAmelCase ( __magic_name_...
469
0
'''simple docstring''' from numpy import exp, pi, sqrt def UpperCamelCase_ ( A__ , A__ = 0.0 , A__ = 1.0 ): return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu) ** 2) / (2 * sigma**2) ) if __name__ == "__main__": import doctest doctest.testmod()
511
'''simple docstring''' import math def UpperCamelCase_ ( A__ ): a_ = [True] * n a_ = False a_ = False a_ = True for i in range(3 , int(n**0.5 + 1 ) , 2 ): a_ = i * 2 while index < n: a_ = False a_ = index + i ...
511
1
"""simple docstring""" import enum import warnings from ..tokenization_utils import TruncationStrategy 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 from ..models.auto.modeling_...
690
import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency __UpperCamelCase : Tuple = { 'E': 12.70, 'T': 9.06, 'A': 8.17, 'O': 7.51, 'I': 6.97, 'N': 6.75, 'S': 6.33, 'H': 6.09, 'R': 5.99, 'D': 4.25, 'L': 4.03, 'C':...
519
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/LICENSE-2.0 #...
425
'''simple docstring''' def _A ( A ,A ,A ,A ,A ) -> int: if index == number_of_items: return 0 lowercase : Optional[int] = 0 lowercase : Union[str, Any] = 0 lowercase : Dict = knapsack(A ,A ,A ,A ,index + ...
425
1
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logging, ...
79
'''simple docstring''' import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_commo...
120
0
from __future__ import annotations __UpperCAmelCase = "#" class SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self ): '''simple docstring''' snake_case: dict = {} def _UpperCamelCase ( self ...
700
'''simple docstring''' import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import numpy as np import pandas as pd from datasets import load_dataset import transformers from transformers import ( AutoConfig, BartForSeq...
692
0
from typing import List from .keymap import KEYMAP, get_character def __SCREAMING_SNAKE_CASE (SCREAMING_SNAKE_CASE__ ): def decorator(SCREAMING_SNAKE_CASE__ ): snake_case_ = getattr(SCREAMING_SNAKE_CASE__ , '''handle_key''' , [] ) handle +...
39
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Any = logging.get_logger(__name__) _a : List[Any] = { "microsoft/git-base": "https://huggingface.co/microsoft/git-...
168
0
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, slow from...
64
class _a : '''simple docstring''' def __init__( self ): A__ : str = """""" A__ : Any = """""" A__ : List[Any] = [] def __A ( self , A__ , A__ ): if m == -1: return n + 1 ...
64
1
"""simple docstring""" import argparse import os import re import packaging.version _A = "examples/" _A = { "examples": (re.compile(r"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init": (re.compile(r"^__version__\s+=\s+\"([^\"]+)\...
505
"""simple docstring""" import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _A = logging.getLogger(__name__) def lowercase () -> List[str]: '''simple docstring''' __UpperCamelCase = argpar...
505
1
import os from typing import Dict, List, Tuple, TypeVar, Union lowercase_ = TypeVar("T") lowercase_ = Union[List[T], Tuple[T, ...]] lowercase_ = Union[T, List[T], Dict[str, T]] lowercase_ = Union[str, bytes, os.PathLike]
390
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTRACTOR_MAPPING, AutoConfig, AutoFeatureExtractor, WavaVecaConfig, WavaVecaFeatureExtractor, ) from transformers.testing_utils import DUMMY_UN...
390
1
'''simple docstring''' # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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 # # ...
13
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : Tuple = logging.get_logger(__name__) A__ : Dict = { """RWKV/rwkv-4-169m-pile""": """https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json""", """RWKV/r...
13
1
import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingStrategy, logging from .to...
704
import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from transformers.utils import W...
541
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __a: Union[str, Any] = logging.get_logger(__name__) __a: Tuple = { '''xlm-mlm-en-2048''': '''https:/...
108
# flake8: noqa # Lint as: python3 from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, format_table, ...
311
0
import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) ...
231
import unittest from transformers import DonutProcessor _snake_case = '''naver-clova-ix/donut-base''' class UpperCAmelCase_ ( unittest.TestCase ): '''simple docstring''' def _snake_case ( self ): """simple docstring""" lowerC...
231
1
from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCamelCase = logging.get_logger(__name__) # TODO: upload to AWS UpperCamelCase = { 'yjernite/retribert-base-uncased': ( 'https://huggingface.co/yjernite/retribert-base-uncased/resolve/m...
61
"""simple docstring""" snake_case_ : List[Any] = """ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/""" def lowercase_ ( _lowercase : bytes ): '''simple docstring''' if not isinstance(_lowercase , _lowercase ): UpperCAmelCa...
595
0
"""simple docstring""" def UpperCAmelCase ( a_ = 100 ): '''simple docstring''' lowerCamelCase : Optional[Any] = set() lowerCamelCase : List[str] = 0 lowerCamelCase : str = n + 1 # maximum limit for a in range(2, a_ ): for ...
710
"""simple docstring""" import os import pytest from attr import dataclass _A = 'us-east-1' # defaults region @dataclass class _lowercase : lowercase_ = 42 lowercase_ = 'arn:aws:iam::558105141721:role/sagemaker_execution_role' lowercase_ = { 'task_name...
133
0
def UpperCamelCase__ ( _A: float ): '''simple docstring''' if edge <= 0 or not isinstance(_A , _A ): raise ValueError("""Length must be a positive.""" ) return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2)) * (edge**2) def UpperCamelCase__ ...
479
import math from collections.abc import Iterator from itertools import takewhile def UpperCamelCase__ ( _A: int ): '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: ...
479
1
"""simple docstring""" import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokeni...
711
"""simple docstring""" import pandas as pd from matplotlib import pyplot as plt from sklearn.linear_model import LinearRegression # Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split # Fitting Polynomial Regression to the dataset from sklearn.prepr...
690
0
import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHECKING: ...
67
import math import unittest from transformers import BioGptConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common impor...
39
0
__a : dict[str, float] = { "km/h": 1.0, "m/s": 3.6, "mph": 1.6_0_9_3_4_4, "knot": 1.8_5_2, } __a : dict[str, float] = { "km/h": 1.0, "m/s": 0.2_7_7_7_7_7_7_7_8, "mph": 0.6_2_1_3_7_1_1_9_2, "knot": 0.5_3_9_9_5_6_8_0_3, } def a_ ( __snake_case ...
706
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_uti...
559
0
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TextClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, slow ...
63
"""simple docstring""" from math import ceil def __a ( a, a ): """simple docstring""" _a = list(range(0, a ) ) _a = [item for sublist in list(device_map.values() ) for item in sublist] # Duplicate check _a ...
388
0
import argparse lowercase__ : List[Any] = "docs/source/_static/js/custom.js" def A_ ( snake_case : int ) -> List[str]: '''simple docstring''' with open(snake_case , encoding='''utf-8''' , newline='''\n''' ) as f: __UpperCamelCa...
713
def A_ ( snake_case : int = 10 , snake_case : int = 1000 , snake_case : bool = True ) -> int: '''simple docstring''' assert ( isinstance(snake_case , snake_case ) and isinstance(snake_case , snake_case ) and isinst...
451
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ : List[str] = logging.get_logger(__name__) UpperCamelCase_ : Dict = { '''google/canine-s''': '''https://huggingface.co/google/canine-s/resolve/...
115
"""simple docstring""" import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope="session" ) def a__ ( ): ...
645
0
'''simple docstring''' import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller _UpperCAmelCase : List[str] = 3 def UpperCamelCase ( lowercase_ : int ) -> int: '''simple docstring''' print('''Generating primitive root of ...
720
'''simple docstring''' from typing import Dict, Iterable, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ( IM...
145
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __SCREAMING_SNAKE_CASE : Union[str, Any] ={ 'configuration_poolformer': [ 'POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MA...
135
'''simple docstring''' # Copyright 2022 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/LICENS...
135
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __lowerCamelCase : Optional[int] = logging.get_logger(__name__) class A__ ( __snake_case , __snake_case...
38
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 : str = { """camembert-base""": """h...
38
1
from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ConfigTester from .....
214
lowerCAmelCase : Dict = { '''A''': ['''B''', '''C''', '''E'''], '''B''': ['''A''', '''D''', '''E'''], '''C''': ['''A''', '''F''', '''G'''], '''D''': ['''B'''], '''E''': ['''A''', '''B''', '''D'''], '''F''': ['''C'''], '''G''': ['''C'''], } def _lowercase ...
214
1
import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformers.utils impor...
707
import json import os import torch from diffusers import UNetaDModel os.makedirs("""hub/hopper-medium-v2/unet/hor32""", exist_ok=True) os.makedirs("""hub/hopper-medium-v2/unet/hor128""", exist_ok=True) os.makedirs("""hub/hopper-medium-v2/value_function""", exist_ok=True) def SCREAMING_SNAKE_CA...
431
0
import math import flax.linen as nn import jax.numpy as jnp def lowerCamelCase__ ( lowercase , lowercase , lowercase = 1 , lowercase = 1 , lowercase = 1.0E4 , lowercase = False , lowercase = 1.0 , ): """simple docstring""" assert timesteps.ndim == 1, "Timesteps sh...
62
'''simple docstring''' import numpy as np class __a : def __init__( self : Optional[int] ): '''simple docstring''' __SCREAMING_SNAKE_CASE = (0, 0) __SCREAMING_SNAKE_CASE = None __SCREAMING_SNAKE_CASE = 0 __SCR...
109
0
import numpy as np import pandas as pd from sklearn.preprocessing import Normalizer from sklearn.svm import SVR from statsmodels.tsa.statespace.sarimax import SARIMAX def _snake_case ( __snake_case , __snake_case , __snake_case , __snake_case , __snake_case ) -> float:...
455
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from...
455
1
"""simple docstring""" import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node _a = 4 _a = 3 class _UpperCAme...
19
'''simple docstring''' import random from .binary_exp_mod import bin_exp_mod def UpperCamelCase_ ( snake_case_ : str , snake_case_ : List[str]=10_00 ) -> Dict: '''simple docstring''' if n < 2: return False if n % 2 == 0: return n == 2 # this means...
427
0
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForOb...
528
'''simple docstring''' import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class SCREAMING_SNAKE_CASE( A__ ):...
528
1
'''simple docstring''' import os from datetime import datetime as dt from github import Github lowerCAmelCase__ = [ '''good first issue''', '''good second issue''', '''good difficult issue''', '''enhancement''', '''new pipeline/model''', '''new scheduler''', '''wip''', ] ...
41
from __future__ import annotations from collections import Counter from random import random class _lowerCAmelCase : """simple docstring""" def __init__( self : Union[str, Any] ): """simple docstring""" UpperCamelCase = {} def __lowe...
282
0
import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class lowerCAmelCase : def __init__( self :str , _lowercase :List[Any]=2 , _lowercase :Union[str, Any]=3 , _lo...
717
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _snake_case = { """configuration_encodec""": [ """ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP""", """EncodecConfig""", ], """feature_extraction_e...
611
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase : Optional[Any] = logging.get_logger(__name__) lowerCamelCase : List[Any] = { 'google/canine-s': 'https://huggingface.co/google/canine-s/resolve/main/config.json', # See all ...
587
from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
587
1
"""simple docstring""" import math import unittest from transformers import BioGptConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_model...
366
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int = 600851475143 ) -> int: '''simple docstring''' try: __lowerCamelCase : Optional[Any] = int(_lowerCamelCase ) except (TypeError, ValueError): raise TypeError("Paramet...
366
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : Tuple =logging.get_logger(__name__) _lowerCAmelCase : Tuple ={ """naver-clova-ix/donut-base""": """https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json""", # See all Don...
113
import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EX...
113
1
import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class _UpperCamelCase ( __snake_case ): """simple docstring""" lowerCAmelCase = 'M-CLIP' def __init__( self , a__=1024 , a__=768 , **a__ ) -> List[Any]: ...
546
import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device from diffusers.utils.testing_utils import en...
546
1
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_availab...
297
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder lowercase_ = datasets.utils.logging.get_logger(__name__) class __lowerCAmelCase ( folder_based_builder.FolderBasedBuilderConfig ):...
291
0
"""simple docstring""" def UpperCAmelCase ( UpperCamelCase__ , UpperCamelCase__ ): """simple docstring""" _enforce_args(UpperCamelCase__ , UpperCamelCase__ ) if n == 0: return 0 A__ = float('-inf' )...
716
"""simple docstring""" import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor __lowerCamelCase = logging.get_logger(__name__) class UpperCamelCase__( __A ): def __init__( self ,*__UpperCAmelCase ,**__UpperCA...
536
0
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __magic_name__ ( unittest.TestCase ): """...
454
import functools def lowerCAmelCase__ ( _SCREAMING_SNAKE_CASE : str , _SCREAMING_SNAKE_CASE : str ): """simple docstring""" __a = len(_SCREAMING_SNAKE_CASE ) __a = len(_SCREAMING_SNAKE_CASE ) @functools.cache def min_distance(_SCREAMIN...
225
0
'''simple docstring''' 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 : Optional[...
631
'''simple docstring''' import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow _A : Union[str, Any] =False class _lowercase ( ...
631
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase : Any = { "configuration_distilbert": [ "DISTILBERT_PRETRAINED_CONFIG...
327
from ....configuration_utils import PretrainedConfig from ....utils import logging lowercase : Union[str, Any] = logging.get_logger(__name__) lowercase : Optional[int] = { "Visual-Attention-Network/van-base": ( "https://huggingface.co/Visual-Attention-Network/van-base/bl...
327
1
"""simple docstring""" import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def lowercase (snake_case__ : Union[str, Any] ) -> List[str]: '''simple docstring''' lowerCAmelCase = [ ...
708
"""simple docstring""" from collections import deque from math import floor from random import random from time import time class SCREAMING_SNAKE_CASE__ : def __init__( self : Union[str, Any] ): lowerCAmelCase = {} def __lowercase ( self ...
529
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/LICENSE-2....
640
'''simple docstring''' from ....utils import logging a : Optional[int] = logging.get_logger(__name__) class a ( _lowerCamelCase ): def __init__( self : int , lowercase_ : Tuple , lowercase_ : Any=None , lowercase_ ...
640
1
import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() __lowerCamelCase = logging.get_logger(__name__) __lowerCamelCase = [ ['attention', 'attn'], ['encoder_atten...
714
from __future__ import annotations def lowerCAmelCase_ ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> set[str]: """simple docstring""" _UpperCAmelCase ,_UpperCAmelCase : Optional[Any] = set(_SCREAMING_SNAKE_CASE ), [start] ...
328
0
import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available(): import onnxruntime as ort _lowerCAmelCase ...
10
import json import logging import os import re import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import datasets import numpy as np import torch import torchaudio from packaging import version from torch import nn import transformers from transformers import ( ...
10
1
'''simple docstring''' import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTeste...
653
'''simple docstring''' def SCREAMING_SNAKE_CASE ( lowercase_ : Union[str, Any] , lowercase_ : str ): lowercase = """""" for i in table: res += inp[i - 1] return res def SCREAMING_SNAKE_CASE ( lowercase_ : List[An...
653
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { 'abeja/gpt-neox-japanese-2.7b': 'https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/main/config.json', } class SCREAMING_SNAKE_CASE ( snake_ca...
484
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if ...
484
1
'''simple docstring''' import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampler...
707
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE_ = { 'configuration_electra': ['ELECTRA_PRETRAINED...
466
0
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, TensorType lowerCamelCase__ : ...
12
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer lowercase_ = logging.get_...
552
0
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowerCamelCase : Optional[Any] = """\ @inproceedings{snover-etal-2006-study, title = \"A Study of Translation Edit Rate with Targeted Human Annotation\", au...
512
'''simple docstring''' from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test impor...
512
1
'''simple docstring''' from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PN...
502
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE = { '''configuration_longformer''': [ ...
502
1
from typing import Union import fire import torch from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( lowercase : str , lowercase : str = "cpu" , lowercase : Union[str, None] = None ): '''simple docstring''' lowerCamelCase_ = torch.load(lo...
716
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase : str = logging.get_logger(__name__) lowerCamelCase : List[str] = { "abeja/gpt-neox-japanese-2.7b": "https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/mai...
651
0
'''simple docstring''' import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset fro...
8
from typing import Any def lowerCAmelCase_ (lowercase__ : list , lowercase__ : list , lowercase__ : dict , lowercase__ : dict , lowercase__ : dict , ) -> list: '''simple docstring''' _validation( ...
668
0
import math def A__( __lowerCAmelCase ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False # All prime...
652
import warnings from ...utils import logging from .image_processing_segformer import SegformerImageProcessor lowercase_ : str = logging.get_logger(__name__) class lowercase ( a_ ): """simple docstring""" def __init__( self : int , *low...
652
1
"""simple docstring""" import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup __lowerCamelCase = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' ' (KHTML, like Gecko) Chrome/70.0.3...
96
'''simple docstring''' from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class __lowerCAmelCase : '''simple docstring''' a_ = 42 a_ = 42 class __lowerCAmelCase...
665
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/licens...
194
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __UpperCAmelCase = { 'configuration_roberta': ['ROBER...
194
1
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 lowerCamelCase( a__ ,...
691
import requests from bsa import BeautifulSoup def lowerCamelCase( a__ = "https://www.worldometers.info/coronavirus"): _SCREAMING_SNAKE_CASE =BeautifulSoup(requests.get(a__).text ,'''html.parser''') _SCREAMING_SNAKE_CASE =soup.findAll('''h1''') _SCREAMING_SNAKE_CASE =soup...
691
1
from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _interl...
705
'''simple docstring''' from sklearn.metrics import matthews_corrcoef import datasets UpperCamelCase__ : List[str] = "\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass c...
0
0
import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokenizer from transformers.models.mbart.modeling_mbart...
351
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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 app...
351
1
from __future__ import annotations import numpy as np def __lowerCAmelCase ( SCREAMING_SNAKE_CASE_ ): return np.maximum(0 , SCREAMING_SNAKE_CASE_ ) if __name__ == "__main__": print(np.array(relu([-1, 0, 5]))) # --> [0, 0, 5]
713
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger lowercase_ = """<<<<<<< This should probably be modified because it mentions: """ lowercase_ = """======= >>>>...
37
0
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version ...
311
from __future__ import annotations from collections.abc import MutableSequence class UpperCamelCase__ : '''simple docstring''' def __init__( self , UpperCamelCase__ , UpperCamelCase__ ) -> None: if len(UpperCamelCase__ ) != degree + 1: ...
311
1
import os import unittest from huggingface_hub.utils import are_progress_bars_disabled import transformers.models.bart.tokenization_bart from transformers import logging from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context from transformers.utils.logging import disable_progress_bar, enab...
664
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_full_determi...
664
1