code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def lowercase ( __snake_case : Dict ): lowercase_ : Optional[int] = [ '''encoder.version''...
231
"""simple docstring""" import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...te...
231
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCase = { """facebook/convnextv2-tiny-1k-224""": """ht...
703
from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def A__ ( __lowerCamelCase = "laptop" ): SCREAMING_SNAKE_CASE_ = F'''https://www.amazon.in/laptop/s?k={product}''' SCREAMING_SNAKE_CASE_ = { '''User-Agent''': '''Mozilla/5.0 (X11;...
597
0
from __future__ import annotations import unittest from transformers import DistilBertConfig, 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_att...
2
'''simple docstring''' from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar __A : Tuple = TypeVar('T') class __UpperCamelCase ( Generic[T] ): def __init__( self :Optional[Any] ,_UpperCamelCase :T ): ...
334
0
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, ...
701
"""simple docstring""" def _UpperCamelCase ( UpperCamelCase ) -> 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] ) ): gr...
487
0
'''simple docstring''' from collections.abc import Callable import numpy as np def a_ ( lowerCamelCase : Callable , lowerCamelCase : float , lowerCamelCase : float , lowerCamelCase : float , lowerCamelCase : float ...
133
'''simple docstring''' import argparse import torch from transformers import RemBertConfig, RemBertModel, load_tf_weights_in_rembert from transformers.utils import logging logging.set_verbosity_info() def a_ ( lowerCamelCase : Union[str, Any] , lowerCamelC...
133
1
# 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 applicab...
670
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : Optional[Any] = { """configuration_distilbert""": [ """DISTILBER...
670
1
import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from...
424
'''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_tokenizers @r...
189
0
import math def SCREAMING_SNAKE_CASE_ ( __lowerCamelCase: int ): '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return Fals...
601
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger SCREAMING_SNAKE_CASE__ = get_logger(__name__) class __lowerCamelCase ( enum.Enum ): """simple docstring""" lowerCAmelCase__ =...
601
1
"""simple docstring""" import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets __A : List[str] = '''\ @inproceedings{snover-etal-2006-study, title = "A Study of Translation Edit Rate with Targeted Human Annotation", author = "Snover, Matthew and ...
499
"""simple docstring""" import copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence fro...
499
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowerCAmelCase : Any = { '''configuration_table_transformer''': [ '''TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE...
21
"""simple docstring""" import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTes...
21
1
def lowerCAmelCase__ ( a__: str , a__: str ) -> bool: '''simple docstring''' _UpperCAmelCase = len(a__ ) _UpperCAmelCase = len(a__ ) _UpperCAmelCase = [[False for _ in range(m + 1 )] for _ in rang...
618
def lowerCAmelCase__ ( a__: int , a__: int ) -> int: '''simple docstring''' return x if y == 0 else greatest_common_divisor(a__ , x % y ) def lowerCAmelCase__ ( a__: int , a__: int ) -> int: '''simple ...
618
1
'''simple docstring''' from __future__ import annotations import math import numpy as np from numpy.linalg import norm def _UpperCamelCase ( __A , __A ) -> List[Any]: '''simple docstring''' return math.sqrt(sum(pow(a - b , 2 ) for a, b in zip(_lowerCAmelCase ...
711
'''simple docstring''' import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class lowercase_ ( a__ , unitte...
223
0
'''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 ( MobileViTConfig, MobileViTForImageClassification, MobileViTForSemanticSegmentation, MobileViTImag...
109
"""simple docstring""" import os import re import sys import traceback import warnings from pathlib import Path from typing import Dict, Optional, Union from uuid import uuida from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami from huggingface_hub.file_download import...
341
0
import unittest import numpy as np from transformers import AlbertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.numpy as jnp from trans...
715
import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ....
649
0
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 __UpperCamelCase : int = { """facebook/maskformer-s...
328
'''simple docstring''' import copy 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 ..auto import CONFIG_MAPPING lowerCamelCase = logg...
474
0
"""simple docstring""" 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 fro...
101
"""simple docstring""" from math import isqrt, loga def __A ( a_ :int) -> list[int]: __a : int = [True] * max_number for i in range(2 , isqrt(max_number - 1) + 1): if is_prime[i]: for j in range(i**2 , a_ , ...
101
1
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
403
class lowercase : # Public class to implement a graph def __init__( self : Union[str, Any] , _UpperCamelCase : int , _UpperCamelCase : int , _UpperCamelCase : list[list[bool]] ) -> None: '''simple docstring''' ...
403
1
"""simple docstring""" from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class _lowerCAmelCase : """simple docstring""" __magic_name__ :int __magic_name__ :TreeNode | None = None __m...
560
"""simple docstring""" from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent __A = {"""UserAgent""": UserAgent().random} def __A (_SCREAMING_SNAKE_CASE ) ->dict: """simple docstring""" lower...
560
1
def lowerCamelCase__ ( _lowerCamelCase ) ->str: _UpperCAmelCase =0 # if input_string is "aba" than new_input_string become "a|b|a" _UpperCAmelCase ="" _UpperCAmelCase ="" # append each character + "|" in new_string for range(0, length-1) for i in input_string[: len(_lowerCamelCase )...
408
from __future__ import annotations def lowerCamelCase__ ( _lowerCamelCase , _lowerCamelCase ) ->bool: if len(_lowerCamelCase ) == 0: return False _UpperCAmelCase =len(_lowerCamelCase ) // 2 if a_list[midpoint] == item: return True if item < a_list[midpoint]: return binary_search(a_lis...
408
1
'''simple docstring''' from __future__ import annotations import numpy as np def lowerCamelCase__ ( a ): __snake_case , __snake_case = np.shape(a ) if rows != columns: __snake_case = ( '\'table\' has to be of square shaped arr...
427
'''simple docstring''' from __future__ import annotations def lowerCamelCase__ ( a , a ): print(f'Vertex\tShortest Distance from vertex {src}' ) for i, d in enumerate(a ): print(f'{i}\t\t{d}' ) def lowerCamelCase__ ( a , a ,...
427
1
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, PNDMScheduler, StableDiffusionLDMaDPipeline, UNetaDConditionModel, ) from diffusers.utils...
325
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mvp import M...
325
1
"""simple docstring""" import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms ...
536
"""simple docstring""" from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def UpperCAmelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ = 1 / sqrt(2 ) ): """simple docstring""" A__...
536
1
lowerCamelCase__ : dict[tuple[int, int, int], int] = {} def UpperCamelCase ( lowercase_ , lowercase_ , lowercase_ ) -> int: '''simple docstring''' if late == 3 or absent == 2: return 0 # if we have no days left, and have not failed any other rules,...
12
lowerCamelCase__ : dict[tuple[int, int, int], int] = {} def UpperCamelCase ( lowercase_ , lowercase_ , lowercase_ ) -> int: '''simple docstring''' if late == 3 or absent == 2: return 0 # if we have no days left, and have not failed any other rules,...
12
1
from math import pi, sqrt, tan def __SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE : float ) -> float: if side_length < 0: raise ValueError('surface_area_cube() only accepts non-negative values' ) return 6 * side_length**2 def __SCREAMING_SNAKE_CASE ( SCREAMING_SNA...
688
import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, ra...
688
1
"""simple docstring""" from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = {'''vocab_file''': '''...
677
"""simple docstring""" import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ...test_modeling...
677
1
'''simple docstring''' import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, 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_f...
692
'''simple docstring''' import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig __UpperCAmelCase = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE : ''...
692
1
"""simple docstring""" def UpperCamelCase (SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): # Return True if there is node that has not iterated. UpperCamelCase : List[str] = [False] * len...
102
"""simple docstring""" import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments __magic_name__ : Dict = logging.getLogger(__name__) @dataclass c...
102
1
import requests from bsa import BeautifulSoup def UpperCAmelCase ( lowercase , lowercase ): """simple docstring""" __lowercase = BeautifulSoup(requests.get(lowercase , params=lowercase ).content , '''html.parser''' ) __lowe...
522
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __a : List[str] = { """configuration_tapas""": ["""TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TapasConfig"""], """tokenization_tapas""": ["""TapasTokenize...
522
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowercase_ : int = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass else: ...
64
import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class UpperCamelCase ( lowercase__ ): '''simple do...
257
0
from __future__ import annotations __magic_name__ = tuple[int, int, int] __magic_name__ = tuple[str, str, str] # used alphabet -------------------------- # from string.ascii_uppercase __magic_name__ = '''ABCDEFGHIJKLMNOPQRSTUVWXYZ''' # -------------------------- de...
314
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __magic_name__ = { '''configuration_vision_text_dual_encoder''': ['''VisionTextDualEncoderConfig'''], ...
314
1
'''simple docstring''' import os from distutils.util import strtobool def __UpperCAmelCase ( _UpperCAmelCase : int , _UpperCAmelCase : List[Any] ) -> Optional[int]: for e in env_keys: __snake_case = int(os.environ.get(lowerCAmelCase__ , -1 ) ) ...
69
from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration __SCREAMING_SNAKE_CASE : Dict =HfArgumentParser(InitializationArguments) __SCREAMING_SNAKE_CASE : Optional[Any] =parser.pa...
428
0
import importlib import inspect import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py UpperCAmelCase_ = "src/transformers" # This is to make sure the transformers module impo...
701
'''simple docstring''' # Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def SCREAMING_SNAKE_CASE ( a_ : Optional[Any] , a_ : int , a_ : Tuple , a_ : Tuple ): __a = { 'en': 'Machine learning ...
490
0
def _A ( lowerCAmelCase_ : int , lowerCAmelCase_ : int ): """simple docstring""" while second != 0: lowerCAmelCase__ = first & second first ^= second lowerCAmelCase__ = c << 1 return first if __name__ ...
61
'''simple docstring''' import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print('Googling.....') lowerCAmelCase_ : Optional[Any] = 'https://www.google.com/search?q=' + ' '.join(sys.argv[1:]...
692
0
from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class A__ : lowerCamelCase__ : List[str] lowerCamelCase__ : Optio...
707
import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate import Accelerator from datasets i...
336
0
__SCREAMING_SNAKE_CASE : str = [ [0, 1_6, 1_3, 0, 0, 0], [0, 0, 1_0, 1_2, 0, 0], [0, 4, 0, 0, 1_4, 0], [0, 0, 9, 0, 0, 2_0], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def snake_case (__lowercase , __lowercase , __lowercase , __lowercase ) -> List[str]: ...
670
import unittest from transformers import SPIECE_UNDERLINE, ReformerTokenizer, ReformerTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTeste...
670
1
import pandas as pd from matplotlib import pyplot as plt from sklearn.linear_model import LinearRegression # Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split # Fitting Polynomial Regression to the dataset from sklearn.preprocessing import Poly...
702
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipeline_vq_diffusion import LearnedClassifie...
441
0
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils...
24
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTok...
494
0
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import VideoMAEConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.u...
716
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _lowerCamelCase( _a ): lowercase_ : int = ["""image_processor""", """tokenizer"""] lowercase_ : List[str] = """CLIPImageProcessor""" ...
354
0
'''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, sl...
125
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging A = logging.get_logger(__name__) # TODO Update this A = { '''facebook/esm-1b''': '''https://huggingface...
125
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 ...ut...
399
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCAmelCase = '''▁''' _lowerCAmelCase ...
399
1
"""simple docstring""" from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def lowercase ( lowerCAmelCase__ : str , lowerCAmelCase__ : float | Decimal , lowerCAmelCase__ : float = 10**-10 ...
695
"""simple docstring""" import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class lowerCAmelCase_ ( _lowercase , ...
91
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING a_ = logging.get_logger(__name__) class _lowerCamelCase ( _SCREAMING_SNAKE_CASE ): """simple docstring""" lowerCAmelCase__ : str ...
700
import heapq import sys import numpy as np a_ = tuple[int, int] class _lowerCamelCase : """simple docstring""" def __init__( self : Dict ): __UpperCamelCase = [] __UpperCamelCase = set() def snake_case ( self :...
375
0
def A__ ( snake_case_ : Dict , snake_case_ : Optional[Any] , snake_case_ : Optional[Any] , snake_case_ : int ): if height >= 1: move_tower(height - 1 , snake_case_ , snake_case_ , snake_case_ ) move_disk(snake_case_ , ...
64
from __future__ import annotations from collections.abc import Callable from typing import Any, Generic, TypeVar lowercase_ : Tuple = TypeVar('T') class _lowerCamelCase ( Generic[T] ): def __init__( self , lowerCAmelCase , lowerCAmelCase ) -> None: SCREAMING_SNAKE...
64
1
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor lowerCamelCase : Union[str, Any] = logging.get_logger(__name__) class lowerCAmelCase ( __a ): '''simple docstring''' def __init__( self : int , *__a : Dict , *...
649
from __future__ import annotations def snake_case_ ( lowerCAmelCase_ : list[int] ): if not nums: return 0 __lowercase : Tuple = nums[0] __lowercase : Tuple = 0 for num in nums[1:]: __lowercase ...
649
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 __A =logging.get_logger(__name__) __A ={'''vocab_file''': '''sentencepiece.bpe.model'''} ...
463
"""simple docstring""" import argparse import re from flax.traverse_util import flatten_dict, unflatten_dict from tax import checkpoints from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration from transformers.modeling_flax_pytorch_utils import load_flax_weights_...
617
0
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class a__...
98
'''simple docstring''' import doctest from collections import deque import numpy as np class a__ : '''simple docstring''' def __init__( self ) -> None: lowerCAmelCase__ = [2, 1, 2, -1] lowerCAmelC...
98
1
from ..utils import DummyObject, requires_backends class A ( metaclass=UpperCAmelCase__ ): '''simple docstring''' A__ = ['''torch''', '''transformers''', '''onnx'''] def __init__(self : str , *_UpperCAmelCase : Tuple , **_UpperCAmelCa...
15
import dataclasses import json import warnings from dataclasses import dataclass, field from time import time from typing import List from ..utils import logging lowerCamelCase__ = logging.get_logger(__name__) def lowerCAmelCase__ ( _SCREAMING_SNAKE_CASE : Tuple=None , _SCREAMING_S...
225
0
'''simple docstring''' import argparse import hashlib # hashlib is only used inside the Test class import struct class _SCREAMING_SNAKE_CASE : def __init__( self : Union[str, Any] , __UpperCamelCase : List[Any] ) -> str: """simple docstring""" snake_case__ :...
700
'''simple docstring''' from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _SCREAMING_SNAKE_CASE (lowercase__ ): A__ = 'ClapFeatureExtractor' A__ = ('RobertaTokenizer', 'RobertaTokenizerFast') def _...
574
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_chan...
109
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _SCREAMING_SNAKE_CASE = { """configuration_maskformer""": ["""MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MaskFormerConfig"""...
163
0
"""simple docstring""" import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteSchedule...
668
"""simple docstring""" lowerCAmelCase_: Union[str, Any] = [ 9_9_9, 8_0_0, 7_9_9, 6_0_0, 5_9_9, 5_0_0, 4_0_0, 3_9_9, 3_7_7, 3_5_5, 3_3_3, 3_1_1, 2_8_8, 2_6_6, 2_4_4, 2_2_2, 2_0_0, 1_9_9, 1_7_7, 1_5_5, 1_3_3, 1_1_1, ...
668
1
import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available from . import BaseDiffusersCLICommand def __snake_case ( _lowerCAmelCase ...
454
import random import unittest import torch from diffusers import IFInpaintingPipeline 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_GUIDED_IMAGE_I...
454
1
"""simple docstring""" import argparse 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_dummies.py a_ = '''src/diffusers''' # Matches is_xxx_available() a_ = re.compile(r'''is\_([a-z_]*)_available...
48
"""simple docstring""" import json import multiprocessing as mp import re from collections import defaultdict from functools import partial from typing import Dict, List, Optional, Set, Tuple, Type from datasets import Dataset from datasketch import MinHash, MinHashLSH from dpu_utils.utils.iterators import Thread...
48
1
'''simple docstring''' from __future__ import annotations class UpperCamelCase__ : def __init__( self : List[str] , lowerCamelCase : int = 0 ): '''simple docstring''' a__ = key def __a ( self : List[str...
489
'''simple docstring''' import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencep...
342
0
import os import pytest from transformers.dynamic_module_utils import get_imports SCREAMING_SNAKE_CASE : Union[str, Any] = """ import os """ SCREAMING_SNAKE_CASE : Optional[int] = """ def foo(): import os return False """ SCREAMING_SNAKE_CASE : Union[str, Any] ...
525
import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @require_sentencepiece @require_t...
525
1
import collections import inspect import unittest from transformers import FocalNetConfig 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_backbone_common import BackboneTest...
81
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig lowerCAmelCase_ : Optional[Any] = logging.get_logger(__name__) lowerCAmelCase_ : Any = { '''Intel/dpt-large''': '''https://hu...
414
0
import unittest from typing import Dict, List, Optional, Union 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_imag...
705
import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup __UpperCAmelCase = logging.get_logger(__name__) class a_( lowe...
259
0
def lowerCamelCase_ ( _UpperCamelCase , _UpperCamelCase ) -> str: """simple docstring""" snake_case_ : Any = (boundary[1] - boundary[0]) / steps snake_case_ : List[Any] = boundary[0] snake_case_ : Tuple = ...
60
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
124
0
import math def lowercase__ ( _UpperCamelCase) -> list[int]: """simple docstring""" UpperCamelCase = [] UpperCamelCase = 2 UpperCamelCase = int(math.sqrt(_UpperCamelCase)) # Size of every segment UpperCamelCase ...
410
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingStrategy, logging from .tokenization_realm import RealmTokenizer...
410
1
"""simple docstring""" from scipy.stats import pearsonr import datasets SCREAMING_SNAKE_CASE_ = ''' Pearson correlation coefficient and p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relie...
465
"""simple docstring""" # Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def lowercase (_lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ): __lowerCAmelCase = { """en""": """Machine learning is great, isn't it?""", ...
465
1
"""simple docstring""" from cva import destroyAllWindows, imread, imshow, waitKey def _A ( _a : Optional[Any] ): """simple docstring""" A , A = img.shape[0], img.shape[1] # converting each pixel's color to its negative for i...
255
"""simple docstring""" 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 UpperCAmelCase =get_logger(__name__) UpperCAmelCase =R"\n Args:\n input_ids (`jnp.ndarray` of...
255
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowerCAmelCase ( metaclass=lowerCamelCase_ ): '''simple docstring''' SCREAMING_SNAKE_CASE_ : Dict = ["""torch""", """torchsde"""] def __init__( ...
247
"""simple docstring""" from __future__ import annotations __UpperCamelCase = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] __UpperCamelCase = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def lowercase (SCREAMING_SNAKE_CASE_ : list[float] ) ...
247
1
def __lowercase ( _SCREAMING_SNAKE_CASE = 60_08_51_47_51_43 ) -> int: '''simple docstring''' try: SCREAMING_SNAKE_CASE = int(_SCREAMING_SNAKE_CASE ) except (TypeError, ValueError): raise TypeError("""Parameter n must be int or ...
702
import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": SCREAMING_SNAKE_CASE_ = argparse.ArgumentParser() parser.add_argument( """--checkpoint_path""", ...
116
0
import json import logging import os import re import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import datasets import numpy as np import torch import torchaudio from packaging import version from torch import nn import transformers from transfo...
256
import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class _SCREAMING_SNAKE_CASE ( snake_case ): lowerCamelCase_ = (CMStochasticIterativeScheduler,) lowerCamelCase_ = 1_0 def _UpperCAmelCase ( ...
256
1
from __future__ import annotations def _UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): # This function is recursive '''simple docstring''' lowerCAmelCase : List[Any] = len(SCREAMING_SNAKE_CASE__ ) # If the array contains only one ...
693
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_roformer': ['ROFO...
693
1
def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" while a != 0: lowerCamelCase , lowerCamelCase = b % a, a return b def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ ): ...
623
import socket def __lowercase( ): """simple docstring""" lowerCamelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) lowerCamelCase = socket.gethostname() lowerCamelCase = 12312 sock.connect((host, port...
623
1
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_tokeni...
706
from dataclasses import dataclass from typing import Optional import numpy as np import torch import torch.nn as nn from ..utils import BaseOutput, is_torch_version, randn_tensor from .attention_processor import SpatialNorm from .unet_ad_blocks import UNetMidBlockaD, get_down_block, get_up_block @dataclass class ...
589
0
def UpperCAmelCase ( a_ ) -> str: """simple docstring""" __A = 0 __A = len(a_ ) for i in range(n - 1 ): for j in range(i + 1 , a_ ): if arr[i] > arr[j]: num_inversions += 1 return num_inversions def...
55
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( UpperCamelCase="ro" , UpperCamelCase="en" , UpperCamelCase="wmt16" , UpperCamelCase=None ): """simple docstring""" try: import datasets ...
565
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor a =logging.get_logger(__name__) class A_ ( SCREAMING_SNAKE_CASE ): def __init__( self : Tuple ,*SCREAMING_SNAKE_CASE__ : Any ...
708
import os import pytest from attr import dataclass a ="""us-east-1""" # defaults region @dataclass class A_ : _UpperCAmelCase : str _UpperCAmelCase : Tuple = '''arn:aws:iam::558105141721:role/sagemaker_execution_role''' _UpperCAmelCase : ...
337
0
"""simple docstring""" from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=lowerCamelCase_ ) class snake_case_ ( lowerCamelCase_ ): """simple docstring""" A_ ...
34
"""simple docstring""" import asyncio import os import re import sys import tempfile import unittest from contextlib import contextmanager from copy import deepcopy from distutils.util import strtobool from enum import Enum from importlib.util import find_spec from pathlib import Path from unittest.mock imp...
34
1
"""simple docstring""" def _lowerCamelCase ( lowerCamelCase__ : list ): lowercase__ : Dict = 0 while len(lowerCamelCase__ ) > 1: lowercase__ : int = 0 # Consider two files with minimum cost to be merged for _ in range(2 ): lowercase__ : Dict ...
128
"""simple docstring""" from scipy.stats import spearmanr import datasets __snake_case = '\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implying no correlation.\n...
128
1
import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor UpperCamelCase_ = logging.get_logger(__name__) class a ( __UpperCAmelCase ): def __init__( self : Dict , *snake_case__ : Optional[Any] , **snake_case__ : int ):...
611
import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { "vocab_file": "vocab.json", "merges_file": "merges.txt", }...
611
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) UpperCamelCase : str = { "configuration_mobilevit": ["MOBILEVIT_PRETRAINED_CONFIG_ARCHIV...
293
"""simple docstring""" import argparse import json import os from tensorflow.core.protobuf.saved_model_pba import SavedModel # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py UpperCamelCase : Tuple = "." # In...
293
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : Any = { 'configuration_x_clip': [ 'XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XCLIPConfig', 'XCLIPTextConfig', 'X...
57
"""simple docstring""" # DISCLAIMER: This code is strongly influenced by https://github.com/pesser/pytorch_diffusion # and https://github.com/hojonathanho/diffusion import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import ...
260
0
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline lowerCAmelCase_: Optional[int] = logging.get_logger(__name__) # pylint: disable=invalid-name class ...
668
"""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": [ ...
668
1
"""simple docstring""" import logging import os from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union from filelock import FileLock from transformers import PreTrainedTokenizer, is_tf_available, is_torch_available __lowerCamelCase ...
96
'''simple docstring''' import inspect import re from hashlib import shaaaa from typing import Dict, List from .arrow import arrow from .audiofolder import audiofolder from .csv import csv from .imagefolder import imagefolder from .json import json from .pandas import pandas from .parquet import parquet f...
50
0
"""simple docstring""" import argparse import os from pathlib import Path import fairseq import torch from packaging import version from torch import nn from transformers import ( BartConfig, BartForConditionalGeneration, BartForSequenceClassification, BartModel, BartTokenizer, ) from transfor...
706
"""simple docstring""" import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration __a = [ # tf -> hf ("/", "."), ("layer_", "layers."), ("kernel", "weight...
310
0
'''simple docstring''' import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from tran...
467
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : float )-> float: if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) ...
650
0
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 torch...
702
import fire from utils import calculate_rouge, save_json def _UpperCAmelCase ( UpperCamelCase: Any , UpperCamelCase: Union[str, Any] , UpperCamelCase: List[Any]=None , **UpperCamelCase: Optional[int] ): """simple docstring""" __lowerCAmelCase = ...
376
0
'''simple docstring''' from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _a :...
689
'''simple docstring''' from argparse import ArgumentParser from .env import EnvironmentCommand def _lowerCAmelCase ( ) -> Union[str, Any]: __lowerCAmelCase = ArgumentParser("""Diffusers CLI tool""" , usage="""diffusers-cli <command> [<args>]""" ) __lowerCAmelCase ...
689
1
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from diffusers.utils import floats_tensor, l...
450
from __future__ import annotations import typing from collections.abc import Iterable import numpy as np __A : Dict = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 __A : Tuple = typing.Union[np.floataa, int, float] # noqa: UP007 def lowerCamelC...
450
1
'''simple docstring''' import argparse import ast import logging import os import sys import pandas as pd import torch from tqdm import tqdm from transformers import BartForConditionalGeneration, RagRetriever, RagSequenceForGeneration, RagTokenForGeneration from transformers import logging as transformers_log...
688
'''simple docstring''' 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_util...
688
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __lowerCAmelCase = logging.get_logger(__name__) __lowerCAmelCase = "▁" __...
129
from ..utils import DummyObject, requires_backends class __SCREAMING_SNAKE_CASE ( metaclass=lowercase): __SCREAMING_SNAKE_CASE : Optional[int] = ["""keras_nlp"""] def __init__( self : Optional[int] , *__UpperCamelCase : List[Any] , **__UpperCamelCa...
129
1
A__: Optional[int] = 6_5521 def lowerCAmelCase_ ( A_): UpperCamelCase__: Tuple = 1 UpperCamelCase__: Any = 0 for plain_chr in plain_text: UpperCamelCase__: Optional[int] = (a + ord(A_)) % MOD_ADLER UpperCamelCase__: Any = ...
380
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable A__: Any = { '''configuration_gpt_neox_japanese''': ['''GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoXJapaneseConfig'''], '''...
380
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCAmelCase = {"configuration_wavlm": ["WAVLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "WavLMConfig"]} try: if not is_torch_available(): raise Opti...
245
'''simple docstring''' from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import flo...
245
1
from timeit import timeit lowerCAmelCase_ = { '''MALAYALAM''': True, '''String''': False, '''rotor''': True, '''level''': True, '''A''': True, '''BB''': True, '''ABC''': False, '''amanaplanacanalpanama''': True, # "a man a plan a canal panama" } # Ensure ou...
39
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json''', '''RWKV/rwkv-4-43...
39
1
'''simple docstring''' from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default...
79
'''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 numpy as np import tensorflow as tf from ...
79
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __SCREAMING_SNAKE_CASE :str = { '''configuration_bigbird_pegasus''': [ '''BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BigBirdPe...
236
'''simple docstring''' import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import Paddin...
236
1
"""simple docstring""" import unittest from transformers import SPIECE_UNDERLINE from transformers.models.speechta import SpeechTaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.tokenization_utils import A...
554
"""simple docstring""" 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_i...
554
1
import qiskit def _lowerCAmelCase ( UpperCamelCase__: int = 2 ) -> qiskit.result.counts.Counts: """simple docstring""" A = qubits # Using Aer's simulator A = qiskit.Aer.get_backend("""aer_simulator""" ) # Creating a Quantum Circuit acting on the q...
641
_lowercase : Dict = { "Pillow": "Pillow", "accelerate": "accelerate>=0.11.0", "compel": "compel==0.1.8", "black": "black~=23.1", "datasets": "datasets", "filelock": "filelock", "flax": "flax>=0.4.1", "hf-doc-builder": "hf-doc-builder>=0.3.0", "huggingface-hub": "...
641
1
"""simple docstring""" import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _...
327
"""simple docstring""" from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = { '''snap-research/efficientformer-l1-300''': ( '''https://huggingface.co/snap...
327
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase_ : int = { '''configuration_time_series_transformer''': [ '''TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_...
255
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Dict ) -> List[str]: '''simple docstring''' A__ = len(SCREAMING_SNAKE_CASE_ ) for i in range(length - 1 ): A__ = i for k in range(i + 1 , SCREAMING_SNAKE_CASE_ ): ...
514
0
from __future__ import annotations _lowercase = "Muhammad Umer Farooq" _lowercase = "MIT" _lowercase = "1.0.0" _lowercase = "Muhammad Umer Farooq" _lowercase = "contact@muhammadumerfarooq.me" _lowercase = "Alpha" import re from html.parser import HTMLParser from url...
526
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig _lowercase = { "albert-base-v1": "https://huggingface.co/albert-base-v1/resolve/main/config.json", "albert-large-v1": "https://huggingface.co/albert-la...
526
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class _UpperCAmelCase ( metaclass=_lowerCAmelCase ): a__ : Tuple = ["torch", "transformers", "onnx"] def __init__( self : Optional[int] , *_lowercase : int , **_lo...
49
'''simple docstring''' import unittest from transformers import ( MODEL_FOR_OBJECT_DETECTION_MAPPING, AutoFeatureExtractor, AutoModelForObjectDetection, ObjectDetectionPipeline, is_vision_available, pipeline, ) from transformers.testing_utils import ( is_pipeli...
502
0
'''simple docstring''' import os from datetime import datetime as dt from github import Github __A : Union[str, Any] = [ "good first issue", "good second issue", "good difficult issue", "enhancement", "new pipeline/model", "new scheduler", "wip", ] def lowerCAmelCa...
705
'''simple docstring''' import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis_float32 (there's also the fix_lavis branch) # also note: to convert Vicuna checkpoints, w...
126
0
import operator def A__ ( __A : str , __A : int = False , __A : Any = None ) ->List[Any]: __A =operator.lt if reverse else operator.gt __A =solution or [] if not arr: return solution __A =[arr.pop(0 )] for i, ...
184
'''simple docstring''' def lowerCamelCase__ ( a ): assert ( isinstance(a , a ) and number_of_steps > 0 ), f'number_of_steps needs to be positive integer, your input {number_of_steps}' if number_of_steps == 1: return 1 __snake_case , __...
356
0
"""simple docstring""" import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common imp...
309
"""simple docstring""" import os import pytest from transformers.dynamic_module_utils import get_imports a__ : Optional[Any] = """ import os """ a__ : Optional[Any] = """ def foo(): import os return False """ a__ : Tuple = """ def foo(): def...
309
1
__a :List[str] = 6_5521 def __snake_case ( __UpperCamelCase : str ): """simple docstring""" A_ = 1 A_ = 0 for plain_chr in plain_text: A_ = (a + ord(__UpperCamelCase )) % MOD_ADLER A_ = ...
86
import math def a__ ( 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: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False # All p...
529
0
'''simple docstring''' def snake_case_ (UpperCamelCase : Optional[int] ): '''simple docstring''' return " ".join( ''''''.join(word[::-1] ) if len(_UpperCAmelCase ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": ...
716
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) _snake_case : List[Any] = {'configuration_beit': ['BEIT_PRETRAINED_CON...
377
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A__ = { '''configuration_nllb_moe''': [ '''NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''NllbMoeConfig''', ] } try: if not is_torch_available...
252
def _lowerCAmelCase ( __lowerCAmelCase , __lowerCAmelCase = " " ) -> list: """simple docstring""" snake_case__ : str = [] snake_case__ : int = 0 for index, char in enumerate(__lowerCAmelCase ): if char == separator: ...
252
1
'''simple docstring''' import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..state import Accele...
640
'''simple docstring''' import heapq def __SCREAMING_SNAKE_CASE ( _UpperCamelCase ): """simple docstring""" lowercase_ : list[list] = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the queue will be fil...
640
1