code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
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 applic...
20
from random import shuffle import tensorflow as tf from numpy import array def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]: UpperCamelCase : List[Any] = int(_lowerCAmelCase ) assert noofclusters < len(_lowerCAmelCase ) # Find out the dimensionality Upper...
629
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_ind...
21
import os def A_ ( ) -> Union[str, Any]: with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f: UpperCamelCase : Optional[Any] = [] # noqa: E741 for _ in range(20 ): l.append([int(_lowerCAmelCase ) for x in f.readline().split()] ) UpperCamelCase : ...
629
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _snake_case : str = { 'configuration_layou...
22
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class A__ : _UpperCAmelCase :Union[str, Any] = None def __UpperCamelCase( self ): '''simple docstring''' UpperCamelCase : int ...
629
0
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 FlaxGen...
23
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor __lowerCamelCase : Optional[Any] = logging.get_logger(__name__) class A__ ( __snake_case ): def __init__( self , *A_ , **A_ ): '''simple docstring''' ...
629
0
'''simple docstring''' from __future__ import annotations def _UpperCamelCase (_lowerCamelCase : list[float] , _lowerCamelCase : Dict )-> List[Any]: '''simple docstring''' print(f'''Vertex\tShortest Distance from vertex {src}''' ) for i, d in enumera...
24
from __future__ import annotations import math def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float: UpperCamelCase : Tuple = u for i in range(1 , _lowerCAmelCase ): UpperCamelCase : Any = temp * (u - i) return temp def A_ ( ) -> ...
629
0
import inspect import unittest import warnings from math import ceil, floor from transformers import LevitConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_v...
25
# Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar __lowerCamelCase : str = TypeVar("""T""") class A__ ( Generic[T] ): def __init__( ...
629
0
'''simple docstring''' 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 Shap...
26
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging __low...
629
0
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> float: """simple docstring""" return price * (1 + tax_rate) if __name__ == "__main__": print(f"{price_plus_tax(100, 0.2_5) = }") print(f"{price_plus_tax(1_2_5.5_0, 0.0_5) ...
27
import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from transformers.testing_utils...
629
0
'''simple docstring''' import sys from collections import defaultdict class _a : '''simple docstring''' def __init__( self ): '''simple docstring''' SCREAMING_SNAKE_CASE : ...
28
__lowerCamelCase : Any = 9.8_0_6_6_5 def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = g ) -> float: if fluid_density <= 0: raise ValueError("Impossible fluid density" ) if volume < 0: raise ValueError("Impossible Object volume" ) if gravity <= 0: raise...
629
0
"""simple docstring""" from __future__ import annotations def lowercase ( lowerCAmelCase__ ): lowerCamelCase_ = str(lowerCAmelCase__ ) return n == n[::-1] def lowercase ( lowerCAmelCase__ = 1_000_000 ): lowerCamelCase_ = 0 for i in range(1 ,lowerCAmelCase...
29
import numpy as np import qiskit def A_ ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str: UpperCamelCase : Tuple = np.random.default_rng(seed=_lowerCAmelCase ) # Roughly 25% of the qubits will contribute to the key. # So we take more than we need. UpperCamelCase...
629
0
import os import sys import unittest __a = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, find_backend, read_in...
30
from typing import TYPE_CHECKING from ...utils import _LazyModule __lowerCamelCase : str = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys __lowerCamelCase : List[str] = _LazyModule(__name__, glo...
629
0
import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
31
# Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> str: UpperCamelCase : Union[str, Any] = { "en": "Machine learning is great, isn't it?", "ru": "Машинное обучение - эт...
629
0
def A__ ( SCREAMING_SNAKE_CASE_ : int = 10_00 ) -> int: """simple docstring""" _UpperCAmelCase , _UpperCAmelCase = 1, 1 _UpperCAmelCase = [] for i in range(1 , n + 1 ): _UpperCAmelCase = prev_numerato...
32
def A_ ( _lowerCAmelCase = 1000 ) -> int: UpperCamelCase : Optional[int] = -1 UpperCamelCase : int = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c UpperCamelCase : Optional[Any] = (n *...
629
0
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemak...
33
def A_ ( _lowerCAmelCase ) -> bool: UpperCamelCase : List[Any] = 0 for ch in input_str: UpperCamelCase : Optional[Any] = ord(_lowerCAmelCase ) UpperCamelCase : Optional[Any] = pow(2 , _lowerCAmelCase ) # If we already turned on bit for ...
629
0
"""simple docstring""" from __future__ import annotations SCREAMING_SNAKE_CASE_ = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def __snake_case ( _lowercase ,_lowercase ,_lowercase ,_lowercase ,_lowercase ,): """simple docstrin...
34
import math import os import unittest from transformers import MegatronBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import Confi...
629
0
import argparse import math import traceback import dateutil.parser as date_parser import requests def a ( A__ ) -> List[str]: '''simple docstring''' SCREAMING_SNAKE_CASE__ : List[Any] = {} SCREAMING_SNAKE_CASE__ : int = job['''started...
35
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowerCamelCase : List[Any] = { """configuration_chinese_clip""": [ """CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ChineseCLIPConfig"""...
629
0
import gc import unittest from diffusers import FlaxDPMSolverMultistepScheduler, FlaxStableDiffusionPipeline from diffusers.utils import is_flax_available, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils impor...
36
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[int]: UpperCamelCase : List[Any] = [1] for i in range(2 , _lowerCAmelCase ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" UpperCamelCase : Tuple =...
629
0
from __future__ import annotations def UpperCamelCase_ ( __a , __a ) -> list[list[int]]: a__ : list[list[int]] = [] a__ : list[int] = [] a__ : List[Any] = 0 a__ : Dict = sum(__a ) create_state_space_tree(__a , __a , __a ,...
37
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_confi...
629
0
'''simple docstring''' from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class __snake_case ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowerCamelCase__ = CustomTokenizer pass
38
def A_ ( _lowerCAmelCase ) -> bool: return str(_lowerCAmelCase ) == str(_lowerCAmelCase )[::-1] def A_ ( _lowerCAmelCase ) -> int: return int(_lowerCAmelCase ) + int(str(_lowerCAmelCase )[::-1] ) def A_ ( _lowerCAmelCase = 1_0000 ) -> int: UpperCamelCase...
629
0
from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin cla...
39
__lowerCamelCase : str = 6_5521 def A_ ( _lowerCAmelCase ) -> int: UpperCamelCase : Any = 1 UpperCamelCase : str = 0 for plain_chr in plain_text: UpperCamelCase : List[Any] = (a + ord(_lowerCAmelCase )) % MOD_ADLER UpperCamelCase...
629
0
import math import random def UpperCamelCase ( snake_case__ : float , snake_case__ : bool = False ) -> float: if deriv: return value * (1 - value) return 1 / (1 + math.exp(-value )) # Initial Value __UpperCAmelCase = 0.02 def UpperCamelCase ...
40
import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import PaddingStrategy, logging __lo...
629
0
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) ...
41
from typing import Any def A_ ( _lowerCAmelCase ) -> list[Any]: if not input_list: return [] UpperCamelCase : List[str] = [input_list.count(_lowerCAmelCase ) for value in input_list] UpperCamelCase : Dict = max(_lowerCAmelCase ) # Gets the maximum count in...
629
0
'''simple docstring''' from __future__ import annotations import math A_ = "2020.9.26" A_ = "xcodz-dot, cclaus, dhruvmanila" def _UpperCamelCase ( __UpperCamelCase ,__UpperCamelCase ,__UpperCamelCase ,__UpperCamelCase ,__UpperCamelCase ) -> tuple[float, float]: if not all(isi...
42
from random import shuffle import tensorflow as tf from numpy import array def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]: UpperCamelCase : List[Any] = int(_lowerCAmelCase ) assert noofclusters < len(_lowerCAmelCase ) # Find out the dimensionality Upper...
629
0
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem lowerCAmelCase = importlib.util.find_spec('s3fs') is not None if _has_safs: from .safilesystem impo...
43
import os def A_ ( ) -> Union[str, Any]: with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f: UpperCamelCase : Optional[Any] = [] # noqa: E741 for _ in range(20 ): l.append([int(_lowerCAmelCase ) for x in f.readline().split()] ) UpperCamelCase : ...
629
0
'''simple docstring''' UpperCAmelCase_ : dict[str, float] = { "joule": 1.0, "kilojoule": 1000, "megajoule": 100_0000, "gigajoule": 10_0000_0000, "wattsecond": 1.0, "watthour": 3600, "kilowatthour": 360_0000, "newtonmeter": 1.0, "calorie_nutr": 4186.8, "kilocalo...
44
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class A__ : _UpperCAmelCase :Union[str, Any] = None def __UpperCamelCase( self ): '''simple docstring''' UpperCamelCase : int ...
629
0
import argparse import os # New Code # 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 impor...
45
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor __lowerCamelCase : Optional[Any] = logging.get_logger(__name__) class A__ ( __snake_case ): def __init__( self , *A_ , **A_ ): '''simple docstring''' ...
629
0
"""simple docstring""" def lowerCamelCase_( _lowerCamelCase , _lowerCamelCase ) -> int: '''simple docstring''' return abs(_lowerCamelCase ) if a == 0 else greatest_common_divisor(b % a , _lowerCamelCase ) def lowerCamelCase_( _lowerCamelCase , ...
46
from __future__ import annotations import math def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float: UpperCamelCase : Tuple = u for i in range(1 , _lowerCAmelCase ): UpperCamelCase : Any = temp * (u - i) return temp def A_ ( ) -> ...
629
0
import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__...
47
# Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar __lowerCamelCase : str = TypeVar("""T""") class A__ ( Generic[T] ): def __init__( ...
629
0
'''simple docstring''' from random import randint from tempfile import TemporaryFile import numpy as np def A ( UpperCamelCase_ : List[Any] , UpperCamelCase_ : int , UpperCamelCase_ : List[Any] ) -> Dict: '''simple docstring''' lowerCAmelC...
48
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging __low...
629
0
"""simple docstring""" from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class _Uppe...
49
import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from transformers.testing_utils...
629
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) UpperCamelCase : Dict = { 'configuration_perceiver': ['PERCEIVER_PRETRAINE...
50
__lowerCamelCase : Any = 9.8_0_6_6_5 def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = g ) -> float: if fluid_density <= 0: raise ValueError("Impossible fluid density" ) if volume < 0: raise ValueError("Impossible Object volume" ) if gravity <= 0: raise...
629
0
'''simple docstring''' import collections import inspect import unittest from transformers import SwinvaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configura...
51
import numpy as np import qiskit def A_ ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str: UpperCamelCase : Tuple = np.random.default_rng(seed=_lowerCAmelCase ) # Roughly 25% of the qubits will contribute to the key. # So we take more than we need. UpperCamelCase...
629
0
"""simple docstring""" from __future__ import annotations def __A ( a_ :float , a_ :float , a_ :float , ) -> tuple: if (electron_conc, hole_conc, intrinsic_conc).count(0) != 1: raise ValueError('''You cannot supply more or less than 2 va...
52
from typing import TYPE_CHECKING from ...utils import _LazyModule __lowerCamelCase : str = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys __lowerCamelCase : List[str] = _LazyModule(__name__, glo...
629
0
import re def a_ ( lowerCAmelCase_ : str ): __lowerCAmelCase = re.compile(R'^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$' ) if match := re.search(lowerCAmelCase_, lowerCAmelCase_ ): return match.string == phone return False if __name__ == "__main__": ...
53
# Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> str: UpperCamelCase : Union[str, Any] = { "en": "Machine learning is great, isn't it?", "ru": "Машинное обучение - эт...
629
0
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=__lowercase ) class A ( __lowercase ): # `task` is not a ClassVar since we want it to be part of the `asdict` ...
54
def A_ ( _lowerCAmelCase = 1000 ) -> int: UpperCamelCase : Optional[int] = -1 UpperCamelCase : int = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c UpperCamelCase : Optional[Any] = (n *...
629
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, Dist...
55
def A_ ( _lowerCAmelCase ) -> bool: UpperCamelCase : List[Any] = 0 for ch in input_str: UpperCamelCase : Optional[Any] = ord(_lowerCAmelCase ) UpperCamelCase : Optional[Any] = pow(2 , _lowerCAmelCase ) # If we already turned on bit for ...
629
0
'''simple docstring''' from typing import Any def _a (lowercase__ : list , lowercase__ : list , lowercase__ : dict , lowercase__ : dict , lowercase__ : dict , ) -> list: """simple docstring""" _validation( lowercase_...
56
import math import os import unittest from transformers import MegatronBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import Confi...
629
0
from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge A_ : int = [ 'Prosecutor: "No videos were used in the crash investigation" German papers say they saw a c...
57
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowerCamelCase : List[Any] = { """configuration_chinese_clip""": [ """CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ChineseCLIPConfig"""...
629
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __lowerCAmelCase : List[str] = { '''configuration_m...
58
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[int]: UpperCamelCase : List[Any] = [1] for i in range(2 , _lowerCAmelCase ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" UpperCamelCase : Tuple =...
629
0
from __future__ import annotations from math import pi def lowerCAmelCase_ ( __a , __a , __a ) -> dict[str, float]: """simple docstring""" if (inductance, frequency, reactance).count(0 ) != 1: raise ValueError("One and only one argument must be...
59
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_confi...
629
0
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 ( _a, unittest.TestCase ): lowerCamelCa...
60
def A_ ( _lowerCAmelCase ) -> bool: return str(_lowerCAmelCase ) == str(_lowerCAmelCase )[::-1] def A_ ( _lowerCAmelCase ) -> int: return int(_lowerCAmelCase ) + int(str(_lowerCAmelCase )[::-1] ) def A_ ( _lowerCAmelCase = 1_0000 ) -> int: UpperCamelCase...
629
0
import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...ut...
61
__lowerCamelCase : str = 6_5521 def A_ ( _lowerCAmelCase ) -> int: UpperCamelCase : Any = 1 UpperCamelCase : str = 0 for plain_chr in plain_text: UpperCamelCase : List[Any] = (a + ord(_lowerCAmelCase )) % MOD_ADLER UpperCamelCase...
629
0
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case = logging.get_logger(__name__) snake_case = { """microsoft/xprophetnet-large-wiki100-cased""": ( """https://huggingface.co/microsoft/xprophe...
62
import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import PaddingStrategy, logging __lo...
629
0
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( """files""" , [ ["""full:README.md""", """dataset_infos.json"""], ["""empty:READM...
63
from typing import Any def A_ ( _lowerCAmelCase ) -> list[Any]: if not input_list: return [] UpperCamelCase : List[str] = [input_list.count(_lowerCAmelCase ) for value in input_list] UpperCamelCase : Dict = max(_lowerCAmelCase ) # Gets the maximum count in...
629
0
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class _lowerCamelCase : __a = None def UpperCamelCase_ ( self ) -> List[Any]: SCREAMING_SNAKE_CASE__: Union[str, Any]= self.feature_extraction_class(**self....
64
from random import shuffle import tensorflow as tf from numpy import array def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]: UpperCamelCase : List[Any] = int(_lowerCAmelCase ) assert noofclusters < len(_lowerCAmelCase ) # Find out the dimensionality Upper...
629
0
"""simple docstring""" import argparse import os from . import ( ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BART_PRETRAINED_MODEL_ARCHIVE_LIST, BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, DISTILBERT_PRETRAINED...
65
import os def A_ ( ) -> Union[str, Any]: with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f: UpperCamelCase : Optional[Any] = [] # noqa: E741 for _ in range(20 ): l.append([int(_lowerCAmelCase ) for x in f.readline().split()] ) UpperCamelCase : ...
629
0
import requests from bsa import BeautifulSoup def __magic_name__ ( SCREAMING_SNAKE_CASE = "AAPL" ) -> str: _lowercase : str = F"""https://in.finance.yahoo.com/quote/{symbol}?s={symbol}""" _lowercase : int = BeautifulSoup(requests.get(SCREAMING...
66
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class A__ : _UpperCAmelCase :Union[str, Any] = None def __UpperCamelCase( self ): '''simple docstring''' UpperCamelCase : int ...
629
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING snake_case = logging.get_logger(__name__) ...
67
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor __lowerCamelCase : Optional[Any] = logging.get_logger(__name__) class A__ ( __snake_case ): def __init__( self , *A_ , **A_ ): '''simple docstring''' ...
629
0
from __future__ import annotations def lowercase__ ( A_: list[list[int]] ) -> int: """simple docstring""" for i in range(1 , len(matrix[0] ) ): matrix[0][i] += matrix[0][i - 1] # preprocessing the first column for i in rang...
68
from __future__ import annotations import math def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float: UpperCamelCase : Tuple = u for i in range(1 , _lowerCAmelCase ): UpperCamelCase : Any = temp * (u - i) return temp def A_ ( ) -> ...
629
0
'''simple docstring''' from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse('''3.8'''): import importlib_metadata else: import importlib.metadata as ...
69
# Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar __lowerCamelCase : str = TypeVar("""T""") class A__ ( Generic[T] ): def __init__( ...
629
0
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler, D...
70
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging __low...
629
0
'''simple docstring''' from typing import Any class _snake_case : def __init__( self ,_snake_case ): UpperCAmelCase_ : Union[str, Any] = data UpperCAmelCase_ : List[str] = None class _snake_case : def __init__( se...
71
import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from transformers.testing_utils...
629
0
'''simple docstring''' import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def UpperCamelCase ( lowercase_ : Any , lo...
72
__lowerCamelCase : Any = 9.8_0_6_6_5 def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = g ) -> float: if fluid_density <= 0: raise ValueError("Impossible fluid density" ) if volume < 0: raise ValueError("Impossible Object volume" ) if gravity <= 0: raise...
629
0
import os from distutils.util import strtobool def lowerCamelCase__ (_UpperCAmelCase , _UpperCAmelCase): for e in env_keys: SCREAMING_SNAKE_CASE = int(os.environ.get(_UpperCAmelCase , -1)) if val >= 0: return val return default def lo...
73
import numpy as np import qiskit def A_ ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str: UpperCamelCase : Tuple = np.random.default_rng(seed=_lowerCAmelCase ) # Roughly 25% of the qubits will contribute to the key. # So we take more than we need. UpperCamelCase...
629
0
import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { """vocab_file""": """vocab.json""", """merges_file""": """merges.txt""", } lo...
74
from typing import TYPE_CHECKING from ...utils import _LazyModule __lowerCamelCase : str = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys __lowerCamelCase : List[str] = _LazyModule(__name__, glo...
629
0
'''simple docstring''' import unittest from transformers import CamembertTokenizer, CamembertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import is_torch_available from ...test_tokenization_common import Tokeni...
75
# Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> str: UpperCamelCase : Union[str, Any] = { "en": "Machine learning is great, isn't it?", "ru": "Машинное обучение - эт...
629
0
"""simple docstring""" import os from pathlib import Path def __UpperCAmelCase ( ): from torch.utils.cpp_extension import load __lowercase : List[Any] = Path(__UpperCamelCase ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' ...
76
def A_ ( _lowerCAmelCase = 1000 ) -> int: UpperCamelCase : Optional[int] = -1 UpperCamelCase : int = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c UpperCamelCase : Optional[Any] = (n *...
629
0
"""simple docstring""" import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionP...
77
def A_ ( _lowerCAmelCase ) -> bool: UpperCamelCase : List[Any] = 0 for ch in input_str: UpperCamelCase : Optional[Any] = ord(_lowerCAmelCase ) UpperCamelCase : Optional[Any] = pow(2 , _lowerCAmelCase ) # If we already turned on bit for ...
629
0
'''simple docstring''' def lowerCAmelCase_ ( ) -> list[list[int]]: '''simple docstring''' return [list(range(10_00 - i , -10_00 - i , -1 ) ) for i in range(10_00 )] SCREAMING_SNAKE_CASE_: Dict =generate_large_matrix() SCREAMING_SNAKE_CASE_: List[...
78
import math import os import unittest from transformers import MegatronBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import Confi...
629
0
from .configuration_bert_masked import MaskedBertConfig from .modeling_bert_masked import ( MaskedBertForMultipleChoice, MaskedBertForQuestionAnswering, MaskedBertForSequenceClassification, MaskedBertForTokenClassification, MaskedBertModel, ) from .modules import * ...
79
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowerCamelCase : List[Any] = { """configuration_chinese_clip""": [ """CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ChineseCLIPConfig"""...
629
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) __UpperCamelCase : List[Any] = { """configuration_longformer""": [ """LONGFORMER_PRETRAINED_CONFIG_AR...
80
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[int]: UpperCamelCase : List[Any] = [1] for i in range(2 , _lowerCAmelCase ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" UpperCamelCase : Tuple =...
629
0
import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from transformers.utils import WEIG...
81
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_confi...
629
0
"""simple docstring""" import argparse import logging import pickle from collections import Counter logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO ) lowerCamelCase = logging.getLogger(__na...
82
def A_ ( _lowerCAmelCase ) -> bool: return str(_lowerCAmelCase ) == str(_lowerCAmelCase )[::-1] def A_ ( _lowerCAmelCase ) -> int: return int(_lowerCAmelCase ) + int(str(_lowerCAmelCase )[::-1] ) def A_ ( _lowerCAmelCase = 1_0000 ) -> int: UpperCamelCase...
629
0
"""simple docstring""" import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_se...
83
__lowerCamelCase : str = 6_5521 def A_ ( _lowerCAmelCase ) -> int: UpperCamelCase : Any = 1 UpperCamelCase : str = 0 for plain_chr in plain_text: UpperCamelCase : List[Any] = (a + ord(_lowerCAmelCase )) % MOD_ADLER UpperCamelCase...
629
0
# Copyright 2022 The HuggingFace Team and The OpenBMB 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...
84
import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import PaddingStrategy, logging __lo...
629
0
from typing import Dict, List, Optional, Tuple, Union import torch from ...models import AutoencoderKL, TransformeraDModel from ...schedulers import KarrasDiffusionSchedulers from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class snake_case ( UpperCamel...
85
from typing import Any def A_ ( _lowerCAmelCase ) -> list[Any]: if not input_list: return [] UpperCamelCase : List[str] = [input_list.count(_lowerCAmelCase ) for value in input_list] UpperCamelCase : Dict = max(_lowerCAmelCase ) # Gets the maximum count in...
629
0
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from ..image_utils import load_image if is_torch_available(): imp...
86
from random import shuffle import tensorflow as tf from numpy import array def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]: UpperCamelCase : List[Any] = int(_lowerCAmelCase ) assert noofclusters < len(_lowerCAmelCase ) # Find out the dimensionality Upper...
629
0
import re def SCREAMING_SNAKE_CASE ( lowercase_ ) -> str: """simple docstring""" if len(re.findall('''[ATCG]''' , lowercase_ ) ) != len(lowercase_ ): raise ValueError('''Invalid Strand''' ) return dna.translate(dna.maketrans('''ATCG''' , ...
87
import os def A_ ( ) -> Union[str, Any]: with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f: UpperCamelCase : Optional[Any] = [] # noqa: E741 for _ in range(20 ): l.append([int(_lowerCAmelCase ) for x in f.readline().split()] ) UpperCamelCase : ...
629
0
"""simple docstring""" # coding=utf-8 # Copyright 2023 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-...
88
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class A__ : _UpperCAmelCase :Union[str, Any] = None def __UpperCamelCase( self ): '''simple docstring''' UpperCamelCase : int ...
629
0
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")): raise OptionalDependencyNotAvailable() except OptionalD...
89
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor __lowerCamelCase : Optional[Any] = logging.get_logger(__name__) class A__ ( __snake_case ): def __init__( self , *A_ , **A_ ): '''simple docstring''' ...
629
0
'''simple docstring''' from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPE...
90
from __future__ import annotations import math def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float: UpperCamelCase : Tuple = u for i in range(1 , _lowerCAmelCase ): UpperCamelCase : Any = temp * (u - i) return temp def A_ ( ) -> ...
629
0
"""simple docstring""" class lowerCAmelCase_ : '''simple docstring''' def __init__( self : Union[str, Any] ,A_ : Union[str, Any] ,A_ : List[Any] ) -> Union[str, Any]: A = name A = val def __str__( self : Dict ) -> Tuple: return F'{s...
91
# Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar __lowerCamelCase : str = TypeVar("""T""") class A__ ( Generic[T] ): def __init__( ...
629
0
'''simple docstring''' import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class __SCREAMING_SNAKE_CASE : def __init__( self : Dict , UpperCAmelCase__ : Union[str, Any]=2 , UpperCAmelCa...
92
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging __low...
629
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) __A = { """configuration_layoutlmv3""": [ """L...
93
import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from transformers.testing_utils...
629
0
'''simple docstring''' import unittest import torch from diffusers import VQModel from diffusers.utils import floats_tensor, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNetTesterMixin enable_full_determinism() class U...
94
__lowerCamelCase : Any = 9.8_0_6_6_5 def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = g ) -> float: if fluid_density <= 0: raise ValueError("Impossible fluid density" ) if volume < 0: raise ValueError("Impossible Object volume" ) if gravity <= 0: raise...
629
0
"""simple docstring""" import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common ...
95
import numpy as np import qiskit def A_ ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str: UpperCamelCase : Tuple = np.random.default_rng(seed=_lowerCAmelCase ) # Roughly 25% of the qubits will contribute to the key. # So we take more than we need. UpperCamelCase...
629
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __lowerCamelCase = { 'configuration_roberta_prelayernorm': [ ...
96
from typing import TYPE_CHECKING from ...utils import _LazyModule __lowerCamelCase : str = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys __lowerCamelCase : List[str] = _LazyModule(__name__, glo...
629
0
import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": __a = argparse.ArgumentParser() parser.add_argument( '--checkpoint_path', default=None, type=str, required=True, help='Path ...
97
# Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> str: UpperCamelCase : Union[str, Any] = { "en": "Machine learning is great, isn't it?", "ru": "Машинное обучение - эт...
629
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, is_vision_available, ) lowercase__ : str = { 'configuration_...
98
def A_ ( _lowerCAmelCase = 1000 ) -> int: UpperCamelCase : Optional[int] = -1 UpperCamelCase : int = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c UpperCamelCase : Optional[Any] = (n *...
629
0
import random from typing import Any def a (lowerCAmelCase__ ): for _ in range(len(lowerCAmelCase__ ) ): __a = random.randint(0 , len(lowerCAmelCase__ ) - 1 ) __a = random.randint(0 , len(lowerCAmelCase__ ) - 1 ) __a , __a = data[b], da...
99
def A_ ( _lowerCAmelCase ) -> bool: UpperCamelCase : List[Any] = 0 for ch in input_str: UpperCamelCase : Optional[Any] = ord(_lowerCAmelCase ) UpperCamelCase : Optional[Any] = pow(2 , _lowerCAmelCase ) # If we already turned on bit for ...
629
0
import webbrowser from sys import argv from urllib.parse import parse_qs, quote import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": _A : Optional[int] = """%20""".join(argv[1:]) if len(argv) > 1 else quote(str(input("""Search: """))) pri...
100
import math import os import unittest from transformers import MegatronBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import Confi...
629
0
import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import evaluate import numpy as np from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForSequenceClassi...
101
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowerCamelCase : List[Any] = { """configuration_chinese_clip""": [ """CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ChineseCLIPConfig"""...
629
0
"""simple docstring""" import torch from diffusers import DiffusionPipeline class lowercase__ ( __SCREAMING_SNAKE_CASE ): """simple docstring""" def __init__( self , _A , _A ): '''simple docstring''' ...
102
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[int]: UpperCamelCase : List[Any] = [1] for i in range(2 , _lowerCAmelCase ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" UpperCamelCase : Tuple =...
629
0
"""simple docstring""" import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets snake_case = '''\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns ...
103
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_confi...
629
0
"""simple docstring""" from ...processing_utils import ProcessorMixin class UpperCamelCase__ ( _lowerCAmelCase ): """simple docstring""" A__ : Tuple = "SpeechT5FeatureExtractor" A__ : List[Any] = "SpeechT5Tokenizer" ...
104
def A_ ( _lowerCAmelCase ) -> bool: return str(_lowerCAmelCase ) == str(_lowerCAmelCase )[::-1] def A_ ( _lowerCAmelCase ) -> int: return int(_lowerCAmelCase ) + int(str(_lowerCAmelCase )[::-1] ) def A_ ( _lowerCAmelCase = 1_0000 ) -> int: UpperCamelCase...
629
0
def __UpperCAmelCase ( lowerCamelCase_ : int ) -> bool: """simple docstring""" return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('''Program to check whether a number is a Perfect number ...
105
__lowerCamelCase : str = 6_5521 def A_ ( _lowerCAmelCase ) -> int: UpperCamelCase : Any = 1 UpperCamelCase : str = 0 for plain_chr in plain_text: UpperCamelCase : List[Any] = (a + ord(_lowerCAmelCase )) % MOD_ADLER UpperCamelCase...
629
0
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def lowerCamelCase_ ( lowerCAmelCase__ : str , lowerCAmelCase__ : Dict ) -> str: '''simple docstring''' ...
106
import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import PaddingStrategy, logging __lo...
629
0
'''simple docstring''' from sklearn.metrics import fa_score import datasets _UpperCAmelCase : Dict = ''' The F1 score is the harmonic mean of the precision and recall. It can be computed with the equation: F1 = 2 * (precision * recall) / (precision + recall) ''' _UpperCAmelCase : ...
107
from typing import Any def A_ ( _lowerCAmelCase ) -> list[Any]: if not input_list: return [] UpperCamelCase : List[str] = [input_list.count(_lowerCAmelCase ) for value in input_list] UpperCamelCase : Dict = max(_lowerCAmelCase ) # Gets the maximum count in...
629
0
import re def _SCREAMING_SNAKE_CASE ( __snake_case ) -> bool: _UpperCAmelCase = 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(__snake_case , __snake_case ) ) if __name__ ==...
108
from random import shuffle import tensorflow as tf from numpy import array def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]: UpperCamelCase : List[Any] = int(_lowerCAmelCase ) assert noofclusters < len(_lowerCAmelCase ) # Find out the dimensionality Upper...
629
0
'''simple docstring''' import os import unittest from transformers import LayoutLMTokenizer, LayoutLMTokenizerFast from transformers.models.layoutlm.tokenization_layoutlm import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMi...
109
import os def A_ ( ) -> Union[str, Any]: with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f: UpperCamelCase : Optional[Any] = [] # noqa: E741 for _ in range(20 ): l.append([int(_lowerCAmelCase ) for x in f.readline().split()] ) UpperCamelCase : ...
629
0
'''simple docstring''' import inspect import os import unittest from dataclasses import dataclass import torch from accelerate import Accelerator, DistributedDataParallelKwargs, GradScalerKwargs from accelerate.state import AcceleratorState from accelerate.test_utils import execute_subprocess_async, require_cuda, ...
119
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class A__ : _UpperCAmelCase :Union[str, Any] = None def __UpperCamelCase( self ): '''simple docstring''' UpperCamelCase : int ...
629
0
"""simple docstring""" import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin _lowerCAmelCase : List[Any] = """ Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that...
46
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor __lowerCamelCase : Optional[Any] = logging.get_logger(__name__) class A__ ( __snake_case ): def __init__( self , *A_ , **A_ ): '''simple docstring''' ...
629
0
import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() _lowercase : Optional[...
305
from __future__ import annotations import math def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float: UpperCamelCase : Tuple = u for i in range(1 , _lowerCAmelCase ): UpperCamelCase : Any = temp * (u - i) return temp def A_ ( ) -> ...
629
0
import flax.linen as nn import jax import jax.numpy as jnp class A_ ( nn.Module ): _SCREAMING_SNAKE_CASE = 42 _SCREAMING_SNAKE_CASE = jnp.floataa def _UpperCAmelCase ( self : str ): __a = nn.Conv( self.out_channels , kernel_size=(3,...
197
# Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar __lowerCamelCase : str = TypeVar("""T""") class A__ ( Generic[T] ): def __init__( ...
629
0
import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class _lowercase ( __snake_case ): _lowercase : Dict = '' _lowercase : str = ( None # protocol passed i...
203
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging __low...
629
0
'''simple docstring''' import os def _lowerCamelCase ( ) -> Union[str, Any]: with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f: _a = [] # noqa: E741 for _ in range(20 ): l.append([int(_lowerCAmelCase ) for x in ...
692
import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from transformers.testing_utils...
629
0
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration a ={ """tiny.en""": """https://openaipublic.azureedge.net/main/whisper/models/d3dd57d32acc...
652
__lowerCamelCase : Any = 9.8_0_6_6_5 def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = g ) -> float: if fluid_density <= 0: raise ValueError("Impossible fluid density" ) if volume < 0: raise ValueError("Impossible Object volume" ) if gravity <= 0: raise...
629
0
'''simple docstring''' _lowerCAmelCase = range(2, 2_0 + 1) _lowerCAmelCase = [1_0**k for k in range(ks[-1] + 1)] _lowerCAmelCase = {} def _lowerCAmelCase ( lowercase : str , lowercase : Tuple , lowercase : Optional[int] , l...
161
import numpy as np import qiskit def A_ ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str: UpperCamelCase : Tuple = np.random.default_rng(seed=_lowerCAmelCase ) # Roughly 25% of the qubits will contribute to the key. # So we take more than we need. UpperCamelCase...
629
0
from __future__ import annotations from random import random class UpperCamelCase__ : def __init__( self : int, __lowerCamelCase : List[str] = None ) -> Any: UpperCamelCase__ : Any = value UpperCamelCase__ : List[Any] = random() ...
344
from typing import TYPE_CHECKING from ...utils import _LazyModule __lowerCamelCase : str = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys __lowerCamelCase : List[str] = _LazyModule(__name__, glo...
629
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule __lowercase = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys __lowercase = _LazyModule(__name__, glob...
370
# Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> str: UpperCamelCase : Union[str, Any] = { "en": "Machine learning is great, isn't it?", "ru": "Машинное обучение - эт...
629
0