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
from datetime import datetime import matplotlib.pyplot as plt import torch def lowerCamelCase__ (__lowerCamelCase ): for param in module.parameters(): _SCREAMING_SNAKE_CASE : Dict = False def lowerCamelCase__ (): _SCREAMING_SNA...
249
"""simple docstring""" import sys lowerCAmelCase__ = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''12540698747158523863050715693290963295227443043557''' ...
645
0
def UpperCamelCase ( __lowercase : List[Any] ): '''simple docstring''' if not isinstance(_SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE ): raise ValueError('Input series is not valid, valid series - [2, 4, 6]' ) if len(_SCREAMING_SNAKE_CASE ) == 0: raise ValueError('Input l...
702
from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( AutoConfig, BertCo...
70
0
import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils import is_torch_avai...
415
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtract...
415
1
import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def A ( ) -> List[str]: '''simple docstring''' raise RuntimeError('''CUDA out of memory.''' ) ...
705
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = ...
561
0
'''simple docstring''' SCREAMING_SNAKE_CASE_: List[str] ={ 'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', '...
78
import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging A_ = logging.get_logger(__name__) A_ = "▁" A_ = {"vocab_file": "vocab.txt", ...
604
0
import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FILES_NAMES, save_json from ...
706
import argparse import fairseq import torch from torch import nn from transformers import ( MBartaaTokenizer, MBartConfig, MBartForCausalLM, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaModel, logging,...
429
0
'''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 ConfigTest...
90
'''simple docstring''' from __future__ import annotations def a ( UpperCamelCase_ : list[int] , UpperCamelCase_ : list[int] , UpperCamelCase_ : int ) -> tuple[float, list[float]]: snake_case__ =list(range(len(UpperCamelCase_ ) ) ) snake_case...
538
0
'''simple docstring''' import unittest from diffusers import FlaxAutoencoderKL from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): import jax ...
705
import math class __lowercase : def _lowercase ( self : Union[str, Any] , __lowerCamelCase : list[list[float]] , __lowerCamelCase : list[int] ) -> int: """simple docstring""" ...
627
0
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor snake_case__ : Optional[Any] = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ (a__ ): '''simple docstring''' def __init__( self : List[Any] ...
278
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case = logging.get_logger(__name__) snake_case = { """facebook/dpr-ctx_encoder-single-nq-base""": ( """https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base/resolv...
67
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCamelCase : Dict = { "configuration_groupvit": [ "GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "GroupViTConf...
707
"""simple docstring""" import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class lowerCamelCase__ ( unittest.TestCase ): def __a ( self : Dict ): A = [ 'safety_checker/pytorch_model.bin', '...
91
0
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( DiffusionP...
392
import argparse import os import re import packaging.version snake_case__ : List[Any] = '''examples/''' snake_case__ : Union[str, Any] = { '''examples''': (re.compile(R'''^check_min_version\("[^"]+"\)\s*$''', re.MULTILINE), '''check_min_version("VERSION")\n'''...
392
1
'''simple docstring''' 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 Op...
617
'''simple docstring''' from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record _A: Tuple = """\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding Systems}, ...
617
1
'''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.processors...
126
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase )-> bool: __UpperCAmelCase = len(_lowerCAmelCase ) # We need to create solution object to save path. __UpperCAmelCase = [[0 for _ in range(_lowerCAmelCase )] for _ in range(_lo...
126
1
'''simple docstring''' def a_ ( lowerCamelCase : str , lowerCamelCase : str ): lowerCAmelCase = len(lowerCamelCase ) lowerCAmelCase = [] for i in range(len(lowerCamelCase ) - pat_len + 1 ): lowerCAmelCase = True for j in range(lowerCa...
702
'''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 convert_to_rgb, normalize, rescale, resize, to_channel_dimension_format from ...image_util...
513
0
a_ : Union[str, Any] = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} a_ : Optional[int] = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" lowerC...
623
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...
623
1
import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identified_filena...
436
import math import flax.linen as nn import jax.numpy as jnp def __magic_name__ ( lowercase , lowercase , lowercase = 1 , lowercase = 1 , lowercase = 1.0E4 , lowercase = False , lowercase = 1.0 , ) -> jn...
436
1
from __future__ import annotations import collections import pprint from pathlib import Path def snake_case__ ( __SCREAMING_SNAKE_CASE ) -> str: return "".join(sorted(__SCREAMING_SNAKE_CASE ) ) def snake_case__ ( __SCREAMING_SNAKE_CASE ) -> list[str]: return word_by_sign...
579
import importlib import inspect import os import re # 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 SCREAMING_SNAKE_CASE = "src/transformers" # This is to make sure the transformers module imported is th...
579
1
'''simple docstring''' def UpperCamelCase__ ( _A: Tuple=28123 ): '''simple docstring''' __lowerCamelCase = [1] * (limit + 1) for i in range(2 , int(limit**0.5 ) + 1 ): sum_divs[i * i] += i for k...
719
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, TFAutoModelForSequen...
571
0
'''simple docstring''' import importlib import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Union import torch from ..utils import BaseOutput __lowerCamelCase : Any = 'scheduler_config.json' class UpperCAmelCase ( lowercase_): ...
404
'''simple docstring''' class UpperCAmelCase : """simple docstring""" def __init__( self : Tuple ) -> List[Any]: _UpperCamelCase ='''''' _UpperCamelCase ='''''' _UpperCamelCase =[] def UpperCamelCase__ ( self : ...
404
1
'''simple docstring''' import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset _lowercase = {1: (1, 1), 2: (2, 1), 3: (3, 1), 4: (2, 2), 5: (5, 1), 6: (...
427
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast from ...utils import logging _lowercase = logg...
427
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_dim...
54
'''simple docstring''' import json import os import re import unicodedata from json.encoder import INFINITY from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import regex from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchE...
418
0
"""simple docstring""" 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 ...
711
"""simple docstring""" import json import sys def lowerCamelCase__ ( __snake_case, __snake_case ) -> Union[str, Any]: """simple docstring""" with open(__snake_case, encoding='''utf-8''' ) as f: _UpperCamelCase = json.load(__snake...
78
0
'''simple docstring''' import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def __snake_case ( lowercase : int , lowercase : List[Any] , lowercase : st...
508
'''simple docstring''' import math import sys import cva import numpy as np def __snake_case ( lowercase : np.ndarray , lowercase : float ): # For applying gaussian function for each element in matrix. snake_case_ = math.sqrt(lowercase ) snake_case_ = ...
508
1
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[Any] = logging.get_logger(__name__) _lowercase : Any = { "huggingface/informer-tourism-monthly": ( "ht...
703
"""simple docstring""" def snake_case__ ( __lowerCamelCase : list[int] ): """simple docstring""" if not numbers: return 0 if not isinstance(__lowerCamelCase , (list, tuple) ) or not all( isinstance(__lowerCamelCase , __lowerCamelCase ) for number in num...
625
0
"""simple docstring""" from maths.prime_check import is_prime def _UpperCAmelCase ( __lowerCamelCase : int ) -> int: if not isinstance(__UpperCAmelCase , __UpperCAmelCase ): _snake_case = f'''Input value of [number={number}] must be an integer''' raise Typ...
224
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case_ : Tuple = logging.get_logger(__name__) snake_case_ : Tuple = { "distilbert-base-uncased": "https://huggi...
488
0
"""simple docstring""" from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def __lowerCAmelCase ( __UpperCamelCase : Namespace ): '''simple docstring''' return ConvertCommand( ...
21
"""simple docstring""" import argparse import json from collections import OrderedDict import torch from huggingface_hub import cached_download, hf_hub_url from transformers import AutoImageProcessor, CvtConfig, CvtForImageClassification def __lowerCAmelCase ( __UpperCamelCase :...
21
1
import unittest from dataclasses import dataclass import pytest from accelerate.commands.config.config_args import SageMakerConfig from accelerate.utils import ComputeEnvironment from accelerate.utils.launch import _convert_nargs_to_dict @dataclass class __lowerCAmelCase ( _a ): lowerCamelCase_ :...
60
def lowerCamelCase_ ( _UpperCamelCase , _UpperCamelCase , _UpperCamelCase ) -> list: """simple docstring""" snake_case_ : Tuple = len(_UpperCamelCase ) snake_case_ : Union[str, Any] = [[0] * n for i in range(_Upp...
60
1
from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = { '''alibaba-damo/mgp-str-base''': '''https://huggingface.co/alibaba-damo/mgp-str-base/resolve/main/config.json'...
721
def UpperCAmelCase__ ( lowerCamelCase_ : str , lowerCamelCase_ : str ): __a : Union[str, Any] = len(lowerCamelCase_ ) + 1 __a : Tuple = len(lowerCamelCase_ ) + 1 # dp is a 2d matrix where dp[i][j] denotes whether prefix string ...
577
0
__a : Optional[int] = [ "DownloadConfig", "DownloadManager", "DownloadMode", "StreamingDownloadManager", ] from .download_config import DownloadConfig from .download_manager import DownloadManager, DownloadMode from .streaming_download_manager import StreamingDownloadManager
637
'''simple docstring''' from math import factorial def a__ ( _SCREAMING_SNAKE_CASE : int , _SCREAMING_SNAKE_CASE : int ) -> int: """simple docstring""" if n < k or k < 0: raise ValueError("Please enter positive integers for n and k where n >= k" )...
71
0
"""simple docstring""" import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List,...
700
"""simple docstring""" from PIL import Image def SCREAMING_SNAKE_CASE ( _lowerCamelCase : Image ,_lowerCamelCase : int ) -> Image: _lowerCAmelCase : Any = (259 * (level + 255)) / (255 * (259 - level)) def contrast(_lowerCamelCase : int ) -> int: return int(128 + facto...
663
0
from math import isqrt def _lowerCAmelCase ( __lowerCAmelCase ) -> bool: """simple docstring""" return all(number % divisor != 0 for divisor in range(2 , isqrt(__lowerCAmelCase ) + 1 ) ) def _lowerCAmelCase ( __lowerCAmelCase = 10**6 ) -> int: ...
252
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ) -> int: """simp...
252
1
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = '▁' _...
112
"""simple docstring""" import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets _lowerCamelCase = datasets.logging.get_logger(__name__) _lowerCamelCase = '\\n@inproceedings{bleurt,\n title={BLEURT: Learning Robust Metrics for Text Generation...
112
1
import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class lowerCAmelCase__ ( __lowercase ): a__ : Dict = """M-CLIP""" def __init__( self : Optional[int] , SCREAMING_SNAKE_CASE__ : Dict=10_24 , SCREAMING_SNAKE_CASE...
298
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import PatchingSpec from ...tokenizati...
298
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a : Optional[Any] = {"""configuration_xlnet""": ["""XLNET_PRETRAINED_CONFIG...
701
"""simple docstring""" import importlib import torch import yaml from omegaconf import OmegaConf from taming.models.vqgan import VQModel def snake_case__ ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE=False ) ->str: UpperCAmelCase__ = OmegaConf.load(_SCREAMING_SNAKE_CASE ) ...
422
0
"""simple docstring""" __UpperCAmelCase = [ (1000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I'), ] def lowerCAmelCase ( __Uppe...
65
"""simple docstring""" 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, lo...
65
1
"""simple docstring""" import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_mode...
660
"""simple docstring""" import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenizerB...
660
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available UpperCAmelCase : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass else: ...
457
# limitations under the License. from typing import Optional, Tuple, Union import torch from diffusers import DiffusionPipeline, ImagePipelineOutput class __lowercase ( a_ ): """simple docstring""" def __init__( self , A , A ) -> List[Any]: '''simple do...
457
1
"""simple docstring""" def __SCREAMING_SNAKE_CASE ( __UpperCAmelCase , __UpperCAmelCase ): return int((input_a, input_a).count(0 ) == 0 ) def __SCREAMING_SNAKE_CASE ( ): assert and_gate(0 , 0 ) == 0 assert and_gate(0 , 1 ) == 0 assert and...
600
"""simple docstring""" def __SCREAMING_SNAKE_CASE ( __UpperCAmelCase = 1000000 ): _lowercase : Tuple = 1 _lowercase : Optional[int] = 1 _lowercase : Tuple = {1: 1} for inputa in range(2 , __UpperCAmelCase ): _lowercase ...
600
1
"""simple docstring""" from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize('''repo_id''' , ['''canonical_dataset_name''', '''org-name/dataset-name''']) @pytest.mark.parametrize('''path''' , ['''filename.csv''', '''filename with bl...
677
"""simple docstring""" import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import List import timm import torch import torch.nn as nn from huggingface_hub import hf_hub_download from torch import Tensor from transformers import ...
677
1
from __future__ import annotations from collections import namedtuple def UpperCamelCase ( snake_case__ , snake_case__ , snake_case__): lowerCAmelCase_ : Optional[int] = namedtuple("result" , "name value") if (voltage, current, power).count(0) != 1: raise Va...
702
from math import sqrt def UpperCamelCase ( snake_case__): lowerCAmelCase_ : Optional[int] = 0 for i in range(1 , int(sqrt(snake_case__) + 1)): if n % i == 0 and i != sqrt(snake_case__): total += i + n // i elif i == sqrt(snake_case__): ...
683
0
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 : List[str] = { ...
242
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, to_channel_dime...
242
1
'''simple docstring''' UpperCamelCase__ : Dict = { "a": "AAAAA", "b": "AAAAB", "c": "AAABA", "d": "AAABB", "e": "AABAA", "f": "AABAB", "g": "AABBA", "h": "AABBB", "i": "ABAAA", "j": "BBBAA", "k": "ABAAB", "l": "ABABA", "m": "ABABB", "n": "A...
0
'''simple docstring''' import sys UpperCamelCase__ : int = ( "73167176531330624919225119674426574742355349194934" "96983520312774506326239578318016984801869478851843" "85861560789112949495459501737958331952853208805511" "12540698747158523863050715693290963295227443043557" "6...
0
1
import os from itertools import chain from random import randrange, shuffle import pytest from .sola import PokerHand __A = ( "4S 3H 2C 7S 5H", "9D 8H 2C 6S 7H", "2D 6D 9D TH 7D", "TC 8C 2S JH 6C", "JH 8S TH AH QH", "TS KS 5S 9S AC", "KD 6S 9D TH AD", "KS 8D 4D 9S 4S", # p...
68
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging _SCREAMING_SNAKE_CASE : Dict = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : Op...
436
0
'''simple docstring''' import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) f...
265
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase_ : str = logging.get_logger(__name__) lowerCamelCase_ : Optional[int] = { '''SenseTime/deformable-detr''': '''ht...
265
1
# Lint as: python3 import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.version import Version...
47
import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from datasets.config import MA...
47
1
'''simple docstring''' import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast lowercase__ = datasets.utils.logging.get_logger(__name__) @dataclass class __SCR...
276
'''simple docstring''' import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def __UpperCamelCase ( __lowerCamelCase : BertModel , __lowerCamelCase : str , __lowerCamelCase : str ) -> List[str]: '''simp...
276
1
from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common impo...
67
def _lowerCamelCase ( __A : list[int] ) -> int: if not numbers: return 0 if not isinstance(__A , (list, tuple) ) or not all( isinstance(__A , __A ) for number in numbers ): raise ValueError('''numbers must be an iterable of intege...
485
0
import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to_pil_image from ...image_u...
706
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { '''andreasmadsen/efficient_mlm_m0.40''': ( '''https://hug...
325
0
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: list[int | str] ): create_state_space_tree(UpperCamelCase__ , [] , 0 , [0 for i in range(len(UpperCamelCase__ ) )] ) def SCREAMING_SNAKE_CASE__ ( UpperCa...
6
'''simple docstring''' def lowerCamelCase ( UpperCAmelCase__ : str , UpperCAmelCase__ : int ) -> str: '''simple docstring''' SCREAMING_SNAKE_CASE__ :list[list[str]] = [[] for _ in range(UpperCAmelCase__ )] SCREAMING_SNAKE_CASE__ :Any ...
209
0
import os import unittest from transformers import MobileBertTokenizer, MobileBertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils impo...
185
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __UpperCamelCase = { 'configuration_resnet': ['RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ResNetConfig', 'ResNetOnnxConfig'...
185
1
from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def __lowerCAmelCase ( _UpperCamelCase , _UpperCamelCase , _UpperCamelCase , _UpperCamelCase , ) -> list[float]: '''simple doc...
306
_lowercase = '0.18.2' from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_available, is_k_diffusion_version, is_librosa_available, ...
306
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _snake_case = {"configuration_wavlm": ["WAVLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "WavLMConfig"]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() exce...
714
import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging _snake_case = logging.get_logger(__name__) _snake_case = { "xlnet-base-cased": "https://huggingface.co/xlnet-base-cased/resolve/main/config.json", "xlnet-large-cased": "https://huggingface.co/xlnet...
658
0
import math from typing import Any, Callable, List, Optional, Tuple, Union import numpy as np import torch from ...models import TaFilmDecoder from ...schedulers import DDPMScheduler from ...utils import is_onnx_available, logging, randn_tensor if is_onnx_available(): from ..onnx_utils import OnnxRuntimeMode...
35
"""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 __lowercase ( _UpperCAmelCase): """simple docst...
480
0
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast UpperCAmelCase = datasets.utils.logging.get_logger(__name__) @dataclass class A_ ( datasets.BuilderConf...
709
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger UpperCAmelCase = '''<<<<<<< This should probably be modified because it mentions: ''' UpperCAmelCase = '''======= >>>>>...
565
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import RoFormerConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFMode...
449
"""simple docstring""" import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from t...
449
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _a : Union[str, Any]= { "configuration_roberta": ["ROBERTA_PRETRAINED_...
714
"""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 from .....
192
0
'''simple docstring''' # 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 impor...
541
from ..utils import ( OptionalDependencyNotAvailable, is_flax_available, is_scipy_available, is_torch_available, is_torchsde_available, ) try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ..utils.dummy_pt_obje...
36
0
'''simple docstring''' from __future__ import annotations class _lowercase : '''simple docstring''' def __init__( self : Any , SCREAMING_SNAKE_CASE__ : int ) -> None: __lowerCAmelCase = data __lowerCAmelCase = ...
330
'''simple docstring''' def UpperCamelCase_ ( snake_case_ : bytes ) -> str: '''simple docstring''' return "".join([hex(snake_case_ )[2:].zfill(2 ).upper() for byte in list(snake_case_ )] ) def UpperCamelCase_ ( snake_case_ : str ) -> bytes: ...
330
1
"""simple docstring""" import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create simlink # import class...
621
'''simple docstring''' 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(): from PIL impor...
414
0
'''simple docstring''' # 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/LI...
324
'''simple docstring''' import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch...
324
1
"""simple docstring""" import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class lowercase(unittest.TestCase ): @requir...
273
"""simple docstring""" import operator def __magic_name__ ( UpperCamelCase : list , UpperCamelCase : bool = False , UpperCamelCase : list | None = None ) -> list: a__ = operator.lt if reverse else operator.gt a__ = solution or [] if not arr: ...
273
1
import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteria, MaxNewTokensCriteria,...
583
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCamelCase = logging.get_logger(__name__) _UpperCamelCase = { "microsoft/git-base": "https://huggingface.co/microsoft/git-base/resolve/main/config.json", } ...
583
1
"""simple docstring""" import warnings from functools import wraps from typing import Callable def __lowerCAmelCase ( __UpperCamelCase : Callable ): '''simple docstring''' @wraps(__UpperCamelCase ) def _inner_fn(*__UpperCamelCase : ...
58
"""simple docstring""" import unittest from transformers import SqueezeBertConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_mode...
571
0
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertToken...
569
import tempfile import unittest from make_student import create_student_by_copying_alternating_layers from transformers import AutoConfig from transformers.file_utils import cached_property from transformers.testing_utils import require_torch UpperCamelCase = '''sshleifer/bart-ti...
569
1
'''simple docstring''' import re import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' SCREAMING_SNAKE_CASE_ = ['image_processor', 'tokenizer'] SCREAMING_SNAKE_...
42
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 import ModelTest...
285
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase__ = { "configuration_instructblip": [ "INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "InstructBlipConfig", "InstructBlipQFormerConfig", "Inst...
639
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 .test_pipelines_common import ANY if is_vision_avai...
639
1
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __snake_case ( __UpperCamelCase : int ): """simple docstring""" A_ = prime_factors(__UpperCamelCase ) if is_square_free(__UpperCamelCase ): re...
86
'''simple docstring''' import itertools import json import os import unittest from transformers import AddedToken, RobertaTokenizer, RobertaTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ......
125
0
def _UpperCAmelCase ( a : str ): if not all(char in """01""" for char in bin_string ): raise ValueError("""Non-binary value was passed to the function""" ) if not bin_string: raise ValueError("""Empty string was passed to the function""" ) snake_case__ = ...
99
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__ = { """configuration_autoformer""": [ """AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """AutoformerConfig""", ], } t...
99
1
"""simple docstring""" _A = tuple[float, float, float] _A = tuple[float, float, float] def lowercase (_snake_case ,_snake_case ) -> Vectorad: '''simple docstring''' __UpperCamelCase = end_pointa[0] - end_pointa[0] __UpperCamelCase = ...
505
"""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 .tokenization_mvp import M...
505
1
"""simple docstring""" import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging __lowerCAmelCase ...
706
"""simple docstring""" def _UpperCAmelCase ( lowerCamelCase__ = 50 ): """simple docstring""" lowerCAmelCase__ = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(ro...
674
0
import unittest import numpy as np from transformers import DistilBertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.numpy as jnp from...
31
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging lowerCamelCase : int = logging.get_logger(__name__) def __lowerCAmelCase ( __snake_case ): __lowerCAmelCase ...
367
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_tensorf...
24
"""simple docstring""" from __future__ import annotations def UpperCAmelCase ( A : int , A : int ): '''simple docstring''' _UpperCAmelCase = [] create_all_state(1 , A , A , [] , A ) return result ...
24
1
'''simple docstring''' import torch from torch import nn from transformers import CLIPPreTrainedModel, CLIPVisionModel from ...models.attention import BasicTransformerBlock from ...utils import logging UpperCamelCase =logging.get_logger(__name__) # pylint: disable=invalid-name class A ...
208
'''simple docstring''' def snake_case ( a_ : list[int] , a_ : list[int] ) -> tuple[float, float]: """simple docstring""" if not len(a_ ) == len(a_ ) == 3: raise ValueError("""Please enter a valid equation.""" ) if equatio...
208
1
import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever __a : Any = logging.getLogger(__name__) class _UpperCamelCase ( _UpperCAmelCase ): """simple docstr...
716
from ...processing_utils import ProcessorMixin class _UpperCamelCase ( _UpperCAmelCase ): """simple docstring""" __a : Tuple = '''SpeechT5FeatureExtractor''' __a : Optional[Any] = '''SpeechT5Tokenizer''' def __init__( self , lowerCAmelCas...
522
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : List[str] = logging.get_logger(__name__) _lowerCAmelCase : Dict = { '''uw-madison/mra-base-512-4''': '''https://huggingface.co/uw-madison/mra-base-512...
46
"""simple docstring""" import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets a__ : int = ''' @inproceedings{xu-etal-2016-optimizing, title = {Optimizing Statistical Machine Translation for Text Simplif...
682
0
from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets A_ = "\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding},\n author={Wang, Alex and Singh, Amanpreet...
360
import json import os import shutil import tempfile import unittest import numpy as np from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES, BertTokenizer from transformers.testing_utils import require_tokenizers, require_vision from transformers.ut...
360
1
import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_available, is_vision_availabl...
515
from __future__ import annotations def SCREAMING_SNAKE_CASE ( __UpperCamelCase , __UpperCamelCase) -> set[str]: a , a = set(__UpperCamelCase), [start] while stack: a = stack.pop() explored.add(__UpperCamelCase) # Differences from BF...
515
1
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from tr...
719
"""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 U...
275
0
"""simple docstring""" import unittest import numpy as np from transformers import BertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_av...
224
import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.models.bert.configuration_bert import BertConfig from trans...
271
0
from typing import List from .keymap import KEYMAP, get_character def A ( __UpperCamelCase ) -> Any: def decorator(__UpperCamelCase ): A__ = getattr(__UpperCamelCase , 'handle_key' , [] ) handle += [key] setattr(__UpperCamelCase , 'handle_key' , __U...
711
import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_co...
52
0
import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": SCREAMING_SNAKE_CASE : Tuple = argparse.ArgumentParser( description=( """Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned""" ...
197
'''simple docstring''' import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFAutoModel, is_tensorflow_text_available, is_tf_available from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.testing_uti...
527
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __magic_name__ = { "configuration_roc_bert": ["ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "RoCBertConfig"], "tokenization_roc_bert": ["R...
716
"""simple docstring""" import importlib.metadata import operator import re import sys from typing import Optional from packaging import version __magic_name__ = { "<": operator.lt, "<=": operator.le, "==": operator.eq, "!=": operator.ne, ">=": operator.ge, ">": operator.gt, } def ...
248
0
"""simple docstring""" from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import Ten...
103
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __UpperCAmelCase = { 'configuration_bridgetower': [ 'BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BridgeTowe...
65
0
import math from typing import Callable, List, Optional, Union import numpy as np import PIL import torch from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_up...
705
from __future__ import annotations def lowerCamelCase__ ( _lowerCamelCase , _lowerCamelCase ) ->bool: _UpperCAmelCase =get_failure_array(_lowerCamelCase ) # 2) Step through text searching for pattern _UpperCAmelCase , _UpperCAmelCase =0, 0 # index into text, pattern ...
592
0
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, ) SCREAMING_SNAKE_CASE__ : Any = {'configuration_m...
311
'''simple docstring''' import warnings from .generation import TFGenerationMixin class A__ ( UpperCamelCase ): """simple docstring""" warnings.warn( '''Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will ''' '''be rem...
494
0
'''simple docstring''' from typing import Union import fire import torch from tqdm import tqdm def a_ ( _UpperCAmelCase : str ,_UpperCAmelCase : str = "cpu" ,_UpperCAmelCase : Union[str, None] = None ) -> None: __snake_case : Optional[Any] ...
124
'''simple docstring''' import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTe...
124
1
'''simple docstring''' def _lowerCAmelCase ( __magic_name__ : int , __magic_name__ : int ) -> int: return int(input_a == input_a == 0 ) def _lowerCAmelCase ( ) -> None: print('''Truth Table of NOR Gate:''' ) print('''| Input 1 ...
92
"""simple docstring""" def A__ ( ): """simple docstring""" _lowerCAmelCase = [3_1, 2_8, 3_1, 3_0, 3_1, 3_0, 3_1, 3_1, 3_0, 3_1, 3_0, 3_1] _lowerCAmelCase = 6 _lowerCAmelCase = 1 _lowerCAmelCase = 1_9_0_1 _lowerCAmelCase = 0 ...
589
0
from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_av...
711
# 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 ...
526
0
'''simple docstring''' from datetime import datetime import requests def __UpperCAmelCase ( _UpperCAmelCase : str ) -> bytes: __snake_case = "https://downloadgram.net/wp-json/wppress/video-downloader/video?url=" __snake_case = requests.get(base_url + url ).jso...
69
'''simple docstring''' 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=Tr...
69
1
import math from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ =logging.get_logger(__name__) UpperCAmelCase_ ={ """facebook/data2vec-base-960h""": """https://huggingface.co/facebook/data2vec-audio-base-960h/resolve/main/config.json""", ...
33
import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS_CACHE, WEIGHTS_NAME, ca...
33
1
"""simple docstring""" def a__ ( lowerCAmelCase__ ): if number > 0: raise ValueError("input must be a negative integer" ) UpperCAmelCase_ = len(bin(lowerCAmelCase__ )[3:] ) UpperCAmelCase_ = bin(abs(lowerCAmelCase__ ) - (1 << binary_num...
82
import re import time from typing import Optional import IPython.display as disp from ..trainer_callback import TrainerCallback from ..trainer_utils import IntervalStrategy, has_length def UpperCamelCase_( lowerCamelCase_ ) -> int: _lowercase : List[str] = int(lowerCamelCas...
89
0
import unittest import numpy as np def lowerCamelCase__ ( UpperCamelCase__ : Any , UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : Tuple , UpperCamelCase__ : Any = None , ) -> Optional[int]: '''simple docstri...
701
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase_ = { """configuration_luke""": ["""LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LukeConfig"""], """tokenization_luke""": ["""LukeTokenizer"""], } try: ...
541
0
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar SCREAMING_SNAKE_CASE__ : str = TypeVar("""T""") SCREAMING_SNAKE_CASE__ : int = TypeVar("""U""") class lowerCamelCase_ ( Generic[T, U] ): def __init__( self...
0
import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging lowerCAmelCase__: Tuple = logging.get_logger(__name__) class snake_case_ ( lowerCAmelCase ): __lowerCamelCase ...
345
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A : int ...
141
"""simple docstring""" import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, sl...
141
1
"""simple docstring""" import requests lowerCAmelCase = """YOUR API KEY""" def lowerCAmelCase_ ( snake_case_ : str , snake_case_ : str = giphy_api_key ) ->list: lowerCamelCase__ : Optional[Any] ='+'.join(query.split() ) lowerCa...
174
"""simple docstring""" import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from tax import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffusers.p...
174
1
"""simple docstring""" import unittest from transformers import DebertaVaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mo...
302
"""simple docstring""" 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 ...
302
1
from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def UpperCAmelCase_ ( _UpperCAmelCase = True , *_UpperCAmelCase , **_UpperCAmelCase ): if not is_tqdm_available(): raise ImportError(...
423
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class a__ ( __SCREAMING_SNAKE_CASE ): _A = (KDPMaDiscreteScheduler,) _A = 10 def ...
423
1
import json import os from functools import lru_cache from typing import TYPE_CHECKING, List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation lower...
712
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { "camembert-base": "https://huggingface.co/camembert-base/r...
390
0
"""simple docstring""" import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def lowercase__ ( snake_case_ :Op...
49
from ..utils import DummyObject, requires_backends class __magic_name__ ( metaclass=__UpperCAmelCase): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = ["flax"] def __init__( self: Dict , *_lowerCamelCase: Tupl...
234
0
'''simple docstring''' import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset f...
700
def lowerCamelCase_ ( lowerCAmelCase__ : list ) -> int: '''simple docstring''' if not grid or not grid[0]: raise TypeError('The grid does not contain the appropriate information' ) for cell_n in range(1 , len(grid[0] ) ): ...
224
0