code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" import colorsys from PIL import Image # type: ignore def lowerCamelCase ( _UpperCamelCase : float , _UpperCamelCase : float , _UpperCamelCase : int ) -> float: '''simple docstring''' __UpperCAmelCase : ...
115
from __future__ import annotations import os from collections.abc import Mapping a_ = tuple[int, int] class lowercase__ : def __init__( self , __UpperCAmelCase , __UpperCAmelCase )-> None: '''simple docstring''' lowerCAmelCase__ = ...
340
0
import math def lowerCamelCase_ ( _UpperCamelCase ) -> bool: """simple docstring""" return math.sqrt(UpperCamelCase_ ) * math.sqrt(UpperCamelCase_ ) == num def lowerCamelCase_ ( _UpperCamelCase ) -> bool: """simple docstring""" snak...
279
from collections import defaultdict from math import gcd def _a ( UpperCamelCase_ : int = 1_500_000 ) -> int: """simple docstring""" lowerCAmelCase__ = defaultdict(UpperCamelCase_ ) lowerCAmelCase__ = 2 while 2 * euclid_m ...
340
0
'''simple docstring''' def UpperCamelCase_ ( A__ : int = 1 , A__ : int = 10_00 ): '''simple docstring''' lowerCAmelCase_ : List[Any] = 1 lowerCAmelCase_ : Tuple = 0 for divide_by_number in range(UpperCamelCase_ , ...
120
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class lowercase__ ( _UpperCAmelCase ): a_ ...
340
0
def lowerCamelCase__ ( ) -> int: return 1 def lowerCamelCase__ ( snake_case_ : int ) -> int: return 0 if x < 0 else two_pence(x - 2 ) + one_pence() def lowerCamelCase__ ( snake_case_ : int ) -> int: ...
24
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 i...
340
0
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase :Tuple = logging.get_logger(__name__) _lowerCAmelCase :List[str] = { 'asapp/sew-tiny-100k': 'https://huggingface.co/asapp/sew-tiny-10...
263
from __future__ import annotations from cmath import sqrt def _a ( UpperCamelCase_ : int , UpperCamelCase_ : int , UpperCamelCase_ : int ) -> tuple[complex, complex]: """simple docstring""" if a == 0: raise ValueError("Coefficient...
340
0
import json import os import shutil import tempfile import unittest import numpy as np from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES, BertTokenizer from transformers.testing_utils import require_tokenizers, require_vision from transforme...
157
import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def _a ( UpperCamelCase_ : int = 3 ) -> qiskit.result.counts.Counts: """simple docstring""" if isinstance(UpperCamelCase_ , Up...
340
0
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list , SCREAMING_SNAKE_CASE_: list , SCREAMING_SNAKE_CASE_: int , SCREAMING_SNAKE_CASE_: int , SCREAMING_SNAKE_CASE_: int ) -> int: '''simple docstring''' if index == number_of_items: ...
68
import warnings from transformers import AutoTokenizer from transformers.utils import is_torch_available from transformers.utils.generic import ExplicitEnum from ...processing_utils import ProcessorMixin if is_torch_available(): import torch class lowercase__ ( _UpperCAmelCase ): a_ ="""char""...
340
0
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from diffusers.utils import flo...
94
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) a_ = { '''configuration_convbert''': ['''CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ConvBertConfig''', '''Conv...
340
0
"""simple docstring""" from __future__ import annotations __SCREAMING_SNAKE_CASE : List[Any] = 8.9_88E9 # units = N * m^s * C^-2 def _a ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> dict[str, float]: snake...
347
from collections import defaultdict def _a ( UpperCamelCase_ : int ) -> int: """simple docstring""" lowerCAmelCase__ = 1 lowerCAmelCase__ = True for v in tree[start]: if v not in visited: ret += df...
340
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, require...
43
import requests from bsa import BeautifulSoup def _a ( UpperCamelCase_ : str = "AAPL" ) -> str: """simple docstring""" lowerCAmelCase__ = F"https://in.finance.yahoo.com/quote/{symbol}?s={symbol}" lowerCAmelCase__ = BeautifulSoup(requ...
340
0
"""simple docstring""" _UpperCAmelCase = { """km/h""": 1.0, """m/s""": 3.6, """mph""": 1.6_0_9_3_4_4, """knot""": 1.8_5_2, } _UpperCAmelCase = { """km/h""": 1.0, """m/s""": 0.2_7_7_7_7_7_7_7_8, """mph""": 0.6_2_1_3_7_1_1_9_2, """knot""": 0.5_3_9_9_5_6_8_0_3, } ...
173
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass a_ = (3, 9, -11, 0, 7, 5, 1, -1) a_ = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class lowercase__ : a_ =42 a_ =42 class lowercase__ : def __init__( ...
340
0
"""simple docstring""" def lowerCamelCase ( _UpperCamelCase : int ) -> str: '''simple docstring''' if isinstance(UpperCamelCase_ , UpperCamelCase_ ): raise TypeError("""'float' object cannot be interpreted as an integer""" ) ...
115
import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline a_ = { '''n_samples''': 64, '''horizon''': 32, '''num_inference_steps''': 20, '''n_guide_steps''': 2, # can set to 0 for faster sampling, does not use value network '''scale_grad_by_...
340
0
import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, DistilBertConfig, DistilBertForMaskedLM, Dist...
279
import argparse import os 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_task_guides.py a_ = '''src/transformers''' a_ = '''docs/source/en/tasks''' def ...
340
0
'''simple docstring''' from graphs.minimum_spanning_tree_kruskal import kruskal def UpperCamelCase_ ( ): '''simple docstring''' lowerCAmelCase_ : Optional[int] = 9 lowerCAmelCase_ : int = [ [0, 1, 4], [0, 7, 8], [1,...
120
import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() a_ = logging.get_logger(__name__) a_ = {name: getattr(transformers, name + '''Fast''') for name in SLOW_TO_FAST_CONVERTERS} de...
340
0
import warnings from transformers import AutoTokenizer from transformers.utils import is_torch_available from transformers.utils.generic import ExplicitEnum from ...processing_utils import ProcessorMixin if is_torch_available(): import torch class SCREAMING_SNAKE_CASE__ ( _Up...
24
import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def _a ( UpperCamelCase_ : str , UpperCamelCase_ : int , UpperCamelCase_ : List[str]=1_024 , UpperCamelCase_ ...
340
0
"""simple docstring""" import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloyd_if import IFWatermarker f...
263
import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging a_ = logging.get_logger(__name__) a_ = { '''xlnet-base-cased''': '''https://huggingface.co/xlnet-base-cased/resolve/main/config.json''', '''xlnet-large-cased''': '''https://huggingface.co/...
340
0
_snake_case = {} def _UpperCamelCase ( snake_case__, snake_case__, snake_case__ ) -> int: if late == 3 or absent == 2: return 0 # if we have no days left, and have not failed any other rules, # we have a prize string ...
157
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) def...
340
0
import numpy as np import datasets lowerCAmelCase__ = """ Compute the Mahalanobis Distance Mahalonobis distance is the distance between a point and a distribution. And not between two distinct points. It is effectively a multivariate equivalent of the Euclidean distance. It was introduced by Prof. P....
68
from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Im...
340
0
import sys snake_case : List[str] = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''12540698747158523863050715693290963295227443043557''' '''6689664...
94
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin a_ = get_tests_dir('''fixtures/test_sentencepiece_bpe.model''') ...
340
0
"""simple docstring""" import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosity_info() __SCREAMING_SNAKE_CA...
347
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer a_ = logging.get_logger(__name__) a_ = {'''vocab_file''...
340
0
import inspect from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion import StableDiffu...
43
a_ = '''0.21.0''' from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_dispatch, ) from .data_loader import skip_first_batches from .launchers...
340
0
"""simple docstring""" import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SegformerConfig, SegformerForImageClassification, ...
173
import collections import importlib.util import os import re from pathlib import Path a_ = '''src/transformers''' # Matches is_xxx_available() a_ = re.compile(r'''is\_([a-z_]*)_available()''') # Catches a one-line _import_struct = {xxx} a_ = re.compile(r'''^_import_structure\s+=\s+\{(...
340
0
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowerCamelCase__ ( metaclass=_UpperCAmelCase ): """simple docstring""" __a = ["""torch""", """torchsde"""] def __init__( self : Union[str, Any] , *UpperCa...
115
from __future__ import annotations import os from collections.abc import Mapping a_ = tuple[int, int] class lowercase__ : def __init__( self , __UpperCAmelCase , __UpperCAmelCase )-> None: '''simple docstring''' lowerCAmelCase__ = ...
340
0
import math from numpy import inf from scipy.integrate import quad def lowerCamelCase_ ( _UpperCamelCase ) -> float: """simple docstring""" if num <= 0: raise ValueError('''math domain error''' ) return quad(UpperCamelCase_ , 0 , UpperCamelCase_ , ar...
279
from collections import defaultdict from math import gcd def _a ( UpperCamelCase_ : int = 1_500_000 ) -> int: """simple docstring""" lowerCAmelCase__ = defaultdict(UpperCamelCase_ ) lowerCAmelCase__ = 2 while 2 * euclid_m ...
340
0
'''simple docstring''' import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def UpperCamelCase_ ( ): '''simple docstring''' lowerCAmelCase_ : int...
120
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class lowercase__ ( _UpperCAmelCase ): a_ ...
340
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta.toke...
24
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 i...
340
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor _lowerCAmelCase :Any = logging.get_logger(__name__) class _UpperCAmelCase ( _UpperCAmelCase ): '''simple docstring''' def __init__( ...
263
from __future__ import annotations from cmath import sqrt def _a ( UpperCamelCase_ : int , UpperCamelCase_ : int , UpperCamelCase_ : int ) -> tuple[complex, complex]: """simple docstring""" if a == 0: raise ValueError("Coefficient...
340
0
def _UpperCamelCase ( snake_case__ ) -> Union[str, Any]: if not head: return True # split the list to two parts __UpperCAmelCase , __UpperCAmelCase : str = head.next, head while fast and fast.next: __UpperCAm...
157
import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def _a ( UpperCamelCase_ : int = 3 ) -> qiskit.result.counts.Counts: """simple docstring""" if isinstance(UpperCamelCase_ , Up...
340
0
import logging from transformers.configuration_utils import PretrainedConfig lowerCAmelCase__ = logging.getLogger(__name__) class a__ ( _UpperCAmelCase ): """simple docstring""" __lowerCamelCase = 'masked_bert' def __init__( self , lowercase=30522 ...
68
import warnings from transformers import AutoTokenizer from transformers.utils import is_torch_available from transformers.utils.generic import ExplicitEnum from ...processing_utils import ProcessorMixin if is_torch_available(): import torch class lowercase__ ( _UpperCAmelCase ): a_ ="""char""...
340
0
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() snake_case : List[str] = [ '''word_embeddings_la...
94
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) a_ = { '''configuration_convbert''': ['''CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ConvBertConfig''', '''Conv...
340
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __SCREAMING_SNAKE_CASE : List[Any] = logging.get_logger(__name__) __SCREAMING_SNAKE_CASE : Tuple = { 'naver-clova-ix/donut-base': 'https://huggingface.co/naver-clova-ix/donut-b...
347
from collections import defaultdict def _a ( UpperCamelCase_ : int ) -> int: """simple docstring""" lowerCAmelCase__ = 1 lowerCAmelCase__ = True for v in tree[start]: if v not in visited: ret += df...
340
0
import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig f...
43
import requests from bsa import BeautifulSoup def _a ( UpperCamelCase_ : str = "AAPL" ) -> str: """simple docstring""" lowerCAmelCase__ = F"https://in.finance.yahoo.com/quote/{symbol}?s={symbol}" lowerCAmelCase__ = BeautifulSoup(requ...
340
0
"""simple docstring""" import unittest from transformers import DebertaVaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common impo...
173
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass a_ = (3, 9, -11, 0, 7, 5, 1, -1) a_ = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class lowercase__ : a_ =42 a_ =42 class lowercase__ : def __init__( ...
340
0
"""simple docstring""" import collections import json import os import re from typing import TYPE_CHECKING, List, Optional, Tuple import numpy as np from ...tokenization_utils_fast import PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational im...
115
import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline a_ = { '''n_samples''': 64, '''horizon''': 32, '''num_inference_steps''': 20, '''n_guide_steps''': 2, # can set to 0 for faster sampling, does not use value network '''scale_grad_by_...
340
0
import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder lowerCAmelCase_ = '''__DUMMY_TRANSFORMERS_USER__''' lowerCAmelCase_ = '''Dummy User''' lowerCAmelCase_ = '''hf_hZEmnoOEYISjraJtbySaKCNnSu...
279
import argparse import os 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_task_guides.py a_ = '''src/transformers''' a_ = '''docs/source/en/tasks''' def ...
340
0
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters __A : Dict = (720, 1280) # Height, Width __A : str = (0.4, 0.6) # if height or width lower than this ...
120
import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() a_ = logging.get_logger(__name__) a_ = {name: getattr(transformers, name + '''Fast''') for name in SLOW_TO_FAST_CONVERTERS} de...
340
0
from typing import TYPE_CHECKING from ...utils import _LazyModule snake_case_ = {'tokenization_byt5': ['ByT5Tokenizer']} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys snake_case_ = _LazyModule(__name__, globals()['__file__'], _import...
24
import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def _a ( UpperCamelCase_ : str , UpperCamelCase_ : int , UpperCamelCase_ : List[str]=1_024 , UpperCamelCase_ ...
340
0
"""simple docstring""" from collections import defaultdict def lowerCamelCase_ (UpperCamelCase__ : int ): _UpperCAmelCase : Union[str, Any] = 1 _UpperCAmelCase : Dict = True for v in tree[start]: if v not in visited: ret += d...
263
import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging a_ = logging.get_logger(__name__) a_ = { '''xlnet-base-cased''': '''https://huggingface.co/xlnet-base-cased/resolve/main/config.json''', '''xlnet-large-cased''': '''https://huggingface.co/...
340
0
from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_...
157
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) def...
340
0
'''simple docstring''' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE = 10**9 ): _snake_case = 1 _snake_case = 2 _snake_case = 0 _snake_case = 0 _snake_case = 0 while perimeter <= max_perimeter: perimeters_sum += perimeter ...
341
'''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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET...
341
1
'''simple docstring''' from __future__ import annotations from fractions import Fraction def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) ...
341
'''simple docstring''' __lowerCAmelCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): # Make sure the supplied data is a bytes-like object if not isinstance(_SCREAMING_SNAKE_CASE , ...
341
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from diffu...
341
'''simple docstring''' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): if discount_rate < 0: raise ValueError("""Discount rate cannot be negative""" ) if not cash_flows: raise ValueError("""Cash flows list cannot be ...
341
1
'''simple docstring''' # We ignore warnings about stepping the scheduler since we step it ourselves during gradient accumulation import warnings from .state import AcceleratorState, GradientState warnings.filterwarnings('ignore', category=UserWarning, module='torch.optim.lr_scheduler') class _lowerCAmelCase ...
341
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __lowerCAmelCase = { 'configuration_m2m_100': ['M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP', 'M2M100Config', 'M2M100OnnxConfig'], ...
341
1
'''simple docstring''' from __future__ import annotations __lowerCAmelCase = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } class _lowerCAmelCase : '''simple docstring'''...
341
'''simple docstring''' import os from typing import Dict, List, Tuple, TypeVar, Union __lowerCAmelCase = TypeVar('T') __lowerCAmelCase = Union[List[T], Tuple[T, ...]] __lowerCAmelCase = Union[T, List[T], Dict[str, T]] __lowerCAmelCase = Union[str, ...
341
1
'''simple docstring''' from datetime import datetime import requests from bsa import BeautifulSoup if __name__ == "__main__": __lowerCAmelCase = input('Enter image url: ').strip() print(f'''Downloading image from {url} ...''') __lowerCAmelCase = BeautifulSoup(requests.ge...
341
'''simple docstring''' class _lowerCAmelCase : '''simple docstring''' def __init__(self , UpperCAmelCase , UpperCAmelCase=None , UpperCAmelCase=None ) -> int: _snake_case = data _snake_case = previous _snake_case = next_node ...
341
1
'''simple docstring''' import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, PLBartTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ) from ...test_to...
341
'''simple docstring''' from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffusers.sched...
341
1
'''simple docstring''' class _lowerCAmelCase : '''simple docstring''' def __init__(self , UpperCAmelCase , UpperCAmelCase=None , UpperCAmelCase=None ) -> int: _snake_case = data _snake_case = previous _snake_case = next_node ...
341
'''simple docstring''' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE = 10**9 ): _snake_case = 1 _snake_case = 2 _snake_case = 0 _snake_case = 0 _snake_case = 0 while perimeter <= max_perimeter: perimeters_sum += perimeter ...
341
1
'''simple docstring''' import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor __lowerCAmelCase = logging.getLogger(__name__) __lowerCAmelCase ...
341
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTokenizer...
341
1
'''simple docstring''' import copy import inspect import unittest from transformers import PretrainedConfig, SwiftFormerConfig from transformers.testing_utils import ( require_torch, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available, is_vision_ava...
341
'''simple docstring''' __lowerCAmelCase = [ (1_000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I'), ] def __SCREAMING_SNAKE_CASE ( _SCREA...
341
1
'''simple docstring''' from scipy.stats import spearmanr import datasets __lowerCAmelCase = '\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implying no correlati...
341
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) __lowerCAmelCase = { 'configuration_perceiver': ['PERCEIVER_PRETRAINED_CONFIG_ARCHI...
341
1
'''simple docstring''' 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 ( ): print("""Making key files...""" ) make_key_files("""rsa""" , 1024 ...
341
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax...
341
1
'''simple docstring''' import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from transformers.models.switch_transfo...
341
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, requi...
341
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import LEDConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor from ...te...
341
'''simple docstring''' import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @re...
341
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowerCAmelCase = { 'configuration_clipseg': [ 'CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CLIPSegConfig', 'CLIPSegTextConfig', ...
341
'''simple docstring''' from __future__ import annotations def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): if len(_SCREAMING_SNAKE_CASE ) == 0: return [] _snake_case, _snake_case = min(_SCREAMING_SNAKE_CASE ), max(_SCREAMING_SNAKE_CASE ) ...
341
1
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging __lowerCAmelCase = loggin...
341
'''simple docstring''' import uuid from typing import Any, Dict, List, Optional, Union from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf if is_torch_available(): import torch __...
341
1
'''simple docstring''' from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffusers.sched...
341
'''simple docstring''' from math import factorial, radians def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = 18 , _SCREAMING_SNAKE_CASE = 10 ): _snake_case = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) # Converting from...
341
1
'''simple docstring''' import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets __lowerCAmelCase = '\n@inproceedings{xu-etal-2016-optimizing,\n title = {Optimizing Statistical Machine Translation for Text Simplifica...
341
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets __lowerCAmelCase = '\\n@inproceedings{popovic-2015-chrf,\n title = "chr{F}: character n-gram {F}-score for automatic {MT} evaluation",\n author = "Popovi{\'c}, Maja",\n b...
341
1
'''simple docstring''' from __future__ import annotations def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): if len(_SCREAMING_SNAKE_CASE ) < k or k < 0: raise ValueError("""Invalid Input""" ) _snake_case = _snake_case ...
341
'''simple docstring''' from scipy.stats import spearmanr import datasets __lowerCAmelCase = '\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implying no correlati...
341
1
'''simple docstring''' from __future__ import annotations from decimal import Decimal from numpy import array def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): _snake_case = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implementation ...
341
'''simple docstring''' 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,...
341
1
'''simple docstring''' import collections import os import re from pathlib import Path __lowerCAmelCase = 'src/transformers' # Matches is_xxx_available() __lowerCAmelCase = re.compile(r'is\_([a-z_]*)_available()') # Catches a one-line _import_struct = {xxx} __lowerCAmelCase ...
341
'''simple docstring''' import argparse from collections import defaultdict def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): _snake_case = f"""{fil...
341
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase = logging.get_logger(__name__) __lowerCAmelCase = { 'EleutherAI/gpt-neox-20b': 'https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/config.json', ...
341
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __lowerCAmelCase = { 'configuration_falcon': ['FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FalconConfig'], } try: if not is_torch_availa...
341
1
'''simple docstring''' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): if discount_rate < 0: raise ValueError("""Discount rate cannot be negative""" ) if not cash_flows: raise ValueError("""Cash flows list cannot be ...
341
'''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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET...
341
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __lowerCAmelCase = { 'configuration_falcon': ['FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FalconConfig'], } try: if not is_torch_availa...
341
'''simple docstring''' __lowerCAmelCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): # Make sure the supplied data is a bytes-like object if not isinstance(_SCREAMING_SNAKE_CASE , ...
341
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase = logging.get_logger(__name__) __lowerCAmelCase = { 'bigcode/gpt_bigcode-santacoder': 'https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/con...
341
'''simple docstring''' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): if discount_rate < 0: raise ValueError("""Discount rate cannot be negative""" ) if not cash_flows: raise ValueError("""Cash flows list cannot be ...
341
1
'''simple docstring''' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): _snake_case = int(_SCREAMING_SNAKE_CASE ) if decimal in (0, 1): # Exit cases for the recursion return str(_SCREAMING_SNAKE_CASE ) _snake_case, _snake_case = divmod(_SCR...
341
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __lowerCAmelCase = { 'configuration_m2m_100': ['M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP', 'M2M100Config', 'M2M100OnnxConfig'], ...
341
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor __lowerCAmelCase = logging.get_logger(__name__) class _lowerCAmelCase ( __snake_case ): '''simple docstring''' def __init__(self , *Upp...
341
'''simple docstring''' import os from typing import Dict, List, Tuple, TypeVar, Union __lowerCAmelCase = TypeVar('T') __lowerCAmelCase = Union[List[T], Tuple[T, ...]] __lowerCAmelCase = Union[T, List[T], Dict[str, T]] __lowerCAmelCase = Union[str, ...
341
1
'''simple docstring''' import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @re...
341
'''simple docstring''' class _lowerCAmelCase : '''simple docstring''' def __init__(self , UpperCAmelCase , UpperCAmelCase=None , UpperCAmelCase=None ) -> int: _snake_case = data _snake_case = previous _snake_case = next_node ...
341
1
'''simple docstring''' import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging __lowerCAmelCase = logging.get_logger(__name__) __lowerCAmelCase = {'vocab...
341
'''simple docstring''' from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffusers.sched...
341
1
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ,...
341
'''simple docstring''' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE = 10**9 ): _snake_case = 1 _snake_case = 2 _snake_case = 0 _snake_case = 0 _snake_case = 0 while perimeter <= max_perimeter: perimeters_sum += perimeter ...
341
1
'''simple docstring''' import numpy as np # Importing the Keras libraries and packages import tensorflow as tf from tensorflow.keras import layers, models if __name__ == "__main__": # Initialising the CNN # (Sequential- Building the model layer by layer) __lowerCAmelCase = models.Sequent...
341
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTokenizer...
341
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available __lowerCAmelCase = { 'configuration_audio_spectrogram_transformer': [ 'AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_CONFIG_ARCHIV...
341
'''simple docstring''' __lowerCAmelCase = [ (1_000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I'), ] def __SCREAMING_SNAKE_CASE ( _SCREA...
341
1
'''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_seed from ...
341
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) __lowerCAmelCase = { 'configuration_perceiver': ['PERCEIVER_PRETRAINED_CONFIG_ARCHI...
341
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) __lowerCAmelCase = { 'configuration_perceiver': ['PERCEIVER_PRETRAINED_CONFIG_ARCHI...
341
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax...
341
1
'''simple docstring''' from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf impo...
341
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, requi...
341
1
'''simple docstring''' import unittest from transformers import RoFormerTokenizer, RoFormerTokenizerFast from transformers.testing_utils import require_rjieba, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_rjieba @require_tokenizers class _lowerCAmelCase ( __snak...
341
'''simple docstring''' import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @re...
341
1
'''simple docstring''' 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,...
341
'''simple docstring''' from __future__ import annotations def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): if len(_SCREAMING_SNAKE_CASE ) == 0: return [] _snake_case, _snake_case = min(_SCREAMING_SNAKE_CASE ), max(_SCREAMING_SNAKE_CASE ) ...
341
1
'''simple docstring''' __lowerCAmelCase = { 'meter': 'm', 'kilometer': 'km', 'megametre': 'Mm', 'gigametre': 'Gm', 'terametre': 'Tm', 'petametre': 'Pm', 'exametre': 'Em', 'zettametre': 'Zm', 'yottametre': 'Ym', } # Exponent of the factor(meter) __lowerCAmelCase ...
341
'''simple docstring''' import uuid from typing import Any, Dict, List, Optional, Union from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf if is_torch_available(): import torch __...
341
1
'''simple docstring''' from __future__ import annotations def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): _snake_case = str(_SCREAMING_SNAKE_CASE ) return n == n[::-1] def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE = 100_0000 ): _snake_...
341
'''simple docstring''' from math import factorial, radians def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = 18 , _SCREAMING_SNAKE_CASE = 10 ): _snake_case = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) # Converting from...
341
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __lowerCAmelCase = { 'configuration_data2vec_audio': ['DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Data2VecAudioConfig'], 'config...
341
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets __lowerCAmelCase = '\\n@inproceedings{popovic-2015-chrf,\n title = "chr{F}: character n-gram {F}-score for automatic {MT} evaluation",\n author = "Popovi{\'c}, Maja",\n b...
341
1
'''simple docstring''' import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokeni...
341
'''simple docstring''' from scipy.stats import spearmanr import datasets __lowerCAmelCase = '\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implying no correlati...
341
1
'''simple docstring''' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): _snake_case = [0] * len(_SCREAMING_SNAKE_CASE ) _snake_case = [] _snake_case = [1] * len(_SCREAMING_SNAKE_CASE ) for values in graph.values(): for i in values: ...
341
'''simple docstring''' 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,...
341
1
'''simple docstring''' __lowerCAmelCase = 'Input must be a string of 8 numbers plus letter' __lowerCAmelCase = 'TRWAGMYFPDXBNJZSQVHLCKE' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): if not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_S...
341
'''simple docstring''' import argparse from collections import defaultdict def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): _snake_case = f"""{fil...
341
1
'''simple docstring''' from __future__ import annotations import math def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): if depth < 0: ...
341
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __lowerCAmelCase = { 'configuration_falcon': ['FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FalconConfig'], } try: if not is_torch_availa...
341
1
'''simple docstring''' import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): _snake_case = os.path.join(args.tf_model_dir , """parameters.json""" ...
341
'''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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET...
341
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCAmelCase = logging.get_logger(__name__) __lowerCAmelCase ...
341
'''simple docstring''' __lowerCAmelCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): # Make sure the supplied data is a bytes-like object if not isinstance(_SCREAMING_SNAKE_CASE , ...
341
1
'''simple docstring''' from __future__ import annotations def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): return [ord(_SCREAMING_SNAKE_CASE ) - 96 for elem in plain] def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): return "".join(chr(elem + 96 ...
341
'''simple docstring''' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): if discount_rate < 0: raise ValueError("""Discount rate cannot be negative""" ) if not cash_flows: raise ValueError("""Cash flows list cannot be ...
341
1
'''simple docstring''' from heapq import heappop, heappush import numpy as np def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , ): _snake_case, _snake_case = grid.shape ...
341
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __lowerCAmelCase = { 'configuration_m2m_100': ['M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP', 'M2M100Config', 'M2M100OnnxConfig'], ...
341
1
'''simple docstring''' import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE=...
341
'''simple docstring''' import os from typing import Dict, List, Tuple, TypeVar, Union __lowerCAmelCase = TypeVar('T') __lowerCAmelCase = Union[List[T], Tuple[T, ...]] __lowerCAmelCase = Union[T, List[T], Dict[str, T]] __lowerCAmelCase = Union[str, ...
341
1
'''simple docstring''' __lowerCAmelCase = { "joule": 1.0, "kilojoule": 1_000, "megajoule": 1_000_000, "gigajoule": 1_000_000_000, "wattsecond": 1.0, "watthour": 3_600, "kilowatthour": 3_600_000, "newtonmeter": 1.0, "calorie_nutr": 4_186.8, "kilocalorie_nutr": 4_...
341
'''simple docstring''' class _lowerCAmelCase : '''simple docstring''' def __init__(self , UpperCAmelCase , UpperCAmelCase=None , UpperCAmelCase=None ) -> int: _snake_case = data _snake_case = previous _snake_case = next_node ...
341
1
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers import is_speech_available, is_vision_available from transformers.testing_utils import require_torch if is_vision_available(): from transformers import TvltImageProcessor if is_speech_availa...
341
'''simple docstring''' from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffusers.sched...
341
1
'''simple docstring''' import argparse import json from collections import OrderedDict import torch from huggingface_hub import cached_download, hf_hub_url from transformers import AutoImageProcessor, CvtConfig, CvtForImageClassification def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): ...
341
'''simple docstring''' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE = 10**9 ): _snake_case = 1 _snake_case = 2 _snake_case = 0 _snake_case = 0 _snake_case = 0 while perimeter <= max_perimeter: perimeters_sum += perimeter ...
341
1
'''simple docstring''' import argparse import dataclasses import json import logging import os import shutil from typing import List, Optional import datasets from accelerate import Accelerator from datasets import load_dataset from finetuning import finetune from tqdm.auto import tqdm import transformers from trans...
341
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTokenizer...
341
1
'''simple docstring''' import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def __SCREAMING_SNAKE_CASE ...
341
'''simple docstring''' __lowerCAmelCase = [ (1_000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I'), ] def __SCREAMING_SNAKE_CASE ( _SCREA...
341
1
'''simple docstring''' import math def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = 0 , _SCREAMING_SNAKE_CASE = 0 ): _snake_case = end or len(_SCREAMING_SNAKE_CASE ) for i in range(_SCREAMING_SNAKE_CASE , _SCREAMING_S...
341
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) __lowerCAmelCase = { 'configuration_perceiver': ['PERCEIVER_PRETRAINED_CONFIG_ARCHI...
341
1
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unle...
341
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax...
341
1
'''simple docstring''' import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def ...
341
'''simple docstring''' import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, requi...
341
1
'''simple docstring''' import heapq import sys import numpy as np __lowerCAmelCase = tuple[int, int] class _lowerCAmelCase : '''simple docstring''' def __init__(self ) -> Dict: _snake_case = [] _snake_case = set() def ...
341
'''simple docstring''' import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @re...
341
1
'''simple docstring''' __lowerCAmelCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): # Make sure the supplied data is a bytes-like object if not isinstance(_SCREAMING_SNAKE_CASE , ...
341
'''simple docstring''' from __future__ import annotations def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE ): if len(_SCREAMING_SNAKE_CASE ) == 0: return [] _snake_case, _snake_case = min(_SCREAMING_SNAKE_CASE ), max(_SCREAMING_SNAKE_CASE ) ...
341
1
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging __lowerCAmelCase = loggin...
341
'''simple docstring''' import uuid from typing import Any, Dict, List, Optional, Union from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf if is_torch_available(): import torch __...
341
1
'''simple docstring''' import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets __lowerCAmelCase = datasets.logging.get_logger(__name__) __lowerCAmelCase = '\\n@InProceedin...
341
'''simple docstring''' from math import factorial, radians def __SCREAMING_SNAKE_CASE ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = 18 , _SCREAMING_SNAKE_CASE = 10 ): _snake_case = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) # Converting from...
341
1