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
"""simple docstring""" from __future__ import annotations def lowercase ( a__ : str , a__ : Dict ) -> list[list[int]]: _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowercase_ ) create_s...
420
import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType cl...
606
0
import warnings from functools import wraps from typing import Callable def a (lowerCAmelCase__ ): @wraps(lowercase_ ) def _inner_fn(*lowerCAmelCase__ , **lowerCAmelCase__ ): warnings.warn( (f'''\'{fn.__name__}\' is experimental and might be subject to breakin...
99
def __magic_name__ ( lowercase_ ) -> tuple[int, int]: '''simple docstring''' try: UpperCamelCase = float(lowercase_ ) except ValueError: raise ValueError("Please enter a valid number" ) UpperCamelCase = decimal ...
606
0
'''simple docstring''' 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 UpperCAmelCase_ ( ...
5
from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decord import ...
606
0
'''simple docstring''' import datasets _a : Tuple = """\ @InProceedings{conneau2018xnli, author = \"Conneau, Alexis and Rinott, Ruty and Lample, Guillaume and Williams, Adina and Bowman, Samuel R. and Schwen...
56
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta import Robe...
606
0
def UpperCamelCase__ ( SCREAMING_SNAKE_CASE__ ): __lowerCamelCase : int = int(lowercase_ ) if n_element < 1: __lowerCamelCase : Dict = ValueError('a should be a positive number' ) raise my_error __lowerCamelCase : Union[str, Any] = [1] __lowerCamelCa...
669
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __a : Optional[Any] = { """configuration_distilbert""": [ "...
606
0
"""simple docstring""" import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __a (snake_case__ , unittest.TestCase): '''simple docstring''' _SCREAMI...
680
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch i...
606
0
'''simple docstring''' from collections.abc import Callable class UpperCamelCase_ : """simple docstring""" def __init__( self : Optional[int] , _lowerCamelCase : Optional[Any] = None ) -> None: __magic_name__ = [] # Sto...
664
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __a : List[str] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass ...
606
0
def _a ( lowerCamelCase ): return [ { 0: [1, 2], 1: [0, 2], 2: [0, 1, 3, 5], 3: [2, 4], 4: [3], 5: [2, 6, 8], 6: [5, 7], 7: [6, 8], 8: [5, 7], }, { 0: [6], 1: [9], 2: [4, 5], ...
681
# 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 model through reduction of a normal pre-trained model, but keeping the # full vocab, merge...
606
0
def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : Dict = 1_000) -> int: '''simple docstring''' __UpperCamelCase : Tuple = -1 __UpperCamelCase : List[str] = 0 for a in range(1 , n // 3): # Solv...
557
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): fro...
606
0
"""simple docstring""" from functools import lru_cache def _a ( UpperCAmelCase__ ) -> set: __SCREAMING_SNAKE_CASE = 2 __SCREAMING_SNAKE_CASE = set() while i * i <= n: if n % i: i += 1 else: ...
482
import copy import tempfile import unittest from transformers import MaMaaaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from transformers.utils import cached_property from ...generation.test_utils imp...
606
0
'''simple docstring''' import sys from collections import defaultdict class __snake_case : '''simple docstring''' def __init__( self ): snake_case__ : Optional[Any] = [] def __UpperCamelCase ( self , __SCREAMING_SNAKE_CASE ): ret...
38
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_uti...
606
0
"""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 UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { """...
420
import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
606
0
def a (lowerCAmelCase__ ): try: __a = float(lowercase_ ) except ValueError: raise ValueError("""Please enter a valid number""" ) __a = decimal - int(lowercase_ ) if fractional_part == 0: return int(lowercase_ ), 1 else: __a = len(str(...
99
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING __a : Tuple = logging.get_logger(__name__) ...
606
0
'''simple docstring''' from __future__ import annotations def A (__lowerCamelCase :Optional[Any] ): _lowerCAmelCase = 2 _lowerCAmelCase = [] while i * i <= n: if n % i: i += 1 else: n //= i facto...
5
def __magic_name__ ( lowercase_ ) -> List[str]: '''simple docstring''' UpperCamelCase = [] UpperCamelCase = set({"(", "[", "{"} ) UpperCamelCase = set({")", "]", "}"} ) UpperCamelCase = {"{": "}", "[": "]", "(": ")...
606
0
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging _a : Tuple = logging.get_logger(__name__) _a : Dict = { """huggingface/time-series-transformer-tourism-monthly""": ( "...
56
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer __a : Tuple = logging.getLogger(__name__) def __magic_name__ ( ) -> Optional[Any]: '''simple docstring''' UpperCamelCase ...
606
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING lowercase_ = logging.get_logger(__name__) lowercase_ ...
669
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
606
0
"""simple docstring""" def _lowercase ( __lowerCAmelCase ) -> int: SCREAMING_SNAKE_CASE__ : Optional[Any] = [0] * len(lowercase_ ) SCREAMING_SNAKE_CASE__ : str = [] SCREAMING_SNAKE_CASE__ : Union[str, Any] = [1] * len(lowercase_ ) ...
680
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. __a : Optional[int] = 1_0 def __magic_name__ ( lowercase_ , lowercase_ , lowercase_ , low...
606
0
'''simple docstring''' import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging __magic_name__ : List[Any] =logging.get_logger(__name__) def __snake_case ( lowerCamelCase_ : str ): '...
664
from argparse import ArgumentParser from .env import EnvironmentCommand def __magic_name__ ( ) -> List[str]: '''simple docstring''' UpperCamelCase = ArgumentParser("Diffusers CLI tool" , usage="diffusers-cli <command> [<args>]" ) UpperCamelCase ...
606
0
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from transformers.mod...
681
from collections.abc import Iterable from typing import Generic, TypeVar __a : Optional[Any] = TypeVar("""_T""") class __UpperCAmelCase ( Generic[_T] ): """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE = None ) ...
606
0
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...tes...
557
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __UpperCAmelCase ( snake_case__ , unittest.TestCase ): """simple ...
606
0
"""simple docstring""" def _a ( UpperCAmelCase__ , UpperCAmelCase__ ) -> Any: __SCREAMING_SNAKE_CASE = (boundary[1] - boundary[0]) / steps __SCREAMING_SNAKE_CASE = boundary[0] __SCREAMING_SNAKE_CASE = boundary[1] __SCREAMING_SNAKE_CASE...
482
__a : Union[str, Any] = 6_5_5_2_1 def __magic_name__ ( lowercase_ ) -> int: '''simple docstring''' UpperCamelCase = 1 UpperCamelCase = 0 for plain_chr in plain_text: UpperCamelCase = (a + ord(lowercase_ )) ...
606
0
'''simple docstring''' import copy import tempfile import unittest from transformers import MaMaaaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from transformers.utils import cached_property from ...generation...
38
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingf...
606
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert } class UpperCAmelCase_ ( snake_case__): ...
420
import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType cl...
606
0
import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline SCREAMING_SNAKE_CASE = argparse.ArgumentParser('Stable Diffusion script with intel optimization', add_help=False) parser.add_argument('--d...
99
def __magic_name__ ( lowercase_ ) -> tuple[int, int]: '''simple docstring''' try: UpperCamelCase = float(lowercase_ ) except ValueError: raise ValueError("Please enter a valid number" ) UpperCamelCase = decimal ...
606
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler,...
5
from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decord import ...
606
0
'''simple docstring''' def _a () -> Optional[int]: """simple docstring""" __snake_case = 0 for i in range(1 , 1_0_0_1 ): total += i**i return str(lowercase_ )[-1_0:] if __name__ == "__main__": print(solution())
56
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta import Robe...
606
0
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. lowercase_ = 1_0 def UpperCamelCase__ ( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CA...
669
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __a : Optional[Any] = { """configuration_distilbert""": [ "...
606
0
"""simple docstring""" import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import numpy as np import pandas as pd from datasets import load_dataset import transformers from transformers import ( AutoConfig, BartForSequenceC...
680
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch i...
606
0
'''simple docstring''' __magic_name__ : Union[str, Any] =6_55_21 def __snake_case ( lowerCamelCase_ : Optional[int] ): '''simple docstring''' __magic_name__ = 1 __magic_name__ = 0 for plain_chr in plain_text: __magic_name__ = (a + ord...
664
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __a : List[str] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass ...
606
0
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( """files""", [ ["""full:README.md""", """dataset_infos.json"""], ["""empty:README.md""", """dataset_infos.json"""]...
681
# 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 model through reduction of a normal pre-trained model, but keeping the # full vocab, merge...
606
0
def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : str = 1_000) -> int: '''simple docstring''' return sum(2 * a * ((a - 1) // 2) for a in range(3 , n + 1)) if __name__ == "__main__": print(solution())
557
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): fro...
606
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase__ =logging.get_logger(__name__) lowerCAmelCase__ ={ """kssteven/ibert-ro...
482
import copy import tempfile import unittest from transformers import MaMaaaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from transformers.utils import cached_property from ...generation.test_utils imp...
606
0
'''simple docstring''' import datasets from .evaluate import evaluate A_ : Dict = """\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, journal={arXiv pre...
38
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_uti...
606
0
"""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 model through reduction of a normal pre-trained model, but keeping the # full voca...
420
import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
606
0
from manim import * class __UpperCAmelCase ( snake_case__ ): """simple docstring""" def snake_case_ ( self ): __a = Rectangle(height=0.5 , width=0.5 ) __a = Rectangle(height=0.46 , width=0.46 ).set_stroke(width=0 ...
99
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING __a : Tuple = logging.get_logger(__name__) ...
606
0
'''simple docstring''' import argparse import torch from transformers import OpenAIGPTConfig, OpenAIGPTModel, load_tf_weights_in_openai_gpt from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def A (__lowerCamelCase :Tuple , __lowerCamelCase :List[Any] ,...
5
def __magic_name__ ( lowercase_ ) -> List[str]: '''simple docstring''' UpperCamelCase = [] UpperCamelCase = set({"(", "[", "{"} ) UpperCamelCase = set({")", "]", "}"} ) UpperCamelCase = {"{": "}", "[": "]", "(": ")...
606
0
'''simple docstring''' from __future__ import annotations class _lowercase : def __init__( self : int , SCREAMING_SNAKE_CASE_ : Dict = 0 ) -> Optional[int]: __snake_case = key def a ( self : Union[str, Any] ,...
56
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer __a : Tuple = logging.getLogger(__name__) def __magic_name__ ( ) -> Optional[Any]: '''simple docstring''' UpperCamelCase ...
606
0
from abc import ABC, abstractmethod from typing import List, Optional class A_ ( snake_case__ ): '''simple docstring''' def __init__( self: List[Any] ): self.test() def _snake_case ( self: Optional[int] ): __lowerCamelCase ...
669
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
606
0
"""simple docstring""" from __future__ import annotations import csv import requests from bsa import BeautifulSoup def _lowercase ( __lowerCAmelCase = "" ) -> dict[str, float]: SCREAMING_SNAKE_CASE__ : Union[str, Any] = url or """https://www.imdb.com/chart/top/?ref_=...
680
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. __a : Optional[int] = 1_0 def __magic_name__ ( lowercase_ , lowercase_ , lowercase_ , low...
606
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __magic_name__ : str =logging.get_logger(__name__) __magic_name__ : List[str] ={ """studio-ousia/luke-base""": """https://huggingface.co/studio-ousia/luke-base/resolve/main/config.json""", """st...
664
from argparse import ArgumentParser from .env import EnvironmentCommand def __magic_name__ ( ) -> List[str]: '''simple docstring''' UpperCamelCase = ArgumentParser("Diffusers CLI tool" , usage="diffusers-cli <command> [<args>]" ) UpperCamelCase ...
606
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase =logging.get_logger(__name__) _lowerCamelCase ={ """asapp/sew-d-tiny-100k""": """https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json""", # See all SEW-...
681
from collections.abc import Iterable from typing import Generic, TypeVar __a : Optional[Any] = TypeVar("""_T""") class __UpperCAmelCase ( Generic[_T] ): """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE = None ) ...
606
0
print((lambda quine: quine % quine)('print((lambda quine: quine %% quine)(%r))'))
557
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __UpperCAmelCase ( snake_case__ , unittest.TestCase ): """simple ...
606
0
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary # Register SEW's fairseq modules from sew_asapp import tasks # noqa: F401 from transformers import ( SEWConfig, SEWForCTC, SEWModel, WavaVecaCTCTokenizer, WavaV...
482
__a : Union[str, Any] = 6_5_5_2_1 def __magic_name__ ( lowercase_ ) -> int: '''simple docstring''' UpperCamelCase = 1 UpperCamelCase = 0 for plain_chr in plain_text: UpperCamelCase = (a + ord(lowercase_ )) ...
606
0
'''simple docstring''' import unittest from transformers import SPIECE_UNDERLINE, ReformerTokenizer, ReformerTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokeni...
38
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingf...
606
0
"""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...
420
import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType cl...
606
0
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart import BartTokenizer...
99
def __magic_name__ ( lowercase_ ) -> tuple[int, int]: '''simple docstring''' try: UpperCamelCase = float(lowercase_ ) except ValueError: raise ValueError("Please enter a valid number" ) UpperCamelCase = decimal ...
606
0
'''simple docstring''' import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert_fast import BertTokenizerFast from .tokenization_dpr import DPRCon...
5
from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decord import ...
606
0
'''simple docstring''' from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): impor...
56
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta import Robe...
606
0
import numpy as np def UpperCamelCase__ ( SCREAMING_SNAKE_CASE__ ): return 1 / (1 + np.exp(-vector )) def UpperCamelCase__ ( SCREAMING_SNAKE_CASE__ ): return vector * sigmoid(lowercase_ ) if __name__ == "__main__": import doctest doctest.testmod()
669
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __a : Optional[Any] = { """configuration_distilbert""": [ "...
606
0
"""simple docstring""" import inspect import warnings from typing import Any, Dict, Optional, Union from packaging import version def _lowercase ( *__lowerCAmelCase , __lowerCAmelCase = None , __lowerCAmelCase=True , __lowerCAmelCase=2 ) -> Optional[int]: from ...
680
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch i...
606
0
'''simple docstring''' def __snake_case ( lowerCamelCase_ : Optional[int] = 1000 ): '''simple docstring''' __magic_name__ = 3 __magic_name__ = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 15 == 0: r...
664
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __a : List[str] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass ...
606
0
import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class A__ ...
681
# 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 model through reduction of a normal pre-trained model, but keeping the # full vocab, merge...
606
0
from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decord import VideoReade...
557
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): fro...
606
0
"""simple docstring""" def _a ( UpperCAmelCase__ , UpperCAmelCase__ ) -> Tuple: return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def _a ( UpperCAmelCase__ , UpperCAmelCase__=0 ) -> Optional[Any]: return sorted(lowercase_ , key=la...
482
import copy import tempfile import unittest from transformers import MaMaaaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from transformers.utils import cached_property from ...generation.test_utils imp...
606
0
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_funnel import FunnelTokenizer A_ : Optional[int] = logging.get_logger(__n...
38
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_uti...
606
0
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_tor...
420
import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
606
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available SCREAMING_SNAKE_CASE = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pas...
99
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING __a : Tuple = logging.get_logger(__name__) ...
606
0
'''simple docstring''' import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, ...
5
def __magic_name__ ( lowercase_ ) -> List[str]: '''simple docstring''' UpperCamelCase = [] UpperCamelCase = set({"(", "[", "{"} ) UpperCamelCase = set({")", "]", "}"} ) UpperCamelCase = {"{": "}", "[": "]", "(": ")...
606
0
'''simple docstring''' from collections import defaultdict from math import gcd def _a (lowercase__ : int = 1_5_0_0_0_0_0 ) -> int: """simple docstring""" __snake_case = defaultdict(lowercase_ ) __snake_case = 2 while 2 * euclid_m ...
56
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer __a : Tuple = logging.getLogger(__name__) def __magic_name__ ( ) -> Optional[Any]: '''simple docstring''' UpperCamelCase ...
606
0
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=snake_case__ ) class A_ ( snake_case__ ): '''simple docstring''' __snake_case = fiel...
669
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
606
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( Diffusion...
680
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. __a : Optional[int] = 1_0 def __magic_name__ ( lowercase_ , lowercase_ , lowercase_ , low...
606
0
'''simple docstring''' import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common impor...
664
from argparse import ArgumentParser from .env import EnvironmentCommand def __magic_name__ ( ) -> List[str]: '''simple docstring''' UpperCamelCase = ArgumentParser("Diffusers CLI tool" , usage="diffusers-cli <command> [<args>]" ) UpperCamelCase ...
606
0
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import BatchEncoding, PreTrainedTokenizer from ...utils import logging _lowerCamelCase =logging.get_logger(__name__) _lowerCamel...
681
from collections.abc import Iterable from typing import Generic, TypeVar __a : Optional[Any] = TypeVar("""_T""") class __UpperCAmelCase ( Generic[_T] ): """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE = None ) ...
606
0
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ...
557
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __UpperCAmelCase ( snake_case__ , unittest.TestCase ): """simple ...
606
0
"""simple docstring""" 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...
482
__a : Union[str, Any] = 6_5_5_2_1 def __magic_name__ ( lowercase_ ) -> int: '''simple docstring''' UpperCamelCase = 1 UpperCamelCase = 0 for plain_chr in plain_text: UpperCamelCase = (a + ord(lowercase_ )) ...
606
0
'''simple docstring''' import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments A_ : Union[str, Any] = logging.getLogger(__name__) @dataclass class __snake_case ( snake_c...
38
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingf...
606
0
"""simple docstring""" from math import isqrt def lowercase ( a__ : Optional[int] ) -> bool: return all(number % divisor != 0 for divisor in range(2 , isqrt(lowercase_ ) + 1 ) ) def lowercase ( a__ : int = 10**6 ) -> int: _UpperCamelCase = 0 ...
420
import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType cl...
606
0
def a (lowerCAmelCase__ ): return 10 - x * x def a (lowerCAmelCase__ , lowerCAmelCase__ ): if equation(lowercase_ ) * equation(lowercase_ ) >= 0: raise ValueError("""Wrong space!""" ) __a = a while (b - a) >= 0.0_1: # Find middle point _...
99
def __magic_name__ ( lowercase_ ) -> tuple[int, int]: '''simple docstring''' try: UpperCamelCase = float(lowercase_ ) except ValueError: raise ValueError("Please enter a valid number" ) UpperCamelCase = decimal ...
606
0
'''simple docstring''' import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transf...
5
from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as np from decord import ...
606
0
'''simple docstring''' import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCal...
56
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta import Robe...
606
0
from __future__ import annotations from functools import lru_cache from math import ceil lowercase_ = 1_0_0 lowercase_ = set(range(3, NUM_PRIMES, 2)) primes.add(2) lowercase_ = 42 for prime in range(3, ceil(NUM_PRIMES**0.5), 2): if prime not in primes: ...
669
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __a : Optional[Any] = { """configuration_distilbert""": [ "...
606
0
"""simple docstring""" import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, load_tf_w...
680
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch i...
606
0
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __magic_name__ : List[Any] =logging.get_logger(__name__) __magic_name__ : Optional[A...
664
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available __a : List[str] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass ...
606
0
import math import os import re import sys import unittest from pathlib import Path from typing import Tuple from unittest.mock import patch from parameterized import parameterized from transformers.testing_utils import ( CaptureStderr, ExtendSysPath, TestCasePlus, execute_subprocess_async, get_g...
681
# 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 model through reduction of a normal pre-trained model, but keeping the # full vocab, merge...
606
0
def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : int , _lowerCamelCase : str) -> str: '''simple docstring''' if a < 0 or b < 0: raise ValueError("the value of both inputs must be positive") __UpperCamelCase : str ...
557
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): fro...
606
0
"""simple docstring""" from __future__ import annotations from cmath import sqrt def _a ( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ) -> tuple[complex, complex]: if a == 0: raise ValueError('''Coefficient \'a\' must not be zero.''' ) _...
482
import copy import tempfile import unittest from transformers import MaMaaaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from transformers.utils import cached_property from ...generation.test_utils imp...
606
0
'''simple docstring''' import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import Generat...
38
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_uti...
606
0
"""simple docstring""" from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTes...
420
import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
606
0
from math import factorial, pi def a (lowerCAmelCase__ , lowerCAmelCase__ = 30 ): if not isinstance(lowercase_ , (int, float) ): raise ValueError("""maclaurin_sin() requires either an int or float for theta""" ) if not isinstance(lowercase_ , lowercase_ ) or ac...
99
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING __a : Tuple = logging.get_logger(__name__) ...
606
0
'''simple docstring''' import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger _lowercase = get_logger(__name__) _lowercase = R""" Args: input_ids (`jnp.ndarray` of shape `(b...
5
def __magic_name__ ( lowercase_ ) -> List[str]: '''simple docstring''' UpperCamelCase = [] UpperCamelCase = set({"(", "[", "{"} ) UpperCamelCase = set({")", "]", "}"} ) UpperCamelCase = {"{": "}", "[": "]", "(": ")...
606
0
"""simple docstring""" def __snake_case ( __A ) -> float: if edge <= 0 or not isinstance(__A ,__A ): raise ValueError("""Length must be a positive.""" ) return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2)) * (edge**2) def __snake_case ( __A ...
607
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase: str ={ "configuration_convbert": ["CONVBERT_PRETRAINE...
607
1
"""simple docstring""" class lowerCamelCase__ : def __init__( self , snake_case ) -> str: """simple docstring""" lowercase : Optional[Any] = n lowercase : Tuple = [None] * self.n lowercase : List[A...
607
"""simple docstring""" import re def __snake_case ( __A ) -> str: if len(re.findall("""[ATCG]""" ,__A ) ) != len(__A ): raise ValueError("""Invalid Strand""" ) return dna.translate(dna.maketrans("""ATCG""" ,"""TAGC""" ) ) if _...
607
1
"""simple docstring""" from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("""repo_id""" ,["""canonical_dataset_name""", """org-name/dataset-name"""] ) @pytest.mark.parametrize("""path""" ,["""filename.csv""", """filename w...
607
"""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 __snake_case ( ) -> None: print("""Making key files...""" ) make_key_files("""rsa""" ...
607
1
"""simple docstring""" import numpy as np def __snake_case ( __A ) -> np.array: return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
607
"""simple docstring""" from ... import PretrainedConfig lowerCAmelCase: str ={ "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json", } class lowerCamelCase__ ( __UpperCamelCase ): __UpperCAmelCase = NEZHA_PRETRAIN...
607
1
"""simple docstring""" import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def __snake_case ( __A ) -> Any: def wrapper(*__A ,**__A ): lowercase : Tuple ...
607
"""simple docstring""" import tensorflow as tf from ...tf_utils import shape_list class lowerCamelCase__ ( tf.keras.layers.Layer ): def __init__( self , snake_case , snake_case , snake_case , snake_case , snake_case=1 , snake_case=False , **snake_case ) -> ...
607
1
"""simple docstring""" import math from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import SchedulerMixin, SchedulerOutput class lowerCamelCase__ ( __UpperCamelCase , __...
607
"""simple docstring""" from typing import Union import fire import torch from tqdm import tqdm def __snake_case ( __A ,__A = "cpu" ,__A = None ) -> None: lowercase : Optional[int] = torch.load(__A ,map_location=__A ) for k, v in tqdm(state_...
607
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowerCamelCase__ ( metaclass=__UpperCamelCase ): __UpperCAmelCase = ["""onnx"""] def __init__( self , *snake_case , **snake_case ) -> Union[str, Any]: ...
607
"""simple docstring""" import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __snake_case ( __A ) -> Any: lowercase : List[str] = os.path.join(args.tf_model_dir ,"""para...
607
1
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCamelCase__ ( __UpperCamelCase ): @staticmethod @abstractmethod def _UpperCAmelCase ( snake_case ) -> List[Any]: """simple docstr...
607
"""simple docstring""" import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_...
607
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaControlnetImgaImgPipeline, KandinskyVaaPriorEmbaEmbPipeline, UNetaDConditionModel, VQModel, ) from dif...
607
"""simple docstring""" import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def __snake_case ( __A ) -> Any: def wrapper(*__A ,**__A ): lowercase : Tuple ...
607
1
"""simple docstring""" import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on impor...
607
"""simple docstring""" import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, ge...
607
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase: List[Any] ={ "configuration_git": ["GIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "GitConfig", "GitVisionConfig"], "processing_git"...
607
"""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(): ...
607
1
"""simple docstring""" import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set...
607
"""simple docstring""" import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() lowerCAmelCase: Tuple =logging.get_logger(__name__) lowerCAmelCase: int ...
607
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from .....
607
"""simple docstring""" import importlib.metadata from typing import Union from packaging.version import Version, parse from .constants import STR_OPERATION_TO_FUNC lowerCAmelCase: List[str] =parse(importlib.metadata.version("torch")) def __snake_case ( __A ,__A ...
607
1
"""simple docstring""" def __snake_case ( __A ,__A ,__A ,__A ,__A ,) -> float: lowercase : str = [redshift, radiation_density, matter_density, dark_energy] if any(p < 0 for p in parameters ): raise ValueError("""All input parameters must be positi...
607
"""simple docstring""" def __snake_case ( ) -> Union[str, Any]: lowercase : str = 0 for i in range(1 ,1001 ): total += i**i return str(__A )[-10:] if __name__ == "__main__": print(solution())
607
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: List[Any] =datasets.logging.get_logger(__name__) lowerCAmelCase: Any ...
607
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from tra...
607
1
"""simple docstring""" from itertools import count def __snake_case ( __A = 50 ) -> int: lowercase : int = [1] * min_block_length for n in count(__A ): fill_count_functions.append(1 ) for block_length in range(__A ,n + 1 ):...
607
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config i...
607
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffuser...
607
"""simple docstring""" from random import shuffle import tensorflow as tf from numpy import array def __snake_case ( __A ,__A ) -> Any: lowercase : Any = int(__A ) assert noofclusters < len(__A ) # Find out the dimensionality lower...
607
1
"""simple docstring""" import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils impo...
607
"""simple docstring""" import qiskit def __snake_case ( __A ,__A ) -> qiskit.result.counts.Counts: lowercase : List[Any] = qiskit.Aer.get_backend("""aer_simulator""" ) lowercase : int = qiskit.QuantumCircuit(4 ,2 ) # encod...
607
1
"""simple docstring""" def __snake_case ( ) -> list[list[int]]: return [list(range(1000 - i ,-1000 - i ,-1 ) ) for i in range(1000 )] lowerCAmelCase: Optional[Any] =generate_large_matrix() lowerCAmelCase: Any =( [[4, 3, 2, -1], [3, 2, 1, ...
607
"""simple docstring""" import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transforme...
607
1
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_fe...
607
"""simple docstring""" import argparse import json from typing import List from ltp import LTP from transformers.models.bert.tokenization_bert import BertTokenizer def __snake_case ( __A ) -> Union[str, Any]: # This defines a "chinese character" as anything in the C...
607
1