code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem SCREAMING_SNAKE_CASE_ = importlib.util.find_spec("""s3fs""") is not None if _has_safs: ...
296
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.im...
296
1
import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCAmelCase_ : Dict = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( __SCREAMING_SNAKE_CASE ): snake_ca...
351
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start...
120
0
import logging import os import sys from pathlib import Path from unittest.mock import patch from parameterized import parameterized from run_eval import run_generate from run_eval_search import run_search from transformers.testing_utils import CaptureStdout, TestCasePlus, slow from utils import ...
51
from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class __snake_case : pass
51
1
"""simple docstring""" 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 im...
149
"""simple docstring""" import secrets from random import shuffle from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation def lowerCAmelCase__ ( _UpperCamelCase : int = 8 ) -> str: """simple docstring""" snake_case ...
149
1
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_modeling_common import ModelT...
21
"""simple docstring""" import inspect import warnings from typing import Any, Dict, Optional, Union from packaging import version def _snake_case ( *UpperCamelCase : str , UpperCamelCase : Optional[Union[Dict, Any]] = None , UpperCamelCase : Tuple=True , UpperCamelCase ...
109
0
"""simple docstring""" import gc import unittest from transformers import CTRLConfig, 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_mode...
355
import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device from diffusers.utils....
207
0
import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE_ ( snake_cas...
338
import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () lowercase__ : Dict = np.linspace(start=0, stop=7_5, num=7_5, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership function # (trapmf(), gbellmf(...
338
1
'''simple docstring''' def UpperCAmelCase_ (__a : str = 1_0_0_0 ): """simple docstring""" _a : Optional[Any] = 1, 1 _a : Any = [] for i in range(1 , n + 1 ): _a : Union[str, Any] = prev_numerator + 2 * prev_denominat...
364
'''simple docstring''' from collections.abc import Generator from math import sin def UpperCAmelCase_ (__a : bytes ): """simple docstring""" if len(__a ) != 3_2: raise ValueError('Input must be of length 32' ) _a : Any = b'' for i in [3, 2, 1, 0]: ...
5
0
"""simple docstring""" from argparse import ArgumentParser from . import BaseTransformersCLICommand def lowercase ( lowerCAmelCase__ : List[Any] ) -> Any: return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) ...
45
"""simple docstring""" import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class __lowerCAmelCase ( un...
45
1
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoTokenizer, F...
189
from __future__ import annotations from random import choice def __SCREAMING_SNAKE_CASE ( lowerCAmelCase: Any ) -> Optional[int]: return choice(lowerCAmelCase ) def __SCREAMING_SNAKE_CASE ( lowerCAmelCase: list[int] , lowerCAmelCase: int ) -> int: _...
189
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 UpperCAmelCase_ ...
12
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 UpperCAmelC...
12
1
"""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_modeling_common import Mod...
303
"""simple docstring""" import os import numpy import onnx def UpperCamelCase ( UpperCAmelCase , UpperCAmelCase ) ->List[str]: """simple docstring""" a_ = a.name a_ = b.name a_ = "" a_ = "" a_ = a == b a_ = name_a a_ = n...
303
1
'''simple docstring''' import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets lowerCamelCase : List[Any] = "\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained ...
47
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, cached...
127
0
"""simple docstring""" import math def lowercase__ ( _UpperCAmelCase ) -> int: '''simple docstring''' if not isinstance(_UpperCAmelCase , _UpperCAmelCase ): lowercase : Optional[Any] = f'''Input value of [number={n...
53
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, ...
53
1
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...
170
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...
170
1
import os def SCREAMING_SNAKE_CASE ( ) -> Dict: lowerCamelCase__ : int = os.path.dirname(os.path.realpath(_UpperCAmelCase ) ) lowerCamelCase__ : Optional[int] = os.path.join(_UpperCAmelCase , 'triangle.txt' ) with open(_UpperCAmelCase ) as f: ...
350
from __future__ import annotations def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ) -> None: lowerCamelCase__ : Optional[Any] = len(_UpperCAmelCase ) # If row is eq...
45
0
"""simple docstring""" from math import factorial a_ = {str(d): factorial(d) for d in range(10)} def __lowercase ( snake_case_ : Optional[Any] ) ->int: '''simple docstring''' return sum(DIGIT_FACTORIAL[d] for d in str(snake_case_ ) ) def __lowerca...
179
from math import acos, sin from typing import List, Tuple, Union import numpy as np import torch from PIL import Image from ...models import AutoencoderKL, UNetaDConditionModel from ...schedulers import DDIMScheduler, DDPMScheduler from ...utils import randn_tensor from ..pipeline_utils import AudioPi...
196
0
'''simple docstring''' import random def lowercase (_A ): """simple docstring""" _lowerCAmelCase : Union[str, Any] = num - 1 _lowerCAmelCase : Optional[Any] = 0 while s % 2 == 0...
353
'''simple docstring''' 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_sentencepie...
25
0
def _lowercase ( UpperCamelCase_ ) -> str: '''simple docstring''' return "".join(chr(ord(__lowerCamelCase ) - 32 ) if 'a' <= char <= 'z' else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
176
__UpperCamelCase : Optional[int] = { "Pillow": "Pillow", "accelerate": "accelerate>=0.11.0", "compel": "compel==0.1.8", "black": "black~=23.1", "datasets": "datasets", "filelock": "filelock", "flax": "flax>=0.4.1", "hf-doc-builder": "hf-doc-builde...
228
0
from __future__ import annotations __UpperCAmelCase = tuple[int, int, int] __UpperCAmelCase = tuple[str, str, str] # used alphabet -------------------------- # from string.ascii_uppercase __UpperCAmelCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' # ------...
368
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase (_snake_case ): '''simple docstring''' _snake_case : Any = (DDPMParallelScheduler,) def __UpperCAmelCase ...
145
0
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class _UpperCamelCase ( ...
76
def lowerCamelCase__ ( _a , _a): _validate_point(_a) _validate_point(_a) if len(_a) != len(_a): raise ValueError("Both points must be in the same n-dimensional space") return float(sum(abs(a - b) for a, b in zip(_a , _a))) def lowerCamelCase__ ( _a): if point: if...
76
1
'''simple docstring''' from __future__ import annotations def a ( lowerCamelCase__ , lowerCamelCase__ = None ): '''simple docstring''' A_ : int = word_bank or [] # create a table A_ : int = len(lowerCamelCase__ ) + 1 A_ : ...
361
'''simple docstring''' def a ( lowerCamelCase__ ): '''simple docstring''' return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
135
0
'''simple docstring''' def __lowerCAmelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ ) -> Union[str, Any]: global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: __lowerCamelCase = mf_knapsack(i - 1 , ...
67
'''simple docstring''' def __lowerCAmelCase ( UpperCamelCase__ , UpperCamelCase__ ) -> Optional[int]: if b == 0: return 1 if (b % 2) == 0: return actual_power(UpperCamelCase__ , int(b / 2 ) ) * actual_power(UpperCamelCase__ , int(b / 2 ) ) else: ...
67
1
"""simple docstring""" class __lowerCamelCase : """simple docstring""" def __init__( self , UpperCAmelCase ) -> None: '''simple docstring''' lowercase_ = len(UpperCAmelCase ) lowercase_ = [0] * len_array ...
350
def SCREAMING_SNAKE_CASE_ ( __lowerCamelCase: int ): '''simple docstring''' if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(__lowerCamelCase , __lowerCamelCase ): raise TypeError("Input value must be a 'int' type" )...
297
0
import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_torch_multi_gpu, ) logg...
92
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import tensorflow as tf from transformers...
255
0
'''simple docstring''' import collections.abc from typing import Optional, Tuple, Union import torch import torch.utils.checkpoint from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseMode...
246
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"} class _...
246
1
"""simple docstring""" from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelE...
25
"""simple docstring""" import copy import tempfile import unittest from huggingface_hub import HfFolder, delete_repo from parameterized import parameterized from requests.exceptions import HTTPError from transformers import AutoConfig, GenerationConfig from transformers.testing_utils import TOKEN, USER, ...
91
0
def UpperCamelCase ( __magic_name__ : list ) -> list: """simple docstring""" if len(__magic_name__ ) <= 1: return lst lowercase__ = 1 while i < len(__magic_name__ ): if lst[i - 1] <= lst[i]: i += 1 else: lowercase_...
146
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp ...
146
1
'''simple docstring''' # Lint as: python3 import itertools import os import re lowerCamelCase : Any = re.compile(R'([A-Z]+)([A-Z][a-z])') lowerCamelCase : str = re.compile(R'([a-z\d])([A-Z])') lowerCamelCase : Optional[int] = re.compile(R'(?<!_)_(?!_)') lowerCamelCase...
2
'''simple docstring''' import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin lowerCamelCase : List[str] ...
2
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = ...
219
'''simple docstring''' import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed fro...
219
1
import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase ( ...
169
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : List[str] = logging.get_logger(__name__) _lowerCAmelCase : Optional[Any] = { "microsoft/markuplm-base": "https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json"...
169
1
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex from .utils import require_elast...
351
from math import ceil def __UpperCAmelCase ( __a : int = 1_001 ) -> int: """simple docstring""" _a : Dict = 1 for i in range(1 ,int(ceil(n / 2.0 ) ) ): _a : int = 2 * i + 1 _a : ...
15
0
from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.rob...
82
# 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 ...
277
0
'''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 s...
243
'''simple docstring''' def _lowercase ( __A = 10 ,__A = 22 ): '''simple docstring''' __UpperCamelCase = range(1 ,__A ) __UpperCamelCase = range(1 ,__A ) return sum( 1 for power in powers for base in bases if len(str(base**power ...
243
1
def UpperCamelCase__ ( A__ , A__ ) -> Optional[int]: snake_case__ : Union[str, Any] = len(_UpperCAmelCase ) print('The following activities are selected:' ) # The first activity is always selected snake_case__ : Any = 0 print(_...
143
"""simple docstring""" 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 lowercase ( __UpperCA...
167
0
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, res...
365
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A ...
108
0
'''simple docstring''' import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class UpperCAmelCase_ ( ctypes.Structure ): # _fields is a specific attr expected by ctypes ...
4
import datasets from .evaluate import evaluate _A : Optional[int] = '\\n@inproceedings{Rajpurkar2016SQuAD10,\n title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text},\n author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang},\n booktitle={EMNLP},\n year={2016...
142
0
import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def snake_case_ ( snake_case = 3 ) -> qiskit.result.counts.Counts: if isinstance(snake_case , snake_case ): raise...
366
from collections import deque from math import floor from random import random from time import time class __a : def __init__( self ) -> Dict: '''simple docstring''' lowercase__: Dict = {} def SCREAMING_SNAKE_CASE__ ( s...
288
0
'''simple docstring''' import copy from collections import OrderedDict from typing import Dict, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCAmelCase__ =...
104
'''simple docstring''' import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_avai...
104
1
import os import tempfile import unittest import uuid from pathlib import Path from transformers.testing_utils import get_tests_dir, require_soundfile, require_torch, require_vision from transformers.tools.agent_types import AgentAudio, AgentImage, AgentText from transformers.utils import is_soundfile_availble, i...
180
lowercase__ : List[Any] = { "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": "ABBAA", "o": "ABBAB", "p...
180
1
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor a_ = logging.get_logger(__name__) class _lowercase ( snake_case_ ): def __init__( self : Union[str, Any] , *snake_case : Tuple , **snake_case : List...
175
def __lowercase ( lowerCamelCase : str , lowerCamelCase : str ): def get_matched_characters(lowerCamelCase : str , lowerCamelCase : str ) -> str: UpperCamelCase_ : Tuple = [] UpperCamelCase_ : List[Any] = min(len(_stra ) , len(_stra ) ) /...
175
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import DebertaVaConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_ten...
350
"""simple docstring""" from collections import defaultdict def lowerCamelCase_( _lowerCamelCase ) -> int: '''simple docstring''' _lowerCamelCase : Optional[int] = 1 _lowerCamelCase : str = True for v in tree[start]: if v not in visited: ...
340
0
"""simple docstring""" def lowercase ( _snake_case : Optional[Any] ) ->List[str]: """simple docstring""" __snake_case , __snake_case : List[str] = [], [] while len(_snake_case ) > 1: __snake_case , __snake_case : Optional[Any] = min(_s...
102
"""simple docstring""" import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import Tokenize...
102
1
"""simple docstring""" from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ...
366
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_ : str = logging.get_logger(__name__) U...
120
0
def lowercase_ (A : int ): snake_case__ : str = generate_pascal_triangle(A ) for row_idx in range(A ): # Print left spaces for _ in range(num_rows - row_idx - 1 ): print(end=' ' ) # Print row ...
277
import collections import inspect import unittest from transformers import SwinvaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTe...
277
1
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer UpperCAmelCase__ : str =logging.get_logger(__name__) UpperCAmelCase__ : int ={'''vocab_file''': '''vocab.j...
262
from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def _lowercase ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase = 1 / sqrt(2 ) ) -> IIRFilter: lowerCamelCase =tau * frequency / samplerate lowerCamelCase =sin(_UpperCAmelCase ) ...
262
1
'''simple docstring''' from __future__ import annotations from sys import maxsize from typing import Generic, TypeVar _lowerCAmelCase = TypeVar('''T''') def _SCREAMING_SNAKE_CASE ( UpperCamelCase ): """simple docstring""" return (position - 1) // 2 def _SCREAMING_SNA...
37
'''simple docstring''' def _A ( ): lowercase__ = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] lowercase__ = 6 lowercase__ = 1 lowercase__ = 1901 lowercase__ = 0 while year < 2...
164
0
def lowerCamelCase__ ( _lowercase , _lowercase ): '''simple docstring''' return number | (1 << position) def lowerCamelCase__ ( _lowercase , _lowercase ): '''simple docstring''' return number & ~(1 << position) def lowerCamelCase__ ( ...
365
from __future__ import annotations from fractions import Fraction def lowerCamelCase__ ( _lowercase , _lowercase ): '''simple docstring''' return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) def lowerCamelCase__ ...
235
0
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, ...
12
'''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/LICENSE-2.0 # # Unl...
47
0
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def UpperCamelCase__( UpperCamelCase__ : BertModel , UpperCamelCase__ : str , UpperCamelCase__ : str )->List[Any]: A__ = ('''...
39
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging a__: List[Any] = logging.get_logger(__name__) a__: Optional[Any] = { 'microsoft/unispeech-large-1500h-cv': ( 'https://huggingface.co/microsoft/unispeec...
39
1
import json import os import tempfile import unittest import numpy as np from datasets import load_dataset 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 ImageProcessin...
209
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_modeling_common import ModelTesterMixin, ids_tensor, ...
21
0
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging a : Any = logging.get_logger(__name__) a : List[Any] ...
359
'''simple docstring''' import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data imp...
72
0
'''simple docstring''' from __future__ import annotations from PIL import Image # Define glider example a : Optional[int] = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, ...
56
import requests def UpperCAmelCase ( lowercase , lowercase ): """simple docstring""" __lowercase = {'''Content-Type''': '''application/json'''} __lowercase = requests.post(lowercase , json={'''text''': message_body} , headers=lowerca...
210
0
import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class _snake_case ( unittest.TestCase ): def SCREA...
359
import logging import os import quant_trainer import torch from torch.utils.data import DataLoader from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput a_ : Dict = logging.getLogger(__name__) if is_torch_tpu_available(check_device=Fa...
327
0
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 ...tokenizatio...
257
"""simple docstring""" from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class SCREAMING_SNAKE_CASE__ : """simple docstring""" a : int a : TreeNode | None =None a : TreeNode | None =None ...
108
0
import unittest import numpy as np from transformers.testing_utils import is_flaky, require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): imp...
41
import numpy class _snake_case : def __init__( self , _a , _a ): __magic_name__ : Optional[Any] = input_array # Random initial weights are assigned where first argument is the # number of nodes in previous layer and second argument is the #...
41
1
def lowerCamelCase__ ( A__ : Any , A__ : Any ): '''simple docstring''' __lowerCamelCase = int(_lowerCAmelCase ) # Initialize Result __lowerCamelCase = [] # Traverse through all denomination for denomination in ...
12
"""simple docstring""" import os from distutils.util import strtobool def lowercase (_lowerCAmelCase , _lowerCAmelCase ): for e in env_keys: __lowerCAmelCase = int(os.environ.get(_lowerCAmelCase , -1 ) ) if val >= 0: return val ...
301
0
"""simple docstring""" from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration UpperCAmelCase : Tuple = HfArgumentParser(InitializationArguments) UpperCAmelCase : str = pars...
365
"""simple docstring""" import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from tra...
320
0
import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from .....
62
def UpperCAmelCase__ (UpperCamelCase_ = 4_00_00_00 ): """simple docstring""" snake_case = [0, 1] snake_case = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: break i += 1 ...
127
0
from typing import List import numpy as np def lowerCamelCase_ ( lowerCamelCase__ ): lowerCamelCase_ = {key: len(lowerCamelCase__ ) for key, value in gen_kwargs.items() if isinstance(lowerCamelCase__ , lowerCamelCase__ )} if len(set(lists_lengths.values() ) ) > 1: ...
353
import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class _SCREAMING_SNAKE_CASE : def __init__( self , lowercase , lowercase , lowercase ) -> List[Any]: if dst_width < 0 or dst_height < 0: raise ValueError("Destination width/height should ...
47
0
"""simple docstring""" import math def _snake_case ( lowercase__ , lowercase__ ): _lowerCamelCase : List[Any] = len(lowercase__ ) _lowerCamelCase : Optional[Any] = int(math.floor(math.sqrt(lowercase__ ) ) ) _lowerCamelC...
96
import collections import inspect import unittest from transformers import SwinvaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTe...
277
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel...
275
'''simple docstring''' from __future__ import annotations from sys import maxsize from typing import Generic, TypeVar lowerCAmelCase :Any = TypeVar('''T''') def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" return (position - 1) // 2 def l...
275
1
'''simple docstring''' from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def lowercase ( __magic_name__ , __magic_name__ ): '''simple docstring''' UpperCAm...
311
'''simple docstring''' import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, ...
311
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import DebertaVaConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTest...
246
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepi...
246
1
"""simple docstring""" from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. _lowerCamelCase : Optional[int] = 200 # Number of elements selected in every generation of evolution. The selection takes #...
167
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : Any = { 'configuration_git': ['GIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GitConfig', 'GitVisionConfig'], 'processing_git...
167
1
"""simple docstring""" import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : Optional[Any] = { '''facebook/enc...
195
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : int = logging.get_logger(__name__) a__ : Tuple = {'''ctrl''': '''https://huggingface.co/ctrl/resolve/main/config.json'''} class UpperCamelCase...
195
1
from __future__ import annotations from decimal import Decimal from numpy import array def lowercase_ ( _lowerCamelCase : list[list[float]]): lowercase__ : Tuple = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implementation only ...
87
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor f...
208
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils imp...
363
import cva import numpy as np class lowerCamelCase_ : '''simple docstring''' def __init__( self : Optional[Any] , _lowerCAmelCase : float , _lowerCAmelCase : int ): if k in (0.04, 0.06): SCREAMING_SNAKE_CASE_ = k S...
210
0
'''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 ...
58
from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PILImageResampling, get_image_siz...
176
0
"""simple docstring""" def snake_case__ ( __lowerCamelCase : str ): """simple docstring""" lowerCamelCase__ : str =[] lowerCamelCase__ : Optional[int] =[] lowerCamelCase__ : Dict ={ '''^''': 3, '''*''': 2, '''/''': 2, '''%'''...
357
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" return int((input_a, input_a).count(0 ) != 0 ) def snake_case__ ( ): """simple docstring""" assert nand_gate(0 , 0 ...
272
0
"""simple docstring""" from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_images, ...
69
'''simple docstring''' 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, _conc...
34
0
"""simple docstring""" import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def lowerCAmelCase__ ( _UpperCamelCase : List[str] ...
366
"""simple docstring""" import os def lowerCAmelCase__ ( _UpperCamelCase : str = "matrix.txt" ) -> int: """simple docstring""" with open(os.path.join(os.path.dirname(_UpperCamelCase ) , _UpperCamelCase ) ) as in_file: snake_ca...
149
0
'''simple docstring''' import qiskit def lowercase__ ( __lowercase : int , __lowercase : int ) -> qiskit.result.counts.Counts: """simple docstring""" __UpperCamelCase = qiskit.Aer.get_backend('aer_simulator' ) # Create a Quantum Circuit ac...
53
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : List[Any] =logging.get_logger(__name__) a__ : List[Any] ={ '''BAAI/AltCLIP''': '''https://huggingface.co/BAAI/AltCLIP/resolve...
53
1
'''simple docstring''' import math def lowerCamelCase__ ( _A ): a : Union[str, Any] = [True] * n a : int = False a : List[str] = False a : List[Any] = True for i in range(3 , int(n**0.5 + 1 ) , ...
96
'''simple docstring''' import unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random...
96
1
'''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...
89
'''simple docstring''' import unittest import numpy as np from datasets import load_dataset from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixi...
304
0
from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig lowercase__ :List[Any] = { "susnato/ernie-m-base_pytorch": "https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json", "susnato/ernie-m-large_pytorch": "https://huggingface...
97
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFXLMRoberta...
97
1
import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate lowercase : int = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow('', '|', ...
232
from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def lowercase ( SCREAMING_SNAKE_CASE__ : Optional[int] ) -> int: return getitem, k def lowercase ( SCREAMING_SNAKE_CASE__ : Tuple , S...
317
0
class __lowercase : """simple docstring""" def __init__( self , A ) -> None: snake_case : List[Any] = set_counts snake_case : Tuple = max(A ) snake_case : Union[str, Any] = len(A ) ...
176
import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from transformers.utils import loggi...
176
1
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() a_ = logging.get_logger(__name__) a_ = 'https://openaipublic.azureedge.net/jukebox/mode...
76
import math class _UpperCamelCase : def __init__( self :Union[str, Any] , lowerCamelCase :Union[str, Any]=0 ) -> Tuple: # a graph with Node 0,1,...,N-1 UpperCAmelCase__ = n UpperCAmelCase__ = [ [math.inf for j in range(0 ...
169
0
"""simple docstring""" from random import randint from tempfile import TemporaryFile import numpy as np def snake_case (A_ :str , A_ :List[str] , A_ :List[Any] ): '''simple docstring''' a : Tuple = 0 if start < end: a : Opti...
186
"""simple docstring""" import unittest from transformers import SPIECE_UNDERLINE, XLNetTokenizer, XLNetTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _UpperCamelCase : List...
186
1
'''simple docstring''' from math import ceil, sqrt def lowerCAmelCase_ ( _lowerCamelCase: int = 1_00_00_00 ): __SCREAMING_SNAKE_CASE : Union[str, Any] = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: __SCREAMING_SNAKE_C...
112
'''simple docstring''' from collections.abc import Iterable from typing import Any class _UpperCamelCase : '''simple docstring''' def __init__( self : Optional[int] , lowerCAmelCase__ : int | None = None ): """simple docstring""" __SCREAMIN...
112
1
'''simple docstring''' import unittest from transformers import SPIECE_UNDERLINE, XLNetTokenizer, XLNetTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _lowercase : Dict ...
364
'''simple docstring''' import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def lowerCamelCase__ ( A : int , A : int , A : int , A : int , A : int , A ...
91
0
"""simple docstring""" 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 ImageProcessingSavin...
165
"""simple docstring""" import argparse import json import os import torch from transformers import LukeConfig, LukeModel, LukeTokenizer, RobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def A ( snake_case__ , snake_case__ , snake_ca...
165
1
"""simple docstring""" import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from a...
38
"""simple docstring""" import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() __UpperCamelCase = logging.get_logger(__name__) def lowercase (SCREAMING_SNAKE_C...
38
1
'''simple docstring''' from ....configuration_utils import PretrainedConfig from ....utils import logging __snake_case = logging.get_logger(__name__) __snake_case = { '''CarlCochet/trajectory-transformer-halfcheetah-medium-v2''': ( '''https://huggingface.co/CarlCochet/t...
97
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase : int = logging.get_logger(__name__) lowercase : Union[str, Any] = { "xlnet-base-cased": "https://huggingface.co/xlnet-base-cased/resolve/...
42
0
"""simple docstring""" # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow...
74
"""simple docstring""" from __future__ import annotations import math __UpperCamelCase : Dict = '''2020.9.26''' __UpperCamelCase : Tuple = '''xcodz-dot, cclaus, dhruvmanila''' def __SCREAMING_SNAKE_CASE ( A_ , A_ , A_ , A_ , A_ ): if n...
74
1
import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class lowercase__ : def __init__( self : str , UpperCAmelCase_ : Tuple , UpperCAmelCase_ : int , UpperCAmelCase_ : int ): if dst_width < 0 or dst_height < 0: ...
176
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_bart import BartTokenizer __snake_ca...
176
1
"""simple docstring""" import argparse import dataclasses import json import logging import os import shutil from typing import List, Optional import datasets from accelerate import Accelerator from datasets import load_dataset from finetuning import finetune from tqdm.auto import tqdm import transformers from...
303
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils i...
303
1
import random import unittest import numpy as np from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionImgaImgPipeline, PNDMScheduler, ) from diffusers.utils import floats_tensor from diffuse...
280
import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import version from torch import nn ...
280
1
"""simple docstring""" __SCREAMING_SNAKE_CASE : Optional[Any] = 256 # Modulus to hash a string __SCREAMING_SNAKE_CASE : Optional[int] = 1_000_003 def _a ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> bool: snake_case_ = len(_S...
369
"""simple docstring""" def _a ( _SCREAMING_SNAKE_CASE ) -> list: if len(_SCREAMING_SNAKE_CASE ) <= 1: return [tuple(_SCREAMING_SNAKE_CASE )] snake_case_ = [] def generate(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): if k == 1:...
233
0
"""simple docstring""" def lowercase (snake_case__ : list[int] ) -> int: '''simple docstring''' if not numbers: return 0 if not isinstance(snake_case__ , (list, tuple) ) or not all( isinstance(snake_case__ , snake_case...
155
"""simple docstring""" from __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup a = 'https://www.indeed.co.in/jobs?q=mobile+app+development&l=' def lowercase (snake_case__ : str = "mumbai" ) -...
155
1
'''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_distilbert import DistilBertTokenizer __snake_case = logging.get_logger(__nam...
219
'''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/LICENSE-2.0 # # Un...
219
1
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class SCREAMING_SNAKE_CASE__ : A_ : int A_ : TreeNode | None = None A_ : TreeNode | None = None snake_ca...
24
'''simple docstring''' def SCREAMING_SNAKE_CASE__ ( __A = 1_000_000 ) -> int: _snake_case = limit + 1 _snake_case = [0] * limit for first_term in range(1 , __A ): for n in range(__A , __A , __A ): _snake_case = first_term + n / first_term if commo...
42
0
from __future__ import annotations from collections.abc import Sequence from typing import Literal def lowercase__( __SCREAMING_SNAKE_CASE : str , __SCREAMING_SNAKE_CASE : str ): lowercase_ : List[str] = list(__SCREAMING_SNAKE_CASE ) lowercas...
362
"""simple docstring""" class UpperCamelCase : def __init__( self ,__UpperCamelCase ,__UpperCamelCase ) -> int: '''simple docstring''' lowercase_ : List[Any] = name lowercase_ : int = val def __str__( s...
321
0
'''simple docstring''' import math import sys def __lowerCAmelCase ( UpperCamelCase__ ) -> str: __lowerCamelCase = '''''' try: with open(UpperCamelCase__ , '''rb''' ) as binary_file: __lowerCamelCase = binary_file.read() for dat in data: _...
67
import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging _UpperCAmelCase : Optional[int] = logging.get_logger(__name__) def SCREAMING_SNAKE_CASE ( _UpperCAmelC...
50
0
'''simple docstring''' import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase = { 'facebook/mask2former-swin-small-coco-instance': ( 'https://hugging...
187
'''simple docstring''' from __future__ import annotations import pandas as pd def _snake_case ( _SCREAMING_SNAKE_CASE : list[int] , _SCREAMING_SNAKE_CASE : list[int] , _SCREAMING_SNAKE_CASE : int ) -> list[int]: """si...
187
1
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowerCamelCase : Optional[int] = {"""configuration_mmbt""": ["""MMBTConfig"""]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except O...
52
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class A ( _UpperCAmelCase ): """simple...
7
0
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 lowerCamelCase_ = '''src/transformers''' # This is to make sure the transformers module imported is t...
358
import argparse from collections import defaultdict import yaml lowerCamelCase_ = '''docs/source/en/_toctree.yml''' def __magic_name__ ( __a : Union[str, Any] ): '''simple docstring''' UpperCamelCase__ = defaultdict(__a ) for doc in model_doc:...
178
0
'''simple docstring''' def snake_case_ ( SCREAMING_SNAKE_CASE__ ): """simple docstring""" _SCREAMING_SNAKE_CASE : Union[str, Any] = len(SCREAMING_SNAKE_CASE__ ) for i in range(SCREAMING_SNAKE_CASE__ ): for j in range(i + 1 , SCREAMING_SN...
200
'''simple docstring''' import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ...test_modeling_...
200
1
'''simple docstring''' import colorsys from PIL import Image # type: ignore def a ( __a , __a , __a ) -> float: '''simple docstring''' UpperCamelCase__ :Dict = x UpperCamelCase__ :str = y for step in range(__a ): # noq...
360
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when sw...
219
0