code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
def _SCREAMING_SNAKE_CASE ( a = 1_00 ) -> Optional[int]: __A : Union[str, Any] = 0 __A : Optional[Any] = 0 for i in range(1 , n + 1 ): sum_of_squares += i**2 sum_of_ints += i return sum_of_ints**2 - sum_o...
701
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging UpperCAmelCase : Dic...
77
0
from collections.abc import Sequence def _SCREAMING_SNAKE_CASE ( a = None ) -> int: if nums is None or not nums: raise ValueError('Input sequence should not be empty' ) __A : Dict = nums[0] for i in range(1 , len(_SCREAMING_SNAKE_C...
702
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor UpperCAmelCase : List[Any] = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" def __init__( self , *_A , **_A ): ...
77
0
def _SCREAMING_SNAKE_CASE ( a ) -> list: __A : Optional[int] = [0] * len(a ) for i in range(1 , len(a ) ): # use last results for better performance - dynamic programming __A : Optional[int] = prefix_result[i - 1] whi...
703
import glob import os import random from string import ascii_lowercase, digits import cva UpperCAmelCase : Dict = '''''' UpperCAmelCase : Union[str, Any] = '''''' UpperCAmelCase : Optional[int] = '''''' UpperCAmelCase : Union[str, Any] = 1 # (0 is vert...
77
0
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" def __init__( self , *_A , **_A ): ...
704
import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester fr...
77
0
from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline UpperCAmelCase : Union[str, Any] = logging.get_l...
705
import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel UpperCAmelCase : str = HfApi() UpperCAmelCase : List[str] = {} # fmt: off UpperCAmelCase : Optional[Any] = torch.tensor([ -0.7515, -1.6883, 0.2420, 0.0300, 0.6347, 1...
77
0
import math def _SCREAMING_SNAKE_CASE ( a , a ) -> Union[str, Any]: if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * math.logaa(lowerCamelCase_ ) else: if x == 0: # 0 raised to any number ...
706
import numpy as np from PIL import Image def _SCREAMING_SNAKE_CASE ( a , a , a ) -> np.ndarray: __A : Union[str, Any] = np.array(a ) if arr.shape[0] != arr.shape[1]: raise ValueError('The input array is not a square matrix' ...
77
0
import math import os import sys def _SCREAMING_SNAKE_CASE ( a ) -> str: __A : str = '' try: with open(a , 'rb' ) as binary_file: __A : Union[str, Any] = binary_file.read() for dat in data: ...
707
from __future__ import annotations from collections.abc import Callable def _SCREAMING_SNAKE_CASE ( a , a , a , a = 1_00 , ) -> float: __A : Any = x_start __A : List[str] = fnc(a ) __A : Optional[Any] ...
77
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase : str = logging.get_logger(__name__) UpperCAmelCase : str = { '''facebook/xmod-base'''...
708
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def _SCREAMING_SNAKE_CASE ( ) -> None: print('Making key files...' ) make_key_files('rsa' , 10_24 ) print(...
77
0
from math import factorial, radians def _SCREAMING_SNAKE_CASE ( a , a = 18 , a = 10 ) -> List[str]: __A : Optional[int] = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) # Converting from degrees to radians __A ...
709
import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet import VOCAB_FILES_NAMES, P...
77
0
import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings UpperCAmelCase__ : Optional[Any] = ...
710
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer UpperCAmelCase : List[str] = logging.get_logger(__name__) UpperCAmelC...
77
0
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class _A( snake_case__ ): """simple docstring""" UpperCamelCase ...
711
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class _A( unittest.TestCase ): """simple docstring""" def UpperCAmelCase_ ( self ): debug_launcher(test_script.main ) de...
77
0
from math import sqrt def _SCREAMING_SNAKE_CASE ( a ) -> bool: 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 ...
712
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
77
0
from collections import defaultdict from math import gcd def _SCREAMING_SNAKE_CASE ( a = 1_50_00_00 ) -> int: __A : Union[str, Any] = defaultdict(__UpperCAmelCase ) __A : Union[str, Any] = 2 while 2 * euclid_m * (euclid_m + 1) <= lim...
713
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, loggi...
77
0
class _A: """simple docstring""" def __init__( self , _A , _A=None , _A=None ): __A : str = data __A : Any = previous __A : Optional[int] = next_node def __str__( self ): return...
714
from abc import ABC, abstractmethod from argparse import ArgumentParser class _A( snake_case__ ): """simple docstring""" @staticmethod @abstractmethod def UpperCAmelCase_ ( _A ): raise NotImplementedError() @abstractmethod def UpperCAmelCas...
77
0
import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin UpperCAmelCase : List[Any] = get_tests_dir('''fixtures/test_sentencepiece_with...
715
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase : Optional[int] = {'''configuration_unispeech''': ['''UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''U...
77
0
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a , a , a , a ) -> Dict: __A : Optional[Any] = [] __A : Tuple = input_list[low:mid], input_list[mid : high + 1] while left and right: result.a...
716
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import load_numpy, ...
77
0
'''simple docstring''' import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class _A: """simple docstring""" def __init__( self , _A=2 , _A=3 , _A=64 , _A=None ): __A : List...
717
from __future__ import annotations import math def _SCREAMING_SNAKE_CASE ( a , a ) -> list: if len(a ) != 2 or len(a[0] ) != 2 or len(a ) != 2 or len(b[0] ) != 2: raise Exception('Matrices are not 2x2' ) __A : Optional[int] ...
77
0
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def _SCREAMING_SNAKE_CASE ( a ) -> Tuple: return ConvertCommand( args.model_type , args.tf_checkpoint , args.pytorch_dump_output , args...
718
def _SCREAMING_SNAKE_CASE ( a ) -> int: __A : List[str] = [] __A : Tuple = [] __A : Union[str, Any] = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, '-': 1, } # Priori...
77
0
from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class _A: """simple docstring""" UpperCamelCase : torch.Tensor # [batch_size x 3] UpperCamelCase : torch.Tensor # [batch_size x 3] UpperCamelCase : torch.T...
719
import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase : Tuple = { '''facebook/mask2former-swin-small-coco-instance''': ( '''https://huggingface.co/facebook/...
77
0
import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets UpperCAmelCase : List[Any] = datasets.logging.get_logger(__name__) UpperCAmelCase : str = """\ @inproceedings{bleurt, title={BLEURT: Learning Robust Metrics for T...
720
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 UpperCAmelCase : List[str] = logging.get_log...
77
0
import numpy as np import pandas as pd from sklearn.preprocessing import Normalizer from sklearn.svm import SVR from statsmodels.tsa.statespace.sarimax import SARIMAX def _SCREAMING_SNAKE_CASE ( a , a , a , a , a ) -> Optional[Any]: __A : Dict ...
721
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class _A( nn.Module ): ...
77
0
'''simple docstring''' import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common ...
700
# 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 app...
77
0
import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class _A( unittest.TestCase ): """simple docstring""" ...
701
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging UpperCAmelCase : Dic...
77
0
import os import jsonlines import numpy as np from tqdm import tqdm UpperCAmelCase : int = 20_48 UpperCAmelCase : int = 40_96 UpperCAmelCase : Union[str, Any] = 42 UpperCAmelCase : Dict = os.environ.pop('''PROCESS_TRAIN''', '''false''') UpperCAmelCase ...
702
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor UpperCAmelCase : List[Any] = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" def __init__( self , *_A , **_A ): ...
77
0
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class _A( unittest.TestCase ): """simple docstring""" def UpperCAmelCase_ ( self ): __A : str = inspect.getfi...
703
import glob import os import random from string import ascii_lowercase, digits import cva UpperCAmelCase : Dict = '''''' UpperCAmelCase : Union[str, Any] = '''''' UpperCAmelCase : Optional[int] = '''''' UpperCAmelCase : Union[str, Any] = 1 # (0 is vert...
77
0
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ConvNextConfig, UperNetConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import is_torch_available, is_vision_availab...
704
import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester fr...
77
0
import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( '''The `inpainting.py` script is outdated. Please use directly `from diffusers import''' ''' StableDiffusionInpaintPipeline` instead.''' )
705
import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel UpperCAmelCase : str = HfApi() UpperCAmelCase : List[str] = {} # fmt: off UpperCAmelCase : Optional[Any] = torch.tensor([ -0.7515, -1.6883, 0.2420, 0.0300, 0.6347, 1...
77
0
import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils import cached_property from...
706
import numpy as np from PIL import Image def _SCREAMING_SNAKE_CASE ( a , a , a ) -> np.ndarray: __A : Union[str, Any] = np.array(a ) if arr.shape[0] != arr.shape[1]: raise ValueError('The input array is not a square matrix' ...
77
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase : List[str] = logging.get_logger(__name__) UpperCAmelCase : Dict = { '''xlm-mlm-en-204...
707
from __future__ import annotations from collections.abc import Callable def _SCREAMING_SNAKE_CASE ( a , a , a , a = 1_00 , ) -> float: __A : Any = x_start __A : List[str] = fnc(a ) __A : Optional[Any] ...
77
0
import argparse import gc import json import os import re import torch from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedTokenizerFast, RwkvConfig from transformers.modeling_utils import WEIGHTS_INDEX_NAME, shard_checkpoint UpperCAmelCase : ...
708
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def _SCREAMING_SNAKE_CASE ( ) -> None: print('Making key files...' ) make_key_files('rsa' , 10_24 ) print(...
77
0
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 VaeImageProces...
709
import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet import VOCAB_FILES_NAMES, P...
77
0
def _SCREAMING_SNAKE_CASE ( a , a , a ) -> Union[str, Any]: __A : Dict = len(UpperCAmelCase__ ) __A : int = [[0] * n for i in range(UpperCAmelCase__ )] for i in range(UpperCAmelCase__ ): __A : int ...
710
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer UpperCAmelCase : List[str] = logging.get_logger(__name__) UpperCAmelC...
77
0
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor UpperCAmelCase : List[str] = logging.get_logger(__name__) class _A( __UpperCAmelCase ): """simple docstring""" def __init__( self , *_A , **_A ): ...
711
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class _A( unittest.TestCase ): """simple docstring""" def UpperCAmelCase_ ( self ): debug_launcher(test_script.main ) de...
77
0
import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _A( UpperCamelCase_ , unittest.TestCase ): """simple docstring""" UpperCamelCase ...
712
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
77
0
UpperCAmelCase : Optional[Any] = 6_55_21 def _SCREAMING_SNAKE_CASE ( a ) -> int: __A : Optional[Any] = 1 __A : List[str] = 0 for plain_chr in plain_text: __A : int = (a + ord(__UpperCamelCase ...
713
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, loggi...
77
0
from math import factorial UpperCAmelCase : Optional[Any] = {str(d): factorial(d) for d in range(10)} def _SCREAMING_SNAKE_CASE ( a ) -> Optional[Any]: return sum(DIGIT_FACTORIAL[d] for d in str(a ) ) def _SCREAMING_SNAKE_CASE ( ) ...
714
from abc import ABC, abstractmethod from argparse import ArgumentParser class _A( snake_case__ ): """simple docstring""" @staticmethod @abstractmethod def UpperCAmelCase_ ( _A ): raise NotImplementedError() @abstractmethod def UpperCAmelCas...
77
0
import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) UpperCAmelCase : L...
715
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase : Optional[int] = {'''configuration_unispeech''': ['''UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''U...
77
0
import os import unittest from huggingface_hub.utils import are_progress_bars_disabled import transformers.models.bart.tokenization_bart from transformers import logging from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context from transformers.utils.logging import disable_progress_bar, en...
716
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import load_numpy, ...
77
0
'''simple docstring''' 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_c...
717
from __future__ import annotations import math def _SCREAMING_SNAKE_CASE ( a , a ) -> list: if len(a ) != 2 or len(a[0] ) != 2 or len(a ) != 2 or len(b[0] ) != 2: raise Exception('Matrices are not 2x2' ) __A : Optional[int] ...
77
0
import json import sys def _SCREAMING_SNAKE_CASE ( a , a ) -> Optional[int]: with open(__lowerCAmelCase , encoding='utf-8' ) as f: __A : Optional[Any] = json.load(__lowerCAmelCase ) __A : Dict = ["<details...
718
def _SCREAMING_SNAKE_CASE ( a ) -> int: __A : List[str] = [] __A : Tuple = [] __A : Union[str, Any] = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, '-': 1, } # Priori...
77
0
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils import is_xformers_avai...
719
import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase : Tuple = { '''facebook/mask2former-swin-small-coco-instance''': ( '''https://huggingface.co/facebook/...
77
0
UpperCAmelCase : Dict = [0, 2, 4, 6, 8] UpperCAmelCase : List[Any] = [1, 3, 5, 7, 9] def _SCREAMING_SNAKE_CASE ( a , a , a , a ) -> int: if remaining_length == 0: if digits[0] == 0 or digits[-1] == 0: r...
720
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 UpperCAmelCase : List[str] = logging.get_log...
77
0
import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def _SCREAMING_SNAKE_CASE ( a ) -> Optional[int]: __A : Union[str, Any] = args.pruning_method __A : Optional[Any] ...
721
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class _A( nn.Module ): ...
77
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy UpperCAmelCase : Optional[int] ...
700
# 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 app...
77
0
def _SCREAMING_SNAKE_CASE ( a , a ) -> float: return base * power(_SCREAMING_SNAKE_CASE , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('''Raise base to the power of exponent using recursion...''') UpperCAmelCase : List[str] ...
701
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging UpperCAmelCase : Dic...
77
0
from math import sqrt def _SCREAMING_SNAKE_CASE ( a = 1_00_00_00 ) -> Dict: __A : Any = 0 __A : str = 0 __A : List[str] = 42 while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_...
702
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor UpperCAmelCase : List[Any] = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" def __init__( self , *_A , **_A ): ...
77
0
def _SCREAMING_SNAKE_CASE ( a , a , a=False ) -> Tuple: if isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) and isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): __A : Union[str, Any] = len(set_a.intersection(lowerCAmelCase_ ) ...
703
import glob import os import random from string import ascii_lowercase, digits import cva UpperCAmelCase : Dict = '''''' UpperCAmelCase : Union[str, Any] = '''''' UpperCAmelCase : Optional[int] = '''''' UpperCAmelCase : Union[str, Any] = 1 # (0 is vert...
77
0
import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNetaDConditionModel, ) from diffusers.pi...
704
import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester fr...
77
0
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch,...
705
import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel UpperCAmelCase : str = HfApi() UpperCAmelCase : List[str] = {} # fmt: off UpperCAmelCase : Optional[Any] = torch.tensor([ -0.7515, -1.6883, 0.2420, 0.0300, 0.6347, 1...
77
0
import math def _SCREAMING_SNAKE_CASE ( a ) -> List[str]: __A : Any = [True] * n __A : Tuple = False __A : str = False __A : Tuple = True for i in range(3 , int(n**0.5 + 1 ) ...
706
import numpy as np from PIL import Image def _SCREAMING_SNAKE_CASE ( a , a , a ) -> np.ndarray: __A : Union[str, Any] = np.array(a ) if arr.shape[0] != arr.shape[1]: raise ValueError('The input array is not a square matrix' ...
77
0
def _SCREAMING_SNAKE_CASE ( a , a , a , a ) -> int: __A : Any = len(lowercase_ ), len(grid[0] ) if ( min(lowercase_ , lowercase_ ) < 0 or row == row_length or col == col_length or (row, co...
707
from __future__ import annotations from collections.abc import Callable def _SCREAMING_SNAKE_CASE ( a , a , a , a = 1_00 , ) -> float: __A : Any = x_start __A : List[str] = fnc(a ) __A : Optional[Any] ...
77
0
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class _A( UpperCAmelCase_ ): """simple docstring""" UpperCamelCase : Union[str, Any] = (UnCLIPScheduler,) def UpperCAmelCase_ ( self , **_A ...
708
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def _SCREAMING_SNAKE_CASE ( ) -> None: print('Making key files...' ) make_key_files('rsa' , 10_24 ) print(...
77
0
import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae_atte...
709
import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet import VOCAB_FILES_NAMES, P...
77
0
import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, r...
710
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer UpperCAmelCase : List[str] = logging.get_logger(__name__) UpperCAmelC...
77
0
# 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 b...
711
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class _A( unittest.TestCase ): """simple docstring""" def UpperCAmelCase_ ( self ): debug_launcher(test_script.main ) de...
77
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase : Tuple = { '''configuration_nezha''': ['''NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''NezhaConfig'''], } try: if not is_torch_avai...
712
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
77
0
import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def _SCREAMING_SNAKE_CASE ( a ) -> Dict: ...
713
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, loggi...
77
0
def _SCREAMING_SNAKE_CASE ( a , a , a ) -> Any: def update_area_of_max_square(a , a ) -> int: # BASE CASE if row >= rows or col >= cols: return 0 __A : Tuple = update_area_of_max_square(a__ ...
714
from abc import ABC, abstractmethod from argparse import ArgumentParser class _A( snake_case__ ): """simple docstring""" @staticmethod @abstractmethod def UpperCAmelCase_ ( _A ): raise NotImplementedError() @abstractmethod def UpperCAmelCas...
77
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
715
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase : Optional[int] = {'''configuration_unispeech''': ['''UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''U...
77
0
def _SCREAMING_SNAKE_CASE ( a ) -> Dict: return " ".join( ''.join(word[::-1] ) if len(_UpperCAmelCase ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(reverse_long_words('''Hey wollef...
716
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import load_numpy, ...
77
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase : Any = { '''configuration_distilbert''':...
717
from __future__ import annotations import math def _SCREAMING_SNAKE_CASE ( a , a ) -> list: if len(a ) != 2 or len(a[0] ) != 2 or len(a ) != 2 or len(b[0] ) != 2: raise Exception('Matrices are not 2x2' ) __A : Optional[int] ...
77
0
import argparse import struct import unittest class _A: """simple docstring""" def __init__( self , _A ): __A : List[Any] = data # Initialize hash values __A : int = [ 0X6A_09E_667, 0XBB_67A_E85,...
718
def _SCREAMING_SNAKE_CASE ( a ) -> int: __A : List[str] = [] __A : Tuple = [] __A : Union[str, Any] = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, '-': 1, } # Priori...
77
0
def _SCREAMING_SNAKE_CASE ( a , a , a ) -> Any: return round(float(moles / volume ) * nfactor ) def _SCREAMING_SNAKE_CASE ( a , a , a ) -> Optional[Any]: return round(float((moles * 0.0_821 * temperature) / (volume) ...
719
import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase : Tuple = { '''facebook/mask2former-swin-small-coco-instance''': ( '''https://huggingface.co/facebook/...
77
0
# 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 b...
720
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 UpperCAmelCase : List[str] = logging.get_log...
77
0
import re def _SCREAMING_SNAKE_CASE ( a ) -> bool: __A : List[str] = re.compile( r'^(?:0|94|\+94|0{2}94)' r'7(0|1|2|4|5|6|7|8)' r'(-| |)' r'\d{7}$' ) return bool(re.search(lowerCAmelCase__ , lowerCAmelCase__ ) ) if __name__...
721
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class _A( nn.Module ): ...
77
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_...
700
# 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 app...
77
0
def _SCREAMING_SNAKE_CASE ( a , a ) -> Dict: return number | (1 << position) def _SCREAMING_SNAKE_CASE ( a , a ) -> Dict: return number & ~(1 << position) def _SCREAMING_SNAKE_CASE ( a , a ) -> Optional[...
701
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging UpperCAmelCase : Dic...
77
0
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 _A( _UpperCAmelCase ...
702
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor UpperCAmelCase : List[Any] = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" def __init__( self , *_A , **_A ): ...
77
0
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : Any = logging.get_logger(__name__) UpperCAmelCase : Dict = { '''SCUT-DLVCLab/lilt-roberta-en-base''': ( '''https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/resolve...
703
import glob import os import random from string import ascii_lowercase, digits import cva UpperCAmelCase : Dict = '''''' UpperCAmelCase : Union[str, Any] = '''''' UpperCAmelCase : Optional[int] = '''''' UpperCAmelCase : Union[str, Any] = 1 # (0 is vert...
77
0
from __future__ import annotations from typing import TypedDict class _A( __A ): """simple docstring""" UpperCamelCase : Tuple = 42 UpperCamelCase : Optional[int] = 42 def _SCREAMING_SNAKE_CASE ( a ) -> Option...
704
import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester fr...
77
0
from abc import ABC, abstractmethod from argparse import ArgumentParser class _A( __lowercase ): """simple docstring""" @staticmethod @abstractmethod def UpperCAmelCase_ ( _A ): raise NotImplementedError() @abstractmethod def UpperCAmelCase...
705
import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel UpperCAmelCase : str = HfApi() UpperCAmelCase : List[str] = {} # fmt: off UpperCAmelCase : Optional[Any] = torch.tensor([ -0.7515, -1.6883, 0.2420, 0.0300, 0.6347, 1...
77
0
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase : List[Any] = logging.get_logger(__name__) UpperCAmelCase : Any = { '''vocab_file''': '''vocab.json''', ...
706
import numpy as np from PIL import Image def _SCREAMING_SNAKE_CASE ( a , a , a ) -> np.ndarray: __A : Union[str, Any] = np.array(a ) if arr.shape[0] != arr.shape[1]: raise ValueError('The input array is not a square matrix' ...
77
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available UpperCAmelCase : Dict = {'''tokenization_herbert''': ['''HerbertTokenizer''']} try: if not is_tokenizers_available(): raise OptionalDependencyNotAvaila...
707
from __future__ import annotations from collections.abc import Callable def _SCREAMING_SNAKE_CASE ( a , a , a , a = 1_00 , ) -> float: __A : Any = x_start __A : List[str] = fnc(a ) __A : Optional[Any] ...
77
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 t...
708
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def _SCREAMING_SNAKE_CASE ( ) -> None: print('Making key files...' ) make_key_files('rsa' , 10_24 ) print(...
77
0
import argparse import os import re UpperCAmelCase : Optional[Any] = 'src/diffusers' # Pattern that looks at the indentation in a line. UpperCAmelCase : int = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. UpperCAmelCase : ...
709
import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet import VOCAB_FILES_NAMES, P...
77
0
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ : Tuple = logging.get_logger(__name__) UpperCAmelCase__ : Tuple = { 'SCUT-DLVCLab/lilt-roberta-en-base': ( 'https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/resolv...
710
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer UpperCAmelCase : List[str] = logging.get_logger(__name__) UpperCAmelC...
77
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available UpperCAmelCase : str = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass el...
711
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class _A( unittest.TestCase ): """simple docstring""" def UpperCAmelCase_ ( self ): debug_launcher(test_script.main ) de...
77
0
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class _A( lowercase_ ): """simple docstring""" UpperCam...
712
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
77
0
from __future__ import annotations import math class _A: """simple docstring""" def __init__( self , _A ): __A : Any = size # approximate the overall size of segment tree with given value __A : Optional[Any] = [0 for i in rang...
713
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, loggi...
77
0
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BlipaProcessor, BlipImageProc...
714
from abc import ABC, abstractmethod from argparse import ArgumentParser class _A( snake_case__ ): """simple docstring""" @staticmethod @abstractmethod def UpperCAmelCase_ ( _A ): raise NotImplementedError() @abstractmethod def UpperCAmelCas...
77
0
import unittest import numpy as np from transformers.file_utils import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import...
715
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase : Optional[int] = {'''configuration_unispeech''': ['''UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''U...
77
0
def _SCREAMING_SNAKE_CASE ( a , a , a , a ) -> Dict: global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: __A : str = mf_knapsack(i - 1 , snake_case__ , snake_case__ , snake_case...
716
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import load_numpy, ...
77
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase : int = logging.get_logger(__name__) UpperCAmelCase : int = { ...
717
from __future__ import annotations import math def _SCREAMING_SNAKE_CASE ( a , a ) -> list: if len(a ) != 2 or len(a[0] ) != 2 or len(a ) != 2 or len(b[0] ) != 2: raise Exception('Matrices are not 2x2' ) __A : Optional[int] ...
77
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase : Optional[Any] = { """configuration_nllb_moe""": [ """NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NllbMoeConfig""", ] } try: if not...
718
def _SCREAMING_SNAKE_CASE ( a ) -> int: __A : List[str] = [] __A : Tuple = [] __A : Union[str, Any] = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, '-': 1, } # Priori...
77
0
from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig UpperCAmelCase : Optional[Any] = logging.get_logger(__name__) UpperCAmelCase : List[str] = '''T5Config''' class _A...
719
import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase : Tuple = { '''facebook/mask2former-swin-small-coco-instance''': ( '''https://huggingface.co/facebook/...
77
0
def _SCREAMING_SNAKE_CASE ( a , a , a , a ) -> int: if height >= 1: move_tower(height - 1 , a , a , a ) move_disk(a , a ) move_tower(height - 1 , a , a , a ) def _...
720
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 UpperCAmelCase : List[str] = logging.get_log...
77
0
import torch def _SCREAMING_SNAKE_CASE ( ) -> Any: if torch.cuda.is_available(): __A : Any = torch.cuda.device_count() else: __A : Optional[Any] = 0 print(F"""Successfully ran on {num_gpus} GPUs""" ) if __name__...
721
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class _A( nn.Module ): ...
77
0
'''simple docstring''' import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import Generati...
700
# 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 app...
77
0
import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) UpperCAmelCase : Dict = {...
701
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging UpperCAmelCase : Dic...
77
0
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a , a ) -> list[tuple[int, int]]: __A , __A : str = position __A : Optional[Any] = [ (y + 1, x + 2), (y - 1, x + 2), (y + 1, x - 2), ...
702
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor UpperCAmelCase : List[Any] = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" def __init__( self , *_A , **_A ): ...
77
0
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a , a ) -> int: __A : list[list[int]] = [] create_all_state(1 , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , [] , __SCREAMING_SNAKE_CASE ) return result ...
703
import glob import os import random from string import ascii_lowercase, digits import cva UpperCAmelCase : Dict = '''''' UpperCAmelCase : Union[str, Any] = '''''' UpperCAmelCase : Optional[int] = '''''' UpperCAmelCase : Union[str, Any] = 1 # (0 is vert...
77
0
import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() UpperCAmelCase : Dict = logging.get_logger(__name__) def _SCREAMING_SNAKE_CASE ( a ) -> Optional[A...
704
import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester fr...
77
0
def _SCREAMING_SNAKE_CASE ( a = 60_08_51_47_51_43 ) -> int: try: __A : Dict = int(_lowerCamelCase ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ...
705
import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel UpperCAmelCase : str = HfApi() UpperCAmelCase : List[str] = {} # fmt: off UpperCAmelCase : Optional[Any] = torch.tensor([ -0.7515, -1.6883, 0.2420, 0.0300, 0.6347, 1...
77
0
def _SCREAMING_SNAKE_CASE ( a , a ) -> Any: if a < 0 or b < 0: raise ValueError('the value of both inputs must be positive' ) __A : str = str(bin(_SCREAMING_SNAKE_CASE ) )[2:] # remove the leading "0b" __A : Optional[An...
706
import numpy as np from PIL import Image def _SCREAMING_SNAKE_CASE ( a , a , a ) -> np.ndarray: __A : Union[str, Any] = np.array(a ) if arr.shape[0] != arr.shape[1]: raise ValueError('The input array is not a square matrix' ...
77
0
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 accelerate import Accelerator,...
707
from __future__ import annotations from collections.abc import Callable def _SCREAMING_SNAKE_CASE ( a , a , a , a = 1_00 , ) -> float: __A : Any = x_start __A : List[str] = fnc(a ) __A : Optional[Any] ...
77
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMA...
708
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def _SCREAMING_SNAKE_CASE ( ) -> None: print('Making key files...' ) make_key_files('rsa' , 10_24 ) print(...
77
0
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_sentencepiece, require_tokenizers, re...
709
import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet import VOCAB_FILES_NAMES, P...
77
0
import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def _SCREAMING_SNAKE_CASE ( a , a , a , a ) -> Any: __A : Optional[Any] = s.rsplit(a , a ) return new.join(a ) ...
710
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer UpperCAmelCase : List[str] = logging.get_logger(__name__) UpperCAmelC...
77
0
import argparse import os import platform import numpy as np import psutil import torch from accelerate import __version__ as version from accelerate.commands.config import default_config_file, load_config_from_file from ..utils import is_npu_available, is_xpu_available def _SCREAMING_SNAKE_CASE ...
711
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class _A( unittest.TestCase ): """simple docstring""" def UpperCAmelCase_ ( self ): debug_launcher(test_script.main ) de...
77
0
import unittest import numpy as np from transformers import RobertaConfig, 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.m...
712
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
77
0