code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : str = { """configuration_whisper""": ["""WHISPER_PRETRAINED_CONFIG_ARCH...
13
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTRACTOR_MAPPING, AutoConfig, AutoFeatureExtractor, WavaVecaConfig, WavaVecaFeatureExtractor, ) from transformers.testing_utils import DUM...
12
0
def UpperCAmelCase_( a__ ): """simple docstring""" SCREAMING_SNAKE_CASE : List[str] = [0] * len(a__ ) for i in range(1 , len(a__ ) ): # use last results for better performance - dynamic programming SCREAMING_SNAKE_CASE : Union[str, An...
19
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ConvNextConfig, UperNetConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import is_torch_available, is_vision_available f...
19
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available lowerCAmelCase__ : List[Any] = {'configuration_speech_encoder_decoder': ['SpeechEncoderDecoderConfig']} try: if not is_torch_availab...
98
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase__ : str = { 'configuration_mctct': ['MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MCTCTConfig'], 'feature_extraction_mctct': ['MCTCTFeatureE...
98
1
"""simple docstring""" import os import unittest from transformers import LayoutLMTokenizer, LayoutLMTokenizerFast from transformers.models.layoutlm.tokenization_layoutlm import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTe...
318
"""simple docstring""" import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_...
318
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { """abeja/gpt-neox-japanese-2.7b""": """https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/main/config.json""", } class a_...
58
"""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 # #...
203
0
import json import os import shutil import tempfile from unittest import TestCase from transformers import BartTokenizer, BartTokenizerFast, DPRQuestionEncoderTokenizer, DPRQuestionEncoderTokenizerFast from transformers.models.bart.configuration_bart import BartConfig from transformers.models.bert.tokenization_b...
262
from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline UpperCAmelCase__ : Dict =logging.get_logger(__name__) # pylint: disable=invalid-name class __A ( a ): def _...
262
1
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging SCREAMING_SN...
48
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils import logging ...
48
1
from math import pi def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ) -> float: return 2 * pi * radius * (angle / 360) if __name__ == "__main__": print(arc_length(90, 10))
307
# Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position lowerCamelCase__ = """2.13.1""" import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version.parse("""3.7"""): ...
307
1
class A_ : def __init__( self : Any ,SCREAMING_SNAKE_CASE__ : list[int]): __lowerCamelCase : int = len(SCREAMING_SNAKE_CASE__) __lowerCamelCase : int = [0] * len_array if len_array > 0: __lowerCamelCase : Optiona...
73
from __future__ import annotations import time a =list[tuple[int, int]] a =[ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, ...
73
1
from __future__ import annotations def _UpperCAmelCase ( SCREAMING_SNAKE_CASE__ : str , SCREAMING_SNAKE_CASE__ : list[str] | None = None , SCREAMING_SNAKE_CASE__ : dict[str, float] | None = None , SCREAMING_SNAKE_CASE__ : bool = False , ): _...
117
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
117
1
"""simple docstring""" import collections import gzip import os import urllib import numpy from tensorflow.python.framework import dtypes, random_seed from tensorflow.python.platform import gfile from tensorflow.python.util.deprecation import deprecated lowerCamelCase__ : str = ...
246
"""simple docstring""" import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def UpperCamelCase ( _lowerCAmelCase : Any, _lowerCAmelCase : List[str], _lowerCAmelCase : Dict ) -> str: _UpperCAmelCase...
246
1
import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger lowercase_ = get_logger(__name__) lowercase_ = R'\n Args:\n input_ids (`jnp.ndarray` of shape `(batch_size, sequence_length)`):\n ...
369
def UpperCamelCase__ ( SCREAMING_SNAKE_CASE__ ): __lowerCamelCase : str = 0 __lowerCamelCase : Tuple = len(SCREAMING_SNAKE_CASE__ ) for i in range(n - 1 ): for j in range(i + 1 , SCREAMING_SNAKE_CASE__ ): if arr[i] > arr[j]: num_inversions +=...
194
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_fe...
34
import random from .binary_exp_mod import bin_exp_mod def UpperCamelCase__ ( A__ , A__=1000 ) -> Optional[int]: if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd snake_case__ : List[Any] = n - 1 snake_case...
143
0
import argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def __UpperCamelCase ( _A : str , _A : List[Any] , _A : Optional[Any] ) ...
49
import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_confi...
49
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a : Tuple = { "configuration_megatron_bert": ["MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MegatronBertConfig"], } try: if not is_torch_available(): ...
311
'''simple docstring''' from datetime import datetime import matplotlib.pyplot as plt import torch def lowercase ( __magic_name__ ): '''simple docstring''' for param in module.parameters(): UpperCAmelCase : Any = False def lowercase ...
311
1
import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging.INFO) lowerCAmelCase__ : Optional...
118
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils import logging logging.set_verbos...
118
1
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_attention_mask if is_torch_a...
285
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow if is_torch_available(): import torch from transformers import XLMRobertaModel @require_sentencepiece @require_tok...
37
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __lowercase = {'''configuration_reformer''': ['''REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Reform...
369
from __future__ import annotations def lowerCamelCase ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): '''simple docstring''' print(f"""Vertex\tShortest Distance from vertex {src}""" ) for i, d in enumerate(SCREAMING_SNAKE_CASE ): print(f"""{i}\t\t{d}""" ) d...
105
0
import json import os import re import unittest from transformers import CodeGenTokenizer, CodeGenTokenizerFast from transformers.models.codegen.tokenization_codegen import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin ...
244
import torch from diffusers import StableDiffusionPipeline lowerCamelCase_ = '''path-to-your-trained-model''' lowerCamelCase_ = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.floataa).to('''cuda''') lowerCamelCase_ = '''A photo of sks dog in a bucket''' lowerCamel...
244
1
'''simple docstring''' import logging import os import threading import time try: import warnings except ImportError: __UpperCAmelCase =None try: import msvcrt except ImportError: __UpperCAmelCase =None try: import fcntl except ImportError: __UpperCAmelCase =None #...
237
'''simple docstring''' 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 ...
237
1
from math import isqrt, loga def _A ( SCREAMING_SNAKE_CASE : int ): """simple docstring""" a__ : Optional[Any] =[True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(...
95
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": a_ = argparse.ArgumentParser( description=( 'Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Learned' ' Distillatio...
175
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : int = logging.get_logger(__name__) _lowerCAmelCase : Dict = { '''microsoft/git-base''': '''https://huggingface.co/microsoft/git-base/resol...
70
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _lowerCAmelCase : Dict = { '''configuration_blip''': [ '''BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''', ''...
70
1
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 @slow @requ...
82
"""simple docstring""" import argparse import os import torch from transformers import FlavaConfig, FlavaForPreTraining from transformers.models.flava.convert_dalle_to_flava_codebook import convert_dalle_checkpoint def lowercase ( _SCREAMING_SNAKE_CASE : int ): ...
260
0
def __A ( __lowerCamelCase , __lowerCamelCase ) -> str: if number < 0 or shift_amount < 0: raise ValueError("""both inputs must be positive integers""" ) a = str(bin(__lowerCamelCase ) ) binary_number += "0" * shift_amount return binary_number ...
347
import io import itertools import json from dataclasses import dataclass from typing import Optional import pyarrow as pa import pyarrow.json as paj import datasets from datasets.table import table_cast from datasets.utils.file_utils import readline __UpperCamelCase : Any = datasets.ut...
347
1
'''simple docstring''' import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformers...
67
'''simple docstring''' from sklearn.metrics import recall_score import datasets __A : Dict = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is...
120
0
import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class UpperCAmelCase__ ( A__ ): """simple docstring""" def lowercase_ ( self : Any , __lowerCamelCase : str ) -> List[str]: with open(__lowerCame...
218
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, resolve_trust_remote_code from ...image_p...
218
1
import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHECKING: from ... import PreTrai...
195
'''simple docstring''' from __future__ import annotations from math import pi, sqrt def UpperCAmelCase ( a_ , a_ ) -> tuple: """simple docstring""" if inductance <= 0: raise ValueError("""Inductance cannot be 0 or negative""" ) ...
344
0
import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class UpperCAmelCase__ ( A__ ): """simple docstring""" @require_torch def lowercase_ ( self : Optional[Any] ) ...
350
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : Any = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : int = { '''edbeeching/decision-transformer-gym-hopper-medium''': ( '''https://huggingface.co/ed...
218
0
import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () __a = np.linspace(start=0, stop=7_5, num=7_5, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership function # (trapmf(),...
30
"""simple docstring""" import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextI...
96
0
import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test_mo...
110
import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from .....
110
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.model...
242
"""simple docstring""" from itertools import product def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> list[int]: lowerCAmelCase__ : Union[str, Any] = sides_number lowerCAmelCase__ : Optional[int] = max_face_number * dice_number ...
242
1
from manim import * class lowerCAmelCase_ ( lowerCamelCase__ ): def snake_case_ ( self ) -> int: UpperCamelCase : Dict = Rectangle(height=0.5, width=0.5 ) UpperCamelCase : Union[str, Any] = Rectangle(height=0.46, width=...
358
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import tor...
103
0
'''simple docstring''' from __future__ import annotations from PIL import Image # Define glider example __snake_case =[ [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,...
4
"""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
import warnings from .generation import TFGenerationMixin class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' warnings.warn( """Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will """ """be removed in Transformers ...
350
def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : int): '''simple docstring''' while b: lowerCAmelCase__ , lowerCAmelCase__ : Optional[Any] = b, a % b return a def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase...
94
0
from ....configuration_utils import PretrainedConfig from ....utils import logging A__ = logging.get_logger(__name__) A__ = { """speechbrain/m-ctc-t-large""": """https://huggingface.co/speechbrain/m-ctc-t-large/resolve/main/config.json""", # See all M-CTC-T models at https://huggi...
82
from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class __lowerCAmelCase ( lowerCamelCase__ , lowerCamelCase__ ): @register_to_config def...
82
1
"""simple docstring""" import unittest import numpy as np import requests from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs ...
358
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFI...
105
0
"""simple docstring""" from __future__ import annotations import os from collections.abc import Mapping __snake_case : Dict = tuple[int, int] class A__ : '''simple docstring''' def __init__( self: Optional[Any] , _SCREAMING_SNAKE...
269
"""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_modeli...
269
1
"""simple docstring""" # A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and v to...
255
"""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 import AutoTokeni...
255
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { '''xlm-roberta-base''': ''...
141
'''simple docstring''' from collections.abc import Sequence def __UpperCamelCase ( lowercase__ : Sequence[float], lowercase__ : float ): '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(lowercase__ ) ) def __UpperCamelCase ( lowe...
141
1
def UpperCamelCase_( _snake_case : int ): """simple docstring""" __a =n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(27)) print(perfect_cube(4))
368
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sag...
308
0
import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modules impor...
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/l...
298
0
import heapq as hq import math from collections.abc import Iterator class A : def __init__(self : Union[str, Any] , __UpperCAmelCase : List[str] ) -> List[Any]: """simple docstring""" UpperCAmelCase__ = str(id_ ) Up...
143
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_pegasus import PegasusTokenizer else: Upper...
143
1
"""simple docstring""" import math def _snake_case ( ): lowerCAmelCase : Union[str, Any] = input('''Enter message: ''' ) lowerCAmelCase : Optional[int] = int(input(f'''Enter key [2-{len(_snake_case ) - 1}]: ''' ) ) lowerCAmelCase : str = input('''Encr...
60
"""simple docstring""" 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_configura...
60
1
import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ , lowercase_ , lowercase_ ) -> A...
231
from __future__ import annotations import csv import requests from bsa import BeautifulSoup def SCREAMING_SNAKE_CASE ( lowercase_ = "" ) -> dict[str, float]: """simple docstring""" A__ = url or '''https://www.imdb.com/chart/top/?ref_=nv_mv_250''' A__ = ...
231
1
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : Any ) -> List[str]: if upper_limit < 0: raise ValueError('''Limit for the Catalan sequence must be ≥ 0''' ) UpperCAmelCase : int = [0] * (upper_limit + 1) # Ba...
23
'''simple docstring''' import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def __lowe...
234
0
def lowerCAmelCase_ ( )-> Tuple: '''simple docstring''' UpperCAmelCase : Union[str, Any] =[] UpperCAmelCase : Tuple =1 while len(__lowerCAmelCase ) < 1e6: constant.append(str(__lowerCAmelCase ) ) i += 1 UpperC...
78
import sys def lowerCAmelCase_ ( __lowerCAmelCase )-> Any: '''simple docstring''' UpperCAmelCase : Optional[Any] =len(__lowerCAmelCase ) UpperCAmelCase : List[str] =[[0 for x in range(__lowerCAmelCase )] for x in range(__lowerCAmelCase )] ...
78
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__: int = logging.get_logger(__name__) UpperCamelCase__: List[Any] = { "naver-clova-ix/donut-base": "https://huggingface.co/naver-clova-ix/donut-...
23
'''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 ...
23
1
'''simple docstring''' import fcntl import os import socket import torch import torch.distributed as dist def __magic_name__ ( *__UpperCAmelCase ) -> Tuple: '''simple docstring''' with open(SCREAMING_SNAKE_CASE__, '''r''' ) as fh: fcntl.flock(SCREAMING_SNAKE_CASE__, ...
367
'''simple docstring''' from math import asin, atan, cos, radians, sin, sqrt, tan a : Tuple = 6_378_137.0 a : int = 6_356_752.314_245 a : Dict = 637_8137 def __magic_name__ ( __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase ) -> ...
72
0
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowercase__ : str = logging.get_logger(__name__) lowercase__ : Any = { 'SenseTime/deformable-detr': 'https://huggingface.co...
324
'''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 import...
324
1
'''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...
366
'''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
0
"""simple docstring""" import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configu...
292
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_ax...
292
1
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 lowercase : str = logging.get_logger(__name__) lowercase : st...
364
import datasets from .evaluate import evaluate lowercase : Dict = '''\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, journal={arXiv preprint ...
36
0
import numpy as np def __SCREAMING_SNAKE_CASE ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ = 1E-12 , UpperCamelCase__ = 100 , ) -> tuple[float, np.ndarray]: '''simple docstring''' assert np.shape(UpperCamelCase__ )[0] == np.shape(UpperCamelCase__ )[1] ...
273
def __SCREAMING_SNAKE_CASE ( UpperCamelCase__ ) -> list[int]: '''simple docstring''' if length <= 0 or not isinstance(UpperCamelCase__ , UpperCamelCase__ ): raise ValueError('''Length must be a positive integer.''' ) return [n * (2 * n - 1) for n in range(UpperCamelCase__ ...
273
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionSAGPipeline, UNetaDConditionModel, ) from diffusers.ut...
365
"""simple docstring""" import colorsys from PIL import Image # type: ignore def __lowerCamelCase ( a_ : float , a_ : float , a_ : int ) -> float: __SCREAMING_SNAKE_CASE :List[Any] = x __SCREAMING_SNAKE_CASE ...
239
0
'''simple docstring''' from itertools import product def __lowercase ( __lowercase , __lowercase ) -> list[int]: '''simple docstring''' _A = sides_number _A = max_face_number * dice_number _A = [0] * (max_total + 1) _A ...
79
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ = { '''configuration_longformer''': [ '''LONGFORMER_PRE...
79
1
'''simple docstring''' from __future__ import annotations __lowerCAmelCase = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] __lowerCAmelCase = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def __lowerCamelCase ( lowerCAmelCase_ ) -> ...
107
'''simple docstring''' import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from transformers i...
107
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A__ : Union[str, Any] = { "configuration_mgp_str": ["MGP_STR_PRETRAINED_CONFIG_ARCHIVE_MAP", "MgpstrConfig"], "processing_mgp_str": ["Mgpstr...
144
'''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_m...
125
0
import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": snake_case : Optional[int] = pd.read_csv('''sample_data.csv''', header=None) ...
355
from collections import defaultdict from math import ceil, sqrt def __lowercase ( __lowerCAmelCase : int = 1_0_0_0_0_0_0 , __lowerCAmelCase : int = 1_0 ): a__ = defaultdict(__lowerCAmelCase ) for outer_width in range(3 , (t_limit // 4) + 2...
109
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging SCREAMING_SNAKE_CASE_: str =logging.get_logger(__name__) SCREAMING_SNAKE_CASE_: Optional[Any] ={ 'g...
1
'''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
'''simple docstring''' import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import B...
365
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : Tuple =logging.get_logger(__name__) lowerCAmelCase : str ={ '''microsoft/cvt-13''': '''https://huggingface.co/microsoft/cvt-13/resolve/main/config...
147
0
from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def lowerCAmelCase__ ( lowerCamelCase_ : str): '''simple docstring''' if not is_accelerate_available(): return method lowerCAmelCase__ ...
129
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggi...
129
1
'''simple docstring''' from math import sqrt def lowercase (_A ): """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0:...
25
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.ut...
25
1
def A ( _lowerCamelCase , _lowerCamelCase ): '''simple docstring''' return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def A ( _lowerCamelCase , _lowerCamelCase=0 ): '''simple docstring''' return sorted(_lowerCamelCase...
36
def A ( _lowerCamelCase , _lowerCamelCase ): '''simple docstring''' if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) ** ...
36
1
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __lowercase: int = logging.get_logger(__name__) ...
368
'''simple docstring''' from __future__ import annotations def SCREAMING_SNAKE_CASE__( _UpperCamelCase : float , _UpperCamelCase : float , _UpperCamelCase : float , ) -> tuple: '''simple docstring''' if (electron_conc, ho...
31
0
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, logging, ) logging.set_ver...
43
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCamelCase_ = { """configuration_groupvit""": [ """GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GroupViTConfig""", """...
309
0
'''simple docstring''' import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class __UpperCamelCase ( __snake_case ): lowercase : Optional[int] = (PNDMScheduler,) lowercase : Optional[int] ...
361
'''simple docstring''' from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer __A : Tuple = logging.get_logge...
8
0
"""simple docstring""" from __future__ import annotations lowercase_ = 1.6_021e-19 # units = C def lowercase ( lowerCAmelCase__ : float , lowerCAmelCase__ : float , lowerCAmelCase__ : float , ) -> tuple[str, float]: if (conductivity, e...
45
"""simple docstring""" 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, ) lowercase_ = {"con...
45
1
"""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 from trans...
203
"""simple docstring""" from __future__ import annotations class __snake_case : def __init__( self , lowercase=None) -> Optional[Any]: '''simple docstring''' a__: int = data a__: str = None def __r...
203
1
from datetime import datetime as dt import os from github import Github _a = [ "good first issue", "good second issue", "good difficult issue", "feature request", "new model", "wip", ] def lowerCAmelCase__() -> List[Any]: '''simple docstring''' lo...
209
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_xlnet import...
209
1
import argparse from collections import defaultdict def _a ( lowerCamelCase: Union[str, Any] , lowerCamelCase: Tuple , lowerCamelCase: Union[str, Any] , lowerCamelCase: Optional[Any] , lowerCamelCase: Any ) -> Any: '''s...
352
import argparse import requests import torch from PIL import Image from torchvision.transforms import Compose, Normalize, Resize, ToTensor from transformers import SwinaSRConfig, SwinaSRForImageSuperResolution, SwinaSRImageProcessor def _a ( lowerCamelCase: List[str] ) -> ...
250
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowercase : List[Any] = logging.get_logger(__name__) __lowercase : ...
27
'''simple docstring''' from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def lowerCamelCase (_SCREAMING_SNAKE_CASE : int ): __a : int = int(number**0.5 ) return number == sq * sq def lowerCamelCase (_SCRE...
27
1
'''simple docstring''' class _lowercase : def __init__( self: str , UpperCamelCase__: int ): lowerCamelCase__ : int = size lowerCamelCase__ : Optional[Any] = [0] * size lowerCamelCase__ : str = [0] * size...
359
'''simple docstring''' from math import asin, atan, cos, radians, sin, sqrt, tan _A : List[str] =637_8137.0 _A : Dict =635_6752.31_4245 _A : int =6_378_137 def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase ...
129
0
'''simple docstring''' from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar lowercase__ : List[str] = TypeVar('''KEY''') lowercase__ : int = TypeVar('''VAL''') @dataclass(frozen=__snake_...
190
"""simple docstring""" def lowerCamelCase__ ( _lowerCamelCase : int , _lowerCamelCase : int ) -> int: lowerCamelCase_ = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): lowerCamelCase_ = ...
183
0
'''simple docstring''' from __future__ import annotations from random import choice def UpperCamelCase_ ( A__ : Dict ): '''simple docstring''' return choice(A__ ) def UpperCamelCase_ ( A__ : list[int] , A...
369
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : List[str] = { "configuration_bigbird_pegasus": [ "BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP", "BigBirdPeg...
89
0
'''simple docstring''' import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline f...
125
'''simple docstring''' 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_a...
125
1
'''simple docstring''' 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 UpperCamelCase_ : Any = '''src/transformers''' # This is to ma...
142
'''simple docstring''' from manim import * class _a ( __lowerCAmelCase ): def _lowercase ( self ) -> Optional[int]: _snake_case = Rectangle(height=0.5 ,width=0.5 ) _snake_case = Rectangle(height=0.4_6 ,width=0.4_6 ...
142
1
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def lowerCAmelCase ( _lowerCAmelCase : Any , _lowerCAmelCase : str , _lowerCAmelCase : str , ...
169
import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() _lowerCAmelCase : Any = logging.get_logger(__name__) _lowerCAmelCase : Tuple = {name: getattr(transformers, name +...
169
1
"""simple docstring""" from collections import deque from math import floor from random import random from time import time class lowerCamelCase__ : def __init__( self ): UpperCAmelCase = {} def _UpperCamelCase ( self ,A ,A ,A=1 ): ...
358
"""simple docstring""" from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if...
234
0
import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, ...
340
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) def...
340
1
import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_common import FlaxMode...
361
import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_available, is_torch_available, ) from ...
151
0
from manim import * class a__ ( UpperCAmelCase ): """simple docstring""" def _lowercase ( self : Tuple ) ->int: """simple docstring""" SCREAMING_SNAKE_CASE : Union[str, Any] = R...
245
from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, slow from ..t...
245
1
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require...
351
'''simple docstring''' def lowercase__( __UpperCamelCase: int ): """simple docstring""" if divisor % 5 == 0 or divisor % 2 == 0: return 0 SCREAMING_SNAKE_CASE : str = 1 SCREAMING_SNAKE_CASE : Optional[int] = 1 whi...
246
0
'''simple docstring''' from __future__ import annotations import math def lowercase_ ( _lowercase , _lowercase , _lowercase , _lowercase , _lowercase ) -> int: '''simple docstring''' if depth < 0: raise ValueError('''Depth cannot be less than 0''' ) if not sc...
318
'''simple docstring''' from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class snake_case__ : a_ = 42 # [batch_size x 3] a_ = 42 # [batch_size x 3] a_ = 42 # [batch_size x 3] a_ = 42 # [batch_siz...
304
0
import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, ControlNetModel, DDIMScheduler, StableDiffusionControlNetImgaImgPipeline, UNeta...
351
from __future__ import annotations _A : List[str] = '#' class __SCREAMING_SNAKE_CASE : def __init__( self : List[Any] ) ->None: lowerCamelCase__ : dict = {} def __lowerCamelCase ( self : Un...
265
0
"""simple docstring""" from . import __version__ # Backward compatibility imports, to make sure all those objects can be found in file_utils from .utils import ( CLOUDFRONT_DISTRIB_PREFIX, CONFIG_NAME, DISABLE_TELEMETRY, DUMMY_INPUTS, DUMMY_MASK, ENV_VARS_TRUE_AND_AUTO_VALUES, ENV_VARS...
77
import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu, calculate_rouge, chunks, pars...
328
0
from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar lowerCAmelCase__ :int = TypeVar('''KEY''') lowerCAmelCase__ :List[str] = TypeVar('''VAL''') @dataclass(frozen=UpperCAmelCase , slots=UpperCAmelCase ...
369
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class __a ( UpperCAmelCase ): _a : Union[List[np.ndarray], torch....
185
0
'''simple docstring''' import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import numpy as np import pandas as pd from datasets import load_dataset import transformers from transformers import ( AutoConfig, BartForS...
34
import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import PaddingStrategy, logging UpperC...
345
0
'''simple docstring''' 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 transform...
55
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __snake_case ={ """configuration_swiftformer""": [ """SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """S...
55
1
import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_vision, slow, torch_device ...
302
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase__ = { """configuration_electra""": ["""ELECTRA_PRETRAINED_CONFIG_ARCHIVE_MAP""",...
302
1
'''simple docstring''' def _lowercase ( __A ): '''simple docstring''' return " ".join( """""".join(word[::-1] ) if len(__A ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(reverse_long_wo...
243
'''simple docstring''' import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def _lowercase ( *__A ): '''simple docstring''' if not isinstance(__A ,__A ): __UpperCamelCase = list(_...
243
1
'''simple docstring''' from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class lowerCAmelCase__ : lowerCAmelCase_ = 42 # [batch_size x 3] lowerCAmelCase_ = 42 # [batch_size x 3] lowerCAme...
93
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[Any] = logging.get_logger(__name__) _lowercase : List[str] = { "google/pix2st...
93
1
"""simple docstring""" from collections import defaultdict def _A (__a , __a ) -> bool: """simple docstring""" SCREAMING_SNAKE_CASE_ : Dict = first_str.lower().strip() SCREAMING_SNAKE_CASE_ : List[Any] = second_str.lower().strip() # Rem...
318
"""simple docstring""" import argparse import os import re import packaging.version UpperCAmelCase_ : Any = """examples/""" UpperCAmelCase_ : Optional[int] = { """examples""": (re.compile(r"""^check_min_version\(\"[^\"]+\"\)\s*$""", re.MULTILINE), """check...
318
1
"""simple docstring""" import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) __snake_case : int = logging.getLo...
269
"""simple docstring""" from __future__ import annotations import time import numpy as np __snake_case : Optional[Any] = [8, 5, 9, 7] __snake_case : List[Any] = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ...
269
1
from __future__ import annotations from statistics import mean def UpperCamelCase_( _snake_case : list[int] , _snake_case : list[int] , _snake_case : int ): """simple docstring""" __a =[0] * no_of_processes __a =[0] * ...
308
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 transforme...
308
1
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): ...
63
'''simple docstring''' from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable lowerCAmelCase_ : int = {'configuration_gpt_neox': ['GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPT...
63
1
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType,...
330
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 loa...
330
1
import sys UpperCAmelCase__ = ( "73167176531330624919225119674426574742355349194934" "96983520312774506326239578318016984801869478851843" "85861560789112949495459501737958331952853208805511" "12540698747158523863050715693290963295227443043557" "668966489504452445231617318564030987111217...
339
import requests from bsa import BeautifulSoup def A ( _UpperCAmelCase : str , _UpperCAmelCase : dict ) -> str: '''simple docstring''' _UpperCAmelCase = BeautifulSoup(requests.get(_UpperCAmelCase , params=_UpperCAmelCase ).content , 'h...
339
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __UpperCAmelCase = { 'configuration_groupvit': [ 'GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GroupViTConfig', 'GroupViTOnnxConfig', '...
355
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 __UpperCamelCase ( lowercase__ : Optio...
28
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging snake_case_ : Union[str, Any] = logging.get_logger(__name__) snake_ca...
51
"""simple docstring""" import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def _UpperCAmelCase ( __lowerCamelCase : int = 3 ) -> qiskit.result.counts.Counts: if isinstance(__lowerCamelCase , __l...
288
0
from __future__ import annotations a__: str = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } class SCREAMING_SNAKE_CASE__ : def __init__( self,__lowerCa...
368
def UpperCamelCase__( UpperCamelCase__ : int = 1_00 )->int: A__ = (n * (n + 1) // 2) ** 2 A__ = n * (n + 1) * (2 * n + 1) // 6 return sum_cubes - sum_squares if __name__ == "__main__": print(F"{solution() = }")
39
0