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
from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def lowerCamelCase_ ( _UpperCamelCase ) -> None: """simple docstring""" snake_case_ , snake_case_ : Optional[Any] = analyze_text(_Up...
60
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torcha...
103
0
from typing import Dict from transformers import EvalPrediction, HfArgumentParser, TrainingArguments, is_torch_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, get_torch_dist_unique_port, require_torch_multi_gpu, require_torch_neuroncore, ...
61
"""simple docstring""" import operator def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ = False , lowerCAmelCase_ = None ) -> list: _snake_case = operator.lt if reverse else operator.gt _snake_case = solution or [] if not arr: retu...
103
0
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case = logging.get_logger(__name__) snake_case = { """huggingface/informer-tourism-monthly""": ( """https://huggingface.co/huggingface/informer-touri...
62
"""simple docstring""" import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.mode...
103
0
from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class a : """simple docstring""" a : torch.Tensor # [batch_size x 3] a : torch.Tensor # [batch_size x 3] a : torch.Tensor ...
63
"""simple docstring""" from copy import deepcopy class UpperCAmelCase : def __init__( self : Optional[Any] , __lowerCamelCase : list[int] | None = None , __lowerCamelCase : int | None = None ): """simple docstring""" ...
103
0
import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def A__ ( snake_case_ ...
64
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic...
103
0
"""simple docstring""" def lowerCAmelCase ( __UpperCamelCase ): '''simple docstring''' if not isinstance(__UpperCamelCase , __UpperCamelCase ): raise ValueError("""Input must be an integer""" ) if input_num <= 0: raise ValueError("""Input must be positive""" )...
65
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenizatio...
103
0
def __magic_name__ ( SCREAMING_SNAKE_CASE ) -> list: if len(SCREAMING_SNAKE_CASE ) <= 1: return [tuple(SCREAMING_SNAKE_CASE )] _lowercase : List[Any] = [] def generate(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): ...
66
"""simple docstring""" from ...configuration_utils import PretrainedConfig class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): A__ : str = '''bert-generation''' def __init__( self : Tuple , __lowerCamelCase : Optional[int]=5_0_3_5_8 ...
103
0
import sys from collections import defaultdict class A_ : """simple docstring""" def __init__( self : str ) -> Union[str, Any]: _lowercase = [] def __UpperCAmelCase ( self ...
67
"""simple docstring""" from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=__SCREAMING_SNAKE_CASE ): A__ : Optional[int] = ['''torch''', '''scipy'''] def __init__( self : Any , *__lowerCamelCase : List[...
103
0
import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def lowercase__ ( ) -> Union[str, Any]: """simple docstring""" with offline(...
68
"""simple docstring""" def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> int: return 1 if input_a == input_a else 0 def snake_case ( ) -> None: assert xnor_gate(0 , 0 ) == 1 assert xnor_gate(0 , 1 ) == 0 assert xnor_gate(1 , ...
103
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, res...
69
"""simple docstring""" import os from pathlib import Path def snake_case ( ) -> Tuple: from torch.utils.cpp_extension import load _snake_case = Path(lowerCAmelCase_ ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' _snake_case = ...
103
0
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code...
70
"""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 FlaxGenerationTesterMixi...
103
0
'''simple docstring''' def a__ ( _SCREAMING_SNAKE_CASE : str ) -> Dict: """simple docstring""" UpperCAmelCase_ , UpperCAmelCase_ : List[Any] = [], [] while len(_SCREAMING_SNAKE_CASE ) > 1: UpperCAmelCase_ , UpperCAmelCase_ : ...
71
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): @staticmethod @abstractmethod def __UpperCAmelCase ( __lowerCamelCase : ArgumentParser ): "...
103
0
'''simple docstring''' from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelerate....
72
"""simple docstring""" import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logg...
103
0
import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class _snake_case ( unittest.TestCase ): _lowercase : Optional[int] = insp...
73
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available snake_case = {'''tokenization_herbert''': ['''HerbertTokenizer''']} try: if not is_tokenizers_available(): raise Op...
103
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { """facebook/xlm-roberta-xl""": """https://huggingface.co/facebook/x...
74
"""simple docstring""" from itertools import product def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> list[int]: _snake_case = sides_number _snake_case = max_face_number * dice_number _snake_case = [0] * (max_total + 1) _snake...
103
0
'''simple docstring''' def a__ ( lowerCAmelCase__ ) -> list: if n_term == "": return [] UpperCAmelCase__ : list = [] for temp in range(int(lowerCAmelCase__ ) ): series.append(F"""1/{temp + 1}""" if series else '''1''' ) return series...
75
"""simple docstring""" import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_con...
103
0
"""simple docstring""" a_ = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] a_ = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] a_ = { 0: 'Sunday', 1: 'Monday', 2: 'Tuesday', 3: 'Wednesday', 4: 'Thursday', 5: 'Friday', 6: 'Saturday', } ...
76
"""simple docstring""" from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class UpperCAmelCase ( yaml.SafeLoader ): def __UpperCAmelCase ( self : Tuple , __lowerCamelCase : List[str] ...
103
0
"""simple docstring""" from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance A = 6378137.0 A = 6356752.314245 A = 6_378_137 def _UpperCamelCase ( UpperCamelCase , UpperCamelCase , UpperCamelCase , ...
77
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.or...
103
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available SCREAMING_SNAKE_CASE_: Union[str, Any] ={'configuration_swin': ['SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SwinConfig', 'SwinOnnxConfig']} try: if no...
78
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is trul...
103
0
from __future__ import annotations def _lowerCamelCase ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase , __lowerCamelCase ) -> None: '''simple docstring''' if (direction == 1 and array[indexa] > array[indexa]) or ( direction ...
79
"""simple docstring""" from math import sqrt def snake_case ( lowerCAmelCase_ = 1000000 ) -> int: _snake_case = 0 _snake_case = 0 _snake_case = 42 while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_sides in range(2...
103
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __UpperCamelCase : Optional[Any] = { """configuration_convnext""": ["""CONVNEXT_PRETRAINED_CONFIG_ARCHIVE_MAP""",...
80
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...
103
0
import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_in...
81
"""simple docstring""" import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxX...
103
0
"""simple docstring""" def a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ ): if n == 0: return 1 elif n % 2 == 1: return (binary_exponentiation(lowerCAmelCase__ , n - 1 , lowerCAmelCase__ ) * a) % mod ...
82
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torcha...
103
0
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import ...
83
"""simple docstring""" import operator def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ = False , lowerCAmelCase_ = None ) -> list: _snake_case = operator.lt if reverse else operator.gt _snake_case = solution or [] if not arr: retu...
103
0
def UpperCAmelCase_ ( __SCREAMING_SNAKE_CASE ): if not isinstance(__SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ): raise TypeError('only integers accepted as input' ) else: lowercase = str(abs(__SCREAMING_SNAKE_CASE ) ) lowercase = [list(__SCREAMING_SNAK...
84
"""simple docstring""" import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.mode...
103
0
import unittest from transformers import MPNetConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from ...test_pipeline_mixin im...
85
"""simple docstring""" from copy import deepcopy class UpperCAmelCase : def __init__( self : Optional[Any] , __lowerCamelCase : list[int] | None = None , __lowerCamelCase : int | None = None ): """simple docstring""" ...
103
0
import copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence from datasets.featu...
86
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic...
103
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase : str = { """configuration_m2m_100""": ["""M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP""", """M2M100Config""", """M2M100OnnxConfig"""], ...
87
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenizatio...
103
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { """google/bigbi...
88
"""simple docstring""" from ...configuration_utils import PretrainedConfig class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): A__ : str = '''bert-generation''' def __init__( self : Tuple , __lowerCamelCase : Optional[int]=5_0_3_5_8 ...
103
0
from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelerate.test_utils import Regr...
89
"""simple docstring""" from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=__SCREAMING_SNAKE_CASE ): A__ : Optional[int] = ['''torch''', '''scipy'''] def __init__( self : Any , *__lowerCamelCase : List[...
103
0
'''simple docstring''' import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class a__ : '''simple docstring''' def __init__( self , lowerCamelCase_=...
90
"""simple docstring""" def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> int: return 1 if input_a == input_a else 0 def snake_case ( ) -> None: assert xnor_gate(0 , 0 ) == 1 assert xnor_gate(0 , 1 ) == 0 assert xnor_gate(1 , ...
103
0
"""simple docstring""" import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=_lowercase ) class lowerCAmelCase_ ( _lowercase ): '''simple docstring'...
91
"""simple docstring""" import os from pathlib import Path def snake_case ( ) -> Tuple: from torch.utils.cpp_extension import load _snake_case = Path(lowerCAmelCase_ ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' _snake_case = ...
103
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, ) UpperCamelCase_ = { """configuration_layoutlmv3""": [ ...
92
"""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 FlaxGenerationTesterMixi...
103
0
"""simple docstring""" from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES __A = logging.get_logger(__name__) __A = OrderedDi...
93
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): @staticmethod @abstractmethod def __UpperCAmelCase ( __lowerCamelCase : ArgumentParser ): "...
103
0
'''simple docstring''' import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import...
94
"""simple docstring""" import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logg...
103
0
"""simple docstring""" import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels lowerCamelCase_ = object() # For specifying empty leaf dict `{}` lowerCamelCase_ = object()...
95
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available snake_case = {'''tokenization_herbert''': ['''HerbertTokenizer''']} try: if not is_tokenizers_available(): raise Op...
103
0
"""simple docstring""" def a ( __UpperCAmelCase : str ) -> str: return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
96
"""simple docstring""" from itertools import product def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> list[int]: _snake_case = sides_number _snake_case = max_face_number * dice_number _snake_case = [0] * (max_total + 1) _snake...
103
0
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowercase__( UpperCAmelCase ): """simple docstring""" a :Optional[Any] = 'ClapFeatureExtractor' a :List[str] = ('RobertaTokenizer', 'RobertaToke...
97
"""simple docstring""" import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_con...
103
0
'''simple docstring''' import qiskit def a__ ( lowercase : int, lowercase : int ) -> qiskit.result.counts.Counts: """simple docstring""" _UpperCamelCase = qiskit.Aer.get_backend('''aer_simulator''' ) _UpperCamelCase = qiski...
98
"""simple docstring""" from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class UpperCAmelCase ( yaml.SafeLoader ): def __UpperCAmelCase ( self : Tuple , __lowerCamelCase : List[str] ...
103
0
from itertools import count def a (lowerCAmelCase__ = 50 ): __a = [1] * min_block_length for n in count(lowerCAmelCase__ ): fill_count_functions.append(1 ) for block_length in range(lowerCAmelCase__ , n + 1 ): for block_start in range(n - block_leng...
99
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.or...
103
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A : List[str] = {"""configuration_wavlm""": ["""WAVLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """WavLMConfig"""]} try: if not is_torch_available(): raise OptionalDependencyNotAvai...
100
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is trul...
103
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCAmelCase__ : Any ={ 'configuration_rag': ['RagConfig'], 'retrieval_rag': ['RagRetriever'], 'tokenization_rag': ['RagTokenizer'], } t...
101
"""simple docstring""" from math import sqrt def snake_case ( lowerCAmelCase_ = 1000000 ) -> int: _snake_case = 0 _snake_case = 0 _snake_case = 42 while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_sides in range(2...
103
0
"""simple docstring""" import unittest from transformers import MPNetConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random...
102
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...
103
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { """weiweishi/roc-bert-base-zh""": """https://huggingface.co/weiweishi/roc-bert-base-zh/resolve...
104
"""simple docstring""" import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxX...
103
0
from math import factorial, radians def __UpperCAmelCase ( lowerCamelCase_ : float , lowerCamelCase_ : int = 18 , lowerCamelCase_ : int = 10 ) -> float: """simple docstring""" SCREAMING_SNAKE_CASE_ : Dict = angle_in_degrees - (...
105
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torcha...
103
0
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, slow fr...
106
"""simple docstring""" import operator def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ = False , lowerCAmelCase_ = None ) -> list: _snake_case = operator.lt if reverse else operator.gt _snake_case = solution or [] if not arr: retu...
103
0
'''simple docstring''' import ast import os import re import shutil import tempfile import unittest from unittest import mock import torch from accelerate.test_utils.examples import compare_against_test from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command, slow from accelerat...
107
"""simple docstring""" import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.mode...
103
0
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @requ...
108
"""simple docstring""" from copy import deepcopy class UpperCAmelCase : def __init__( self : Optional[Any] , __lowerCamelCase : list[int] | None = None , __lowerCamelCase : int | None = None ): """simple docstring""" ...
103
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) a = { "configuration_trocr": ["TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP", "TrOCRConfig"], ...
109
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic...
103
0
"""simple docstring""" def lowerCamelCase ( ): UpperCAmelCase__ : Union[str, Any] = 0 for i in range(1 ,1001 ): total += i**i return str(_snake_case )[-10:] if __name__ == "__main__": print(solution())
110
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenizatio...
103
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) _lowercase = {'''configuration_vit''': ['''VIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTConfig''', '''...
157
"""simple docstring""" from ...configuration_utils import PretrainedConfig class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): A__ : str = '''bert-generation''' def __init__( self : Tuple , __lowerCamelCase : Optional[int]=5_0_3_5_8 ...
103
0
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCamelCase : Any = logging.get_logger(__name__) __UpperCamelCase : Dict = { '''facebook/wav2vec2-base-960h''': '''https...
4
"""simple docstring""" from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=__SCREAMING_SNAKE_CASE ): A__ : Optional[int] = ['''torch''', '''scipy'''] def __init__( self : Any , *__lowerCamelCase : List[...
103
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_availab...
47
"""simple docstring""" def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> int: return 1 if input_a == input_a else 0 def snake_case ( ) -> None: assert xnor_gate(0 , 0 ) == 1 assert xnor_gate(0 , 1 ) == 0 assert xnor_gate(1 , ...
103
0
import re import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class snake_case__ ( __SCREAMING_SNAKE_CASE ): _lowerCAmelCase =['''image_processor''', '''tokenizer'''] _lowerCAmelCase ='''AutoImageProcessor''' _lowerCAmelCase ='''...
170
"""simple docstring""" import os from pathlib import Path def snake_case ( ) -> Tuple: from torch.utils.cpp_extension import load _snake_case = Path(lowerCAmelCase_ ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' _snake_case = ...
103
0
'''simple docstring''' import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common...
215
"""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 FlaxGenerationTesterMixi...
103
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils import ...
355
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): @staticmethod @abstractmethod def __UpperCAmelCase ( __lowerCamelCase : ArgumentParser ): "...
103
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __SCREAMING_SNAKE_CASE = {'configuration_fnet': ['FNET_PRETRAINED_CONFIG_ARCHIVE_MAP'...
553
"""simple docstring""" import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logg...
103
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase : Any = logging.get_logger(__name__) __lowerCamelCase : int = { '''google/switch-base-8''': '''https://huggingface.co/google/switc...
653
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available snake_case = {'''tokenization_herbert''': ['''HerbertTokenizer''']} try: if not is_tokenizers_available(): raise Op...
103
0
'''simple docstring''' def _lowerCAmelCase (_lowercase = 2_00 ): """simple docstring""" a__ = [1, 2, 5, 10, 20, 50, 1_00, 2_00] a__ = [0] * (pence + 1) a__ = 1 # base case: 1 way to make 0 pence for coin in coins: ...
331
"""simple docstring""" from itertools import product def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> list[int]: _snake_case = sides_number _snake_case = max_face_number * dice_number _snake_case = [0] * (max_total + 1) _snake...
103
0
import operator def __lowerCAmelCase ( __magic_name__ , __magic_name__ = False , __magic_name__ = None ): _lowercase: List[str] = operator.lt if reverse else operator.gt _lowercase: str = solution or [] if not arr: return solution _lowercase: Union[s...
226
"""simple docstring""" import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_con...
103
0
class _snake_case : def __init__( self , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_): '''simple docstring''' lowercase__ : Any = None lowercase__ : int = None lowercase__ : Tuple = graph self._normali...
12
"""simple docstring""" from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class UpperCAmelCase ( yaml.SafeLoader ): def __UpperCAmelCase ( self : Tuple , __lowerCamelCase : List[str] ...
103
0
from typing import Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention from ...modeling_utils import PreT...
157
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.or...
103
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE (_UpperCAmelCase : List[Any] ): return " ".join( ''.join(word[::-1] ) if len(lowerCAmelCase_ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(reverse_lo...
4
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is trul...
103
0
import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNA...
47
"""simple docstring""" from math import sqrt def snake_case ( lowerCAmelCase_ = 1000000 ) -> int: _snake_case = 0 _snake_case = 0 _snake_case = 42 while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_sides in range(2...
103
0
def lowercase__( A , A ): def get_matched_characters(A , A ) -> str: snake_case__ : Optional[int] = [] snake_case__ : Optional[Any] = min(len(_stra ) , len(_stra ) ) // 2 for i, l in enumerate...
170
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...
103
0
'''simple docstring''' import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...
215
"""simple docstring""" import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxX...
103
0
"""simple docstring""" from collections.abc import Callable import numpy as np def A_ ( snake_case__ , snake_case__ , snake_case__ , snake_case__ , snake_case__ ) -> np.array: _UpperCamelCase :Optional[int] = int(np.ceil((x_end - xa)...
355
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torcha...
103
0
"""simple docstring""" import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class __UpperCamelCase : def __init__( self : str , UpperCAmelCase : Union[str, Any] , UpperCAmelCase : int , UpperCAmelCase : int ) -> Tuple...
553
"""simple docstring""" import operator def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ = False , lowerCAmelCase_ = None ) -> list: _snake_case = operator.lt if reverse else operator.gt _snake_case = solution or [] if not arr: retu...
103
0
'''simple docstring''' import numpy as np class A_ : """simple docstring""" def __init__( self :Any ) -> List[str]: '''simple docstring''' snake_case_ : List[str] = (0, 0) snake...
653
"""simple docstring""" import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.mode...
103
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig class lowerCamelCase__ ( __SCREAMING_SNAKE_CASE ): """simple docstring""" UpperCamelCase__ = '''bert-generation''' def __init__( self : Tuple ...
331
"""simple docstring""" from copy import deepcopy class UpperCAmelCase : def __init__( self : Optional[Any] , __lowerCamelCase : list[int] | None = None , __lowerCamelCase : int | None = None ): """simple docstring""" ...
103
0
_SCREAMING_SNAKE_CASE : str = { 'a': 'AAAAA', 'b': 'AAAAB', 'c': 'AAABA', 'd': 'AAABB', 'e': 'AABAA', 'f': 'AABAB', 'g': 'AABBA', 'h': 'AABBB', 'i': 'ABAAA', 'j': 'BBBAA', 'k': 'ABAAB', 'l': 'ABABA', 'm': 'ABABB', 'n': 'ABBAA', 'o': 'ABBA...
226
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic...
103
0
lowerCamelCase__ : Optional[int] = 6_5_5_2_1 def UpperCamelCase ( lowercase_ ) -> int: '''simple docstring''' lowercase__ : List[Any] = 1 lowercase__ : int = 0 for plain_chr in plain_text: lowercase__ : Union[str, Any] = (a + ord(l...
12
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenizatio...
103
0
import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, ...
157
"""simple docstring""" from ...configuration_utils import PretrainedConfig class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): A__ : str = '''bert-generation''' def __init__( self : Tuple , __lowerCamelCase : Optional[int]=5_0_3_5_8 ...
103
0
"""simple docstring""" from copy import deepcopy class a : def __init__( self , _snake_case = None , _snake_case = None ): """simple docstring""" if arr is None and size is not None: lowerCAmelCase = size lowerCAmelCase = [0] * ...
4
"""simple docstring""" from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=__SCREAMING_SNAKE_CASE ): A__ : Optional[int] = ['''torch''', '''scipy'''] def __init__( self : Any , *__lowerCamelCase : List[...
103
0
SCREAMING_SNAKE_CASE__ = [0, 2, 4, 6, 8] SCREAMING_SNAKE_CASE__ = [1, 3, 5, 7, 9] def UpperCAmelCase__ ( lowerCamelCase_ : List[Any] , lowerCamelCase_ : int , lowerCamelCase_ : List[Any] , lowerCamelCase_ : str ...
47
"""simple docstring""" def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> int: return 1 if input_a == input_a else 0 def snake_case ( ) -> None: assert xnor_gate(0 , 0 ) == 1 assert xnor_gate(0 , 1 ) == 0 assert xnor_gate(1 , ...
103
0
import math def lowercase__( A , A ): snake_case__ : str = len(lowerCAmelCase_ ) snake_case__ : Dict = int(math.floor(math.sqrt(lowerCAmelCase_ ) ) ) snake_case__ : Optional[int] = 0 while arr[min(lowerCAme...
170
"""simple docstring""" import os from pathlib import Path def snake_case ( ) -> Tuple: from torch.utils.cpp_extension import load _snake_case = Path(lowerCAmelCase_ ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' _snake_case = ...
103
0
'''simple docstring''' import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( ...
215
"""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 FlaxGenerationTesterMixi...
103
0
"""simple docstring""" from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class A( __SCREAMING_SNAKE_CASE ): """simple docstring""" def __init__( self , SCREAMING_S...
355
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): @staticmethod @abstractmethod def __UpperCAmelCase ( __lowerCamelCase : ArgumentParser ): "...
103
0
"""simple docstring""" def UpperCAmelCase ( a__ ): '''simple docstring''' lowerCAmelCase :List[str] = False while is_sorted is False: # Until all the indices are traversed keep looping lowerCAmelCase :List[str] = True for i...
553
"""simple docstring""" import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logg...
103
0
'''simple docstring''' import json import os import unittest from typing import Tuple from transformers import WavaVecaPhonemeCTCTokenizer from transformers.models.wavaveca.tokenization_wavaveca import VOCAB_FILES_NAMES from transformers.models.wavaveca_phoneme.tokenization_wavaveca_phone...
653
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available snake_case = {'''tokenization_herbert''': ['''HerbertTokenizer''']} try: if not is_tokenizers_available(): raise Op...
103
0
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin if is_torch_ava...
331
"""simple docstring""" from itertools import product def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> list[int]: _snake_case = sides_number _snake_case = max_face_number * dice_number _snake_case = [0] * (max_total + 1) _snake...
103
0
import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _SCREAMING_SNAKE_CASE : Any = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE ...
226
"""simple docstring""" import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_con...
103
0
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....
12
"""simple docstring""" from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class UpperCAmelCase ( yaml.SafeLoader ): def __UpperCAmelCase ( self : Tuple , __lowerCamelCase : List[str] ...
103
0
import re from ..utils import cached_file # docstyle-ignore _lowercase = ''' Human: <<task>> Assistant: ''' _lowercase = '''huggingface-tools/default-prompts''' _lowercase = {'''chat''': '''chat_prompt_template.txt''', '''run''': '''run_prompt_template.txt'''} def _A (Upper...
157
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.or...
103
0
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LDMTextToImagePipeline, UNetaDConditionModel from diffusers.utils.testing_utils import ( enable_full_dete...
4
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is trul...
103
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE__ = { '''configuration_time_series_transformer''': [ '''TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TimeSerie...
47
"""simple docstring""" from math import sqrt def snake_case ( lowerCAmelCase_ = 1000000 ) -> int: _snake_case = 0 _snake_case = 0 _snake_case = 42 while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_sides in range(2...
103
0
from collections.abc import Generator def lowercase__( ): snake_case__ , snake_case__ : List[str] = 0, 1 while True: snake_case__ , snake_case__ : int = b, a + b yield b def lowercase__( A = 1_0_0_0 ): snake_c...
170
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...
103
0
'''simple docstring''' 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 trans...
215
"""simple docstring""" import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxX...
103
0
"""simple docstring""" import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_availab...
355
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torcha...
103
0
"""simple docstring""" def UpperCAmelCase ( a__ ): '''simple docstring''' if number > 0: raise ValueError('input must be a negative integer' ) lowerCAmelCase :List[Any] = len(bin(lowerCAmelCase_ )[3:] ) lowerCAmelCase :Tuple = bin...
553
"""simple docstring""" import operator def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ = False , lowerCAmelCase_ = None ) -> list: _snake_case = operator.lt if reverse else operator.gt _snake_case = solution or [] if not arr: retu...
103
0
'''simple docstring''' import json import logging import os import socket import git import numpy as np import torch logging.basicConfig( format='''%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s''', datefmt='''%m/%d/%Y %H:%M:%S''', level=loggi...
653
"""simple docstring""" import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.mode...
103
0
'''simple docstring''' import unittest from transformers import AutoTokenizer, FalconConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTest...
331
"""simple docstring""" from copy import deepcopy class UpperCAmelCase : def __init__( self : Optional[Any] , __lowerCamelCase : list[int] | None = None , __lowerCamelCase : int | None = None ): """simple docstring""" ...
103
0
import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _SCREAMING_SNAKE_CASE : Optional[int] = get_tests_dir('fixtures/test_sente...
226
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic...
103
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available lowerCamelCase__ : Optional[int] = {"""configuration_speech_encoder_decoder""": ["""SpeechEncoderDecoderConfig"""]} try: if not is_torch_available(): ...
12
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenizatio...
103
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase = { '''configuration_informer''': [ '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''InformerConfig''', ], } try: ...
157
"""simple docstring""" from ...configuration_utils import PretrainedConfig class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): A__ : str = '''bert-generation''' def __init__( self : Tuple , __lowerCamelCase : Optional[int]=5_0_3_5_8 ...
103
0
"""simple docstring""" from pathlib import Path import json import tempfile from transformers import FSMTTokenizer, FSMTConfig, FSMTForConditionalGeneration from transformers.models.fsmt.tokenization_fsmt import VOCAB_FILES_NAMES __UpperCamelCase : List[Any] = '''tiny-wmt19-en-ru''' # Bui...
4
"""simple docstring""" from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=__SCREAMING_SNAKE_CASE ): A__ : Optional[int] = ['''torch''', '''scipy'''] def __init__( self : Any , *__lowerCamelCase : List[...
103
0
from __future__ import annotations import math import random from typing import Any class _UpperCamelCase: def __init__( self : Any ): '''simple docstring''' __a : List[Any] = [] __a : Dict = 0 __a...
47
"""simple docstring""" def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> int: return 1 if input_a == input_a else 0 def snake_case ( ) -> None: assert xnor_gate(0 , 0 ) == 1 assert xnor_gate(0 , 1 ) == 0 assert xnor_gate(1 , ...
103
0
import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, slow, ) from tr...
170
"""simple docstring""" import os from pathlib import Path def snake_case ( ) -> Tuple: from torch.utils.cpp_extension import load _snake_case = Path(lowerCAmelCase_ ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' _snake_case = ...
103
0
'''simple docstring''' import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def __lowerCamelCase ( __snake_case : Optional[An...
215
"""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 FlaxGenerationTesterMixi...
103
0
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_OBJECT_DETECTION_MAPPING, AutoFeatureExtractor, AutoModelForObjectDetection, ObjectDetectionPipeline, is_vision_available, pipeline, ) from transformers.testing_utils import ( is_pipeline_test, nested_s...
355
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): @staticmethod @abstractmethod def __UpperCAmelCase ( __lowerCamelCase : ArgumentParser ): "...
103
0