code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
import qiskit def UpperCAmelCase_ ( __UpperCAmelCase : int , __UpperCAmelCase : int ) -> qiskit.result.counts.Counts: SCREAMING_SNAKE_CASE_ = qiskit.Aer.get_backend('aer_simulator' ) # Create a Quantum Circuit acting on the q register SCREAMING_S...
31
from ..utils import DummyObject, requires_backends class lowercase__ ( metaclass=__SCREAMING_SNAKE_CASE ): A__= ['flax', 'transformers'] def __init__( self : int , *_lowercase : Union[str, Any] , **_lowercase : List[Any] ): ...
475
0
# using dfs for finding eulerian path traversal def snake_case ( snake_case__ :Any , snake_case__ :Union[str, Any] , snake_case__ :Union[str, Any] , snake_case__ :Tuple=None) -> Dict: _A = (path or []) + [u] for v in graph[u]: ...
83
import unittest from transformers import DebertaVaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor ...
83
1
'''simple docstring''' import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import BatchEncoding, PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE_: Any =logg...
78
"""simple docstring""" # flake8: noqa # Lint as: python3 A_ : List[str] = [ "VerificationMode", "Version", "disable_progress_bar", "enable_progress_bar", "is_progress_bar_enabled", "experimental", ] from .info_utils import VerificationMode from .logg...
196
0
"""simple docstring""" import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) ...
556
"""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_sentence...
556
1
'''simple docstring''' from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __lowerCAmelCase ( __magic_name__ ): ...
98
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets lowercase__ : str = '\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n and Sa...
98
1
'''simple docstring''' import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weig...
216
'''simple docstring''' _UpperCamelCase : Optional[int] = [ (1_000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I'), ] def __UpperCAmelCase ( A ...
216
1
import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformers.tokenization_utils import AddedToken l...
383
import gc import threading import time import psutil import torch class lowerCAmelCase_ : """simple docstring""" def __init__( self ) -> Any: __UpperCamelCase = psutil.Process() __UpperCamelCase = False def __lowercase( self ) -> Opti...
383
1
"""simple docstring""" def SCREAMING_SNAKE_CASE__ ( SCREAMING_SNAKE_CASE__ : List[Any] = 1_0_0_0 ): """simple docstring""" snake_case_ : Optional[int] = 3 snake_case_ : int = 0 while a < n: if a % 3 == 0 or a % 5 == 0: ...
716
"""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_channe...
48
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_donut import DonutImageProcessor _a : List[Any] = logging.get_logger(__name__) class lowercase_ ( a ): '''simple docstring''' def __init__( self , *a_ , **a_ ) -> N...
447
'''simple docstring''' def lowerCamelCase__ ( SCREAMING_SNAKE_CASE : List[Any] , SCREAMING_SNAKE_CASE : Union[str, Any] ): # "extended trapezoidal rule" # int(f) = dx/2 * (f1 + 2f2 + ... + fn) UpperCAmelCase = (boundary[1] - boundary[0]) / steps UpperCAmelCase = ...
447
1
"""simple docstring""" def SCREAMING_SNAKE_CASE ( lowerCamelCase_ = 4000000): a__ = [] a__ ,a__ = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(lowerCamelCase_) a__ ,a__ = b, a + b retur...
200
"""simple docstring""" import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings.warn(e) warnings.warn( 'Th...
200
1
import sys __UpperCamelCase : Union[str, Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '668966489504...
519
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class _UpperCamelCase : '''simple docstring''' def __init__( self : int , _lowerCamelCase : Collection[float] | None = None ): ...
519
1
from __future__ import annotations class lowerCAmelCase__ : '''simple docstring''' def __init__( self , lowercase ): _lowerCamelCase : int = data _lowerCamelCase : Node | None = None _lowerCamelCase : ...
718
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { """google/realm-cc-news-pretrained-embedder""": ( """https://huggingface.co/google/realm-cc-news-pretra...
492
0
class lowerCamelCase__ : '''simple docstring''' def __init__( self :Union[str, Any] , a :str = "" , a :bool = False ) -> None: # Mapping from the first character of the prefix of the node __UpperCamelCase : dict[str, RadixNode] = ...
557
from queue import Queue from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from ..models.auto import AutoTokenizer class lowerCamelCase__ : '''simple docstring''' def _lowerCamelCase ( self :Optional[Any] , a :int ) -> Any: ...
557
1
import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImageProcessor from diffusers.pip...
81
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
81
1
"""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 ...
103
'''simple docstring''' def lowerCAmelCase_ ( _lowerCamelCase: list ): if len(_lowerCamelCase ) < 2: return collection def circle_sort_util(_lowerCamelCase: list , _lowerCamelCase: int , _lowerCamelCase: int ) -> bool: __SCREAMING_SNAKE_CASE : Any = F...
578
0
import inspect import logging import os import random import shutil import tempfile import unittest import pytest import torch from torch import nn from torch.utils.data import DataLoader, TensorDataset from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_cuda fr...
715
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_modeling_common import ModelTest...
80
0
def __lowerCamelCase ( UpperCAmelCase_ : list[int] ): """simple docstring""" if not numbers: return 0 if not isinstance(UpperCAmelCase_ , (list, tuple) ) or not all( isinstance(UpperCAmelCase_ , UpperCAmelCase_ ) for number in numbe...
445
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available snake_case : Any = { '''configuration_gpt_neo''': ['''GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoConfig''', '''GPTNeoOnnxConfig'''], } try: ...
445
1
"""simple docstring""" from ....utils import logging __UpperCAmelCase = logging.get_logger(__name__) class __lowercase ( __lowerCamelCase ): def __init__( self : List[Any] ,A : List[Any] ,A : Optional[Any]=None ,A : str=2_048 ): ...
194
"""simple docstring""" import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def lowerCAmelCase ( __UpperCamelCase ): '''simple docstring''' if "model" in orig_key: UpperCAmelCase__ : List[str] = orig_key.replace("""model."...
194
1
'''simple docstring''' import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex _UpperCAmelCase : int = logging.getLogger(__name__) class lowercase_ : """si...
107
import colorsys from PIL import Image # type: ignore def lowerCamelCase__ ( snake_case_ : float , snake_case_ : float , snake_case_ : int ) -> float: __snake_case = x __snake_case = y for step in range(snake_case_ ): ...
592
0
'''simple docstring''' from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def SCREAMING_SNAKE_CASE ( a_ : NDArray[floataa] , a_ : NDArray[floataa] , a_ : list[int] , a_ : ...
490
'''simple docstring''' def SCREAMING_SNAKE_CASE ( a_ : int ): __a = 0 while num > 0: digit_sum += num % 10 num //= 10 return digit_sum def SCREAMING_SNAKE_CASE ( a_ : int = 100 ): __a = 1 __a = 2 for i ...
490
1
"""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 #...
289
"""simple docstring""" import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments ...
289
1
import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import TEXT_GU...
166
import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig snake_case_ : Optional[int] = { 'facebook/maskformer-swin-base...
166
1
"""simple docstring""" _lowerCAmelCase : List[Any] = '''Alexander Joslin''' import operator as op from .stack import Stack def lowerCamelCase_( _lowerCamelCase ) -> List[Any]: '''simple docstring''' _lowerCamelCase : Dict = {"*": op.mul, "...
46
__lowercase = """Alexander Joslin""" import operator as op from .stack import Stack def _lowerCamelCase ( SCREAMING_SNAKE_CASE ): '''simple docstring''' A_ = {'''*''': op.mul, '''/''': op.truediv, '''+''': op.add, '''-''': op.sub} A_ ...
203
0
"""simple docstring""" import argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() _UpperCamelCase = logging.get_logger(...
712
"""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 from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common imp...
74
0
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def lowerCamelCase ( ): '''simple docstring''' __UpperCamelCase :List[Any] = [randint(-1_000 , 1_000 ) for i in range(10 )] __UpperCamelCase...
167
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.import_utils import i...
462
0
import unittest import numpy as np from transformers import BertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from transformers.model...
704
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor lowercase = logging.get_logger(__name__) class UpperCamelCase_ ( snake_case_ ): '''simple docstring''' def __init__( self , *a , **a ) -> None: ...
607
0
'''simple docstring''' import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase f...
11
'''simple docstring''' import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( Autoen...
11
1
"""simple docstring""" def a_ ( _lowerCAmelCase : Any , _lowerCAmelCase : Tuple ): '''simple docstring''' lowercase__ : Optional[Any] = (boundary[1] - boundary[0]) / steps lowercase__ : Optional[int] = boundary[...
720
"""simple docstring""" from collections.abc import Sequence def a_ ( _lowerCAmelCase : Sequence[float] , _lowerCAmelCase : float ): '''simple docstring''' return sum(c * (x**i) for i, c in enumerate(_lowerCAmelCase ) ) def a_ ( _lowerCAmel...
645
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__ : int = { "configuration_blip_2": [ "BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP", "Blip2Config", "Blip2QFormerConfig", "Blip2VisionConfig", ...
622
"""simple docstring""" import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class SCREAMING_SNAKE_CASE__ ( lowercase ): """simple docstring""" a : int ="Speech2TextFeatureExtractor" a : int ="Speech...
645
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _UpperCAmelCase : List[str] = { """configuration_efficientformer""": [ ...
474
'''simple docstring''' from string import ascii_uppercase _UpperCAmelCase : Optional[int] = {char: i for i, char in enumerate(ascii_uppercase)} _UpperCAmelCase : Optional[int] = dict(enumerate(ascii_uppercase)) def __magic_name__( lowerCamelCase, lowerCamel...
474
1
from string import ascii_uppercase a_ = {str(ord(c) - 55): c for c in ascii_uppercase} def __lowerCAmelCase ( A_ : int , A_ : int ) -> str: if isinstance(A_ , A_ ): raise TypeError("int() can't convert non-string with explicit base" ) if num < 0: ...
221
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 import _PACKAGED_DATASETS_MO...
221
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __A : Optional[int] = logging.get_logger(__name__) __A : List[str] = { '''caidas/swin2sr-classicalsr-x2-64''': ( '''https://huggingface.co/caidas/swin2sr-classicalsr-x2-64/resolv...
714
"""simple docstring""" import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetSh...
141
0
import unittest import numpy as np import torch from diffusers import DDIMPipeline, DDIMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, slow, torch_device from ..pipeline_params import UNCONDITIONAL_IMAGE_GENERATION_BATCH_PARAMS, UNCONDIT...
469
# 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 req...
469
1
import copy import os from typing import TYPE_CHECKING, List, Union if TYPE_CHECKING: pass from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case :Optional[Any] =logging.get_logger(__name__) __snake_case :str ={ 'kakaobrain/align-base': 'https://h...
224
def lowerCamelCase_ ( lowerCAmelCase__ : list ) -> int: '''simple docstring''' if not grid or not grid[0]: raise TypeError('The grid does not contain the appropriate information' ) for cell_n in range(1 , len(grid[0] ) ): ...
224
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class SCREAMING_SNAKE_CASE ( metaclass=__a ): """simple docstring""" __A = ["torch", "torchsde"] def __init__( self : List[Any] , *__lowerCAmelCase : int , **__lowerCAmel...
309
'''simple docstring''' import operator as op snake_case = '''scaler.pt''' snake_case = '''pytorch_model''' snake_case = '''random_states''' snake_case = '''optimizer''' snake_case = '''scheduler''' snake_case = '''pytorch_model.bin''' snake_case = '''pytorch_model.bin.index.json...
309
1
snake_case = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ snake_case = [{"""type""": """...
488
from __future__ import annotations from cmath import sqrt def lowerCamelCase__ ( lowercase , lowercase , lowercase ): """simple docstring""" if a == 0: raise ValueError("Coefficient 'a' must not be zero." ) SCREAMING_SNAKE_CASE : List[str] = ...
488
1
'''simple docstring''' __SCREAMING_SNAKE_CASE = {} def __a ( lowerCAmelCase__ : List[Any] , lowerCAmelCase__ : List[str] , lowerCAmelCase__ : str ): # if we are absent twice, or late 3 consecutive days, # no further prize strings are possible if late...
688
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention ...
554
0
'''simple docstring''' import unittest from transformers import AutoTokenizer, NystromformerConfig, 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, ids_tensor, ...
715
'''simple docstring''' import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class A__ : """simple docstring""" def __init__( self ...
257
0
'''simple docstring''' import argparse import json from pathlib import Path import torch import torchaudio from datasets import load_dataset from huggingface_hub import hf_hub_download from transformers import ASTConfig, ASTFeatureExtractor, ASTForAudioClassification from transformers.utils import logging log...
432
'''simple docstring''' _lowerCAmelCase = "\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" _lowerCAmelCase = [{"type": "code", "content": INSTALL_CONTE...
432
1
"""simple docstring""" from itertools import count def _A ( __lowercase = 50 ): """simple docstring""" lowerCamelCase__ = [1] * min_block_length for n in count(__lowercase ): fill_count_functions.append(1 ) for block_l...
258
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __magic_name__ = { """configuration_bloom""": ["""BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BloomConfig""", """BloomOnnxConfig"...
258
1
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation ...
358
'''simple docstring''' 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 __l...
358
1
import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class _lowercase ( UpperCamelCase_ ): def __init__( self :str , lowerCAmelCase__ :Optional[int] , lowerCAmelCase__ :Optional[int] , lowerCAmelCase__ ...
712
from typing import Dict, List, Optional, Tuple, Union import torch from ...models import AutoencoderKL, TransformeraDModel from ...schedulers import KarrasDiffusionSchedulers from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class _lowercase ( A__ ): ...
260
0
from ..utils import DummyObject, requires_backends class a__ ( metaclass=UpperCamelCase__ ): a : int = ["""torch""", """scipy"""] def __init__( self , *A , **A ) -> str: '''simple docstring''' requires_b...
515
import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format="%(message)s") def SCREAMING_SNAKE_CASE ( __UpperCamelCase) -> np.ndarray: return input_array.reshape((input_array.size, 1)) def SCREAMING_SNAKE_CASE ( __UpperCame...
515
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __SCREAMING_SNAKE_CASE : List[str] = logging.get_logger(__name__) __SCREAMING_SNAKE_CASE : str = { 'SCUT-DLVCLab/lilt-roberta-en-base': ( 'https...
706
'''simple docstring''' from pathlib import PurePosixPath from typing import Optional import fsspec from fsspec import AbstractFileSystem from huggingface_hub.hf_api import DatasetInfo from ..utils.file_utils import get_authentication_headers_for_url from ..utils.hub import hf_hub_url class ...
697
0
import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class __UpperCamelCase ( lowerCAmelCase__ ): """simple docstring""" lowerCAmelCase_ = '''''' lowerCAmelCase_ ...
74
import os import unittest from transformers import MobileBertTokenizer, MobileBertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils import...
74
1
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf __SCREAMING_SNAKE_CASE = logging.get_logger(__name__) ...
718
from typing import Dict, Iterable, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_forma...
153
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, fl...
644
"""simple docstring""" def _UpperCAmelCase ( lowerCamelCase__ ): """simple docstring""" return " ".join( """""".join(word[::-1] ) if len(lowerCamelCase__ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(rev...
644
1
def UpperCamelCase_ ( __a ) -> bool: a__ : Tuple = (1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def UpperCamelCase_ ( __a = 5_000 ) -> int: a__ : List[Any] = [(i * (3 * i - 1)) // 2 for i in range(1 , __a )] ...
717
import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class A__ ( A__ ): """simple docstring""" _lowercase = 'MCTCTFeatureExtractor' _lowercase = 'AutoTokenizer' def __init__( self : Union[str, Any] , ...
151
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { """funnel-transformer/small""": """https://huggingface.co/funnel-transformer/small/resolve/main/config.json""", """funnel-transformer/small-base""": """https:...
74
# 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 switching between checkouts...
336
0
import os def __lowerCamelCase ( A__ : str = "matrix.txt" ) -> int: with open(os.path.join(os.path.dirname(A__ ) , A__ ) ) as in_file: lowerCamelCase_ : Tuple = in_file.read() lowerCamelCase_ : List[str] = [[int(A__ ) for cell in row.split(""",""" ...
709
import warnings from ...utils import logging from .image_processing_perceiver import PerceiverImageProcessor snake_case__ : Optional[int] = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ (a__ ): '''simple docstring''' def __init__( self : Any ...
171
0
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) lowerCAmelCase = pytest.mark.integration @pytest.mark.parametrize('''path''' , [''...
43
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandin...
110
0
SCREAMING_SNAKE_CASE__ : int = 6_5_5_2_1 def _A ( lowerCamelCase ): a__ : List[str] = 1 a__ : Optional[int] = 0 for plain_chr in plain_text: a__ : Union[str, Any] = (a + ord(lowerCamelCase )) % MOD_ADLER a__ : ...
629
import logging import math from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union import torch from .tensor_utils import tensor_tree_map, tree_map def _A ( lowerCamelCase ): a__ : List[str] = [] if isinstance(...
629
1
"""simple docstring""" from __future__ import annotations import collections import pprint from pathlib import Path def lowerCamelCase ( _UpperCamelCase : str ) -> str: '''simple docstring''' return "".join(sorted(_UpperCamelCase ) ) def lowerCamelCase ( _UpperCame...
139
"""simple docstring""" import math 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 SchedulerMixin, SchedulerOutput class lowerCamelCase__ ( A , A ): "...
139
1
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __lowercase : Any = logging.get_logger(__name__) __lowercase : Dict...
716
"""simple docstring""" import unittest from diffusers import FlaxAutoencoderKL from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): import jax @require_flax class lowerCA...
66
0
'''simple docstring''' def _UpperCamelCase ( UpperCamelCase__ = 1_0_0 ): UpperCAmelCase__ : int = 0 UpperCAmelCase__ : str = 0 for i in range(1 , n + 1 ): sum_of_squares += i**2 sum_of_ints += i return sum_of_ints**2 - sum_of_squares ...
407
'''simple docstring''' import re import time from typing import Optional import IPython.display as disp from ..trainer_callback import TrainerCallback from ..trainer_utils import IntervalStrategy, has_length def _UpperCamelCase ( UpperCamelCase__ ): UpperCAmelCase_...
407
1
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): imp...
86
import math from typing import Callable, List, Optional, Union import numpy as np import PIL import torch from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_up...
86
1
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenizati...
261
'''simple docstring''' from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common im...
261
1
'''simple docstring''' from math import sqrt def __UpperCAmelCase ( SCREAMING_SNAKE_CASE__: int ) -> int: """simple docstring""" __a = 0 for i in range(1, int(sqrt(SCREAMING_SNAKE_CASE__ ) + 1 ) ): if n % i == 0 and i != sqrt(SCREAMING...
270
'''simple docstring''' from maths.prime_factors import prime_factors def __UpperCAmelCase ( SCREAMING_SNAKE_CASE__: int ) -> int: """simple docstring""" if not isinstance(SCREAMING_SNAKE_CASE__, SCREAMING_SNAKE_CASE__ ): __a = f"""Input value of...
270
1
import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def __a ( __UpperCAmelCase : Optiona...
488
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_sentencepiece_available, logging if is_sentencepiec...
488
1
"""simple docstring""" def _snake_case ( UpperCAmelCase_ : list ): if len(UpperCAmelCase_ ) <= 1: return lst A__ = 1 while i < len(UpperCAmelCase_ ): if lst[i - 1] <= lst[i]: i += 1 else: A__ ...
500
"""simple docstring""" from typing import Dict, Optional import numpy as np import datasets SCREAMING_SNAKE_CASE_ : Tuple = '\nIoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union\nbetween the predicted segmentation and th...
500
1
import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from...
598
from __future__ import annotations import bisect def a_ ( __magic_name__ , __magic_name__ , __magic_name__ = 0 , __magic_name__ = -1 ) -> int: """simple docstring""" if hi < 0: snake_case : Optional[int] = len(__mag...
598
1
'''simple docstring''' from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import ConfigTester from ....
10
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import t...
10
1
'''simple docstring''' from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=a_ ) class A ( a_ ): # `task` is not a ClassVar since we want it...
22
"""simple docstring""" import os import unittest from transformers import FunnelTokenizer, FunnelTokenizerFast from transformers.models.funnel.tokenization_funnel import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @re...
237
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import LEDConfig, 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 fro...
51
"""simple docstring""" from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("KEY") lowerCamelCase__ = TypeVar("VAL") @dataclass(frozen=_UpperCamelCase , slots=_UpperCamelCase ) class __SCR...
51
1
"""simple docstring""" def a_ ( lowercase__ :Dict ): if not numbers: return 0 if not isinstance(lowercase__, (list, tuple) ) or not all( isinstance(lowercase__, lowercase__ ) for number in numbers ): raise ValueError("""numbers must be an iterable...
281
def _a ( lowerCamelCase ): if num < 0: return False lowerCamelCase : int = num lowerCamelCase : int = 0 while num > 0: lowerCamelCase : str = rev_num * 10 + (num % 10) num //= 10 return num_copy == rev_num if __name__ == "__main...
681
0
import os from typing import Dict, List, Union import tensorflow as tf from keras_nlp.tokenizers import BytePairTokenizer from tensorflow_text import pad_model_inputs from .tokenization_gpta import GPTaTokenizer class _UpperCAmelCase ( tf.keras.layers.Layer ): """simple docstring""" ...
111
import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_...
111
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import l...
47
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() __lowerCamelCase : Any = [ "...
416
0
'''simple docstring''' from maths.prime_factors import prime_factors def __lowerCamelCase ( __lowerCAmelCase : int ) -> int: if not isinstance(__lowerCAmelCase , __lowerCAmelCase ): snake_case = F'''Input value of [number={number}] must be a...
517
'''simple docstring''' import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class _lowerCAmelCase ( unittest.TestCase ): """simple docstring""" def lowerCAmelC...
517
1
'''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 __snake_case ( unittest.TestCase ...
38
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() SCREAMING_SNAKE_CASE = logging.get_logger(__name__) SCREAMING_SNAKE_CASE = { "post_extract_proj": "feature_projecti...
579
0
import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging _SCREAMING_SNAKE_CA...
534
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE__ ( __a , __a ): # Load...
534
1
'''simple docstring''' import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin from .feature_extraction_wavaveca import WavaVecaFeatureExtractor from .tokenization_wavaveca import WavaVecaCTCTokenizer class A ( _a ): lowe...
22
def SCREAMING_SNAKE_CASE_ ( UpperCAmelCase_ : list ) -> float: SCREAMING_SNAKE_CASE_ : Dict =0 while len(UpperCAmelCase_ ) > 1: SCREAMING_SNAKE_CASE_ : Tuple =0 # Consider two files with minimum cost to be merged ...
443
0
import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def _UpperCamelCase ( lowercase__ , lowercase__ , lowercase__ ): # Initialise PyTorch model __SCREAMING_SNAKE_CASE :...
704
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 @...
260
0
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 FlaxTimestepEmbedding, Fla...
641
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import load_numpy, skip_mps, slo...
641
1
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 transfo...
242
from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowercase = logging.get_logger(__name__) _lowercase = { ...
242
1
import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteria, MaxNewTok...
511
from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase : Any = logging.get_logger(__name__) lowerCAmelCase : List[str] = { 'nielsr/canine-s': 20_48, } # Unicode defines 1,114,112 total “codepoints” low...
511
1
"""simple docstring""" from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER...
363
"""simple docstring""" import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class SCREAMING_SNAKE_CASE_ ( unittest.TestCase ): """simple docstring""" def __lowercase (...
363
1
'''simple docstring''' import argparse 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 from acceler...
476
'''simple docstring''' import argparse import gc import json import os 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 from a...
476
1
import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node _UpperCamelCase : str =4 _UpperCamelCase : Optional[Any] =3 class _SCREAMING_SNAKE_...
708
'''simple docstring''' import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version _UpperCamelCase : Optional[int] =version.parse(importlib_metadata.version("nltk")) if NLTK_VERSION >= version.Version("3.6.4"): from n...
575
0
"""simple docstring""" import webbrowser from sys import argv from urllib.parse import parse_qs, quote import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": __UpperCAmelCase = '''%20'''.join(argv[1:]) if len(argv) > 1 else quote(str(input(''...
642
'''simple docstring''' from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class __lowerCamelCase : """simple docstring""" a = 42 a = None a = None A : Optional[Any] = na...
128
0
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import T...
71
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _lowerCAmelCase = {"configuration_unispeech": ["UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP", "UniSpeechConfig"]} try: if not is_to...
71
1
'''simple docstring''' import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": _UpperCAmelCase : int = argparse.ArgumentParser( description=( '''Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for ...
72
'''simple docstring''' import logging import os import threading import time try: import warnings except ImportError: lowerCAmelCase_ = None try: import msvcrt except ImportError: lowerCAmelCase_ = None try: import fcntl except ImportError: lowerCAmelCase_ = None # ...
173
0
"""simple docstring""" UpperCAmelCase_ : str = 8.314_4598 def _lowerCAmelCase(a : float , a : float ) -> float: if temperature < 0: raise Exception('''Temperature cannot be less than 0 K''' ) if molar_mass <= 0: raise Exception('''Mol...
721
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase_ : int = { '''configuration_wav2vec2''': ['''WAV_2_VEC_2_PRETR...
165
0
import unittest from queue import Empty from threading import Thread from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available from transformers.testing_utils import CaptureStdout, require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torc...
86
# Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING, Dict, Optional import numpy as np import pyarrow as pa from .. import config from ..utils.logging import get_logger from ..utils.py_utils import map_nested from .formatting import TensorFormatter if...
86
1
"""simple docstring""" 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...
397
"""simple docstring""" import argparse import os from . import ( ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BART_PRETRAINED_MODEL_ARCHIVE_LIST, BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, DISTILBERT_PRETRAINED...
397
1
'''simple docstring''' import math import os import re import sys import unittest from pathlib import Path from typing import Tuple from unittest.mock import patch from parameterized import parameterized from transformers.testing_utils import ( CaptureStderr, ExtendSysPath, TestCasePlus, execute_subpr...
390
'''simple docstring''' from ..utils import DummyObject, requires_backends class lowerCamelCase ( metaclass=lowerCamelCase ): '''simple docstring''' lowerCAmelCase__ = ['''onnx'''] def __init__( self : List[Any] , *UpperCAmelCase__ : Union[...
390
1
'''simple docstring''' from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, flip_channel_order, get_resize_output_image_size, rescale, resize, ...
714
'''simple docstring''' 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, PILImageResamp...
461
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCamelCase = {"configuration_glpn": ["GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP", "GLPNConfig"]} try: if not is_vision_available(): raise Option...
66
def __magic_name__ ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> tuple[float, float]: # Check if the input is valid if not len(SCREAMING_SNAKE_CASE ) == len(SCREAMING_SNAKE_CASE ) == 3: raise ValueError('Please enter a valid equation.' ) i...
66
1
'''simple docstring''' import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex lowercase : Dict = logging.getLogger(__name__) class __lowercase ...
701
import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex lowercase : Dict = logging.getLogger(__name__) class __lowercase : """simple docs...
423
0
# flake8: noqa # Lint as: python3 _lowerCAmelCase = [ "VerificationMode", "Version", "disable_progress_bar", "enable_progress_bar", "is_progress_bar_enabled", "experimental", ] from .info_utils import VerificationMode from .logging import disable_progress_bar, enable_progress_bar, is_pro...
10
import sys from collections import defaultdict class lowerCAmelCase_ : def __init__( self : Optional[int] ): _UpperCamelCase = [] def UpperCamelCase_ ( self : Any , _A : str ): return self.node_position[verte...
10
1
import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, sl...
715
# Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config # - generate model_cards - ...
495
0
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.hugging...
619
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_roberta import RobertaTokenizer ...
619
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __a = {"""configuration_unispeech""": ["""UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP""", """UniSpeechConfig"""]} try: if not is...
689
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin from .feature_extraction_wavaveca import WavaVecaFeatureExtractor from .tokenization_wavaveca import WavaVecaCTCTokenizer class UpperCamelCase__( lowerCAmelCase__ ): """simple docstring""" _A = "W...
689
1
def UpperCAmelCase_ (_lowerCAmelCase : str , _lowerCAmelCase : str = " " ): __UpperCamelCase : List[Any] = [] __UpperCamelCase : Union[str, Any] = 0 for index, char in enumerate(_lowerCAmelCase ): if char == separator: split_words.append(...
327
# 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 applica...
327
1
'''simple docstring''' 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, DDIMInverseScheduler, DDIMScheduler, DPMSolverMultist...
700
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : Union[str, Any] = { '''configuration_distilbert''': ...
39
0
import inspect import os import re from transformers.configuration_utils import PretrainedConfig from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstring...
279
import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging a__ = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ ( _UpperCamelCase ): ...
279
1
import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelC...
716
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _UpperCAmelCase : Optional[Any] = { """configuration_cl...
188
0
"""simple docstring""" import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() __SCREAMING_SNAKE_CASE = [ """w...
388
"""simple docstring""" from math import ceil def __a ( a, a ): """simple docstring""" _a = list(range(0, a ) ) _a = [item for sublist in list(device_map.values() ) for item in sublist] # Duplicate check _a ...
388
1
'''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 f...
700
'''simple docstring''' from functools import lru_cache def SCREAMING_SNAKE_CASE_ ( _UpperCAmelCase : int ) -> set: _a : Any =2 _a : Tuple =set() while i * i <= n: if n % i: i ...
506
0
# NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline # noqa: F401 deprecate...
382
from __future__ import annotations def UpperCAmelCase ( UpperCAmelCase ,UpperCAmelCase ,UpperCAmelCase )-> dict[str, float]: '''simple docstring''' if (voltage, current, resistance).count(0 ) != 1: raise ValueError('''One and only one argument must be 0''' ...
393
0
'''simple docstring''' # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import torch class ...
187
'''simple docstring''' 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, DDIMInverseScheduler, DDIMScheduler, DPMSolverMu...
187
1