code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor snake_case__ : List[Any] = logging.get_logger(__name__) class snake_case_( a__ ): def __init__( self : Dict , *UpperCamelCase_ : List[st...
60
'''simple docstring''' def A__ ( UpperCAmelCase_ = 1_0_0_0 ): _UpperCamelCase : Dict = 3 _UpperCamelCase : Any = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 1_5 == 0: result -= a ...
83
0
"""simple docstring""" import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from transfo...
61
'''simple docstring''' from .data_collator import ( DataCollatorForLanguageModeling, DataCollatorForPermutationLanguageModeling, DataCollatorForSeqaSeq, DataCollatorForSOP, DataCollatorForTokenClassification, DataCollatorForWholeWordMask, DataCollatorWithPadding, DefaultDataCollator,...
83
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { 'hustvl/yolos-small': 'https://huggi...
62
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, Au...
83
0
'''simple docstring''' from ....utils import logging lowerCAmelCase_ : Union[str, Any] = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE (lowerCamelCase_ ): """simple docstring""" def __init__( self : Tuple , __a : int , ...
63
'''simple docstring''' from dataclasses import dataclass, field from typing import Optional from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser @dataclass class lowercase__ : lowercase__ = field( metadata={"""help""": """...
83
0
"""simple docstring""" import argparse import hashlib # hashlib is only used inside the Test class import struct class lowercase: '''simple docstring''' def __init__( self: List[Any], a_: List[str] ): '''simple docstring''' ...
64
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy snake_case_ : Dict = logging.get_logger(__...
83
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCamelCase__ = { 'configuration_biogpt': ['BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BioGptConfig'], 'tokenization_biogpt': ['BioGptTokenizer']...
65
'''simple docstring''' from __future__ import annotations from collections.abc import MutableSequence class lowercase__ : def __init__( self : List[Any] ,lowerCamelCase__ : int ,lowerCamelCase__ : MutableSequence[float] ): '''simple docstring''' if len(l...
83
0
"""simple docstring""" import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def A_ ( _lowercase, _lowercase, _lowercase ): '''simple docstring''' snake_case_ :str...
66
'''simple docstring''' import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class lowercase__ ( lowercase ): @require_torch def UpperCamelCase_ ( self : Dict ): ...
83
0
'''simple docstring''' import argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def __lowerCAmelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ ) ->...
67
'''simple docstring''' import unittest import numpy as np from transformers import DistilBertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import j...
83
0
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class a__ ( snake_case ): """simple docstring""" def __init__( self , *lowercase , **lowercase ) -> None: ...
68
'''simple docstring''' import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer snake_case_ : ...
83
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = { '''bigcode/gpt_bigcode-santacoder''': '''https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.jso...
69
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_common import S...
83
0
'''simple docstring''' from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class UpperCAmelCase : _lowercas...
70
'''simple docstring''' def A__ ( UpperCAmelCase_ = 1 , UpperCAmelCase_ = 1_0_0_0 ): _UpperCamelCase : int = 1 _UpperCamelCase : Union[str, Any] = 0 for divide_by_number in range(UpperCAmelCase_ , digit + 1 ): _UpperCamelCase : list[int...
83
0
def A ( a_ = 1_000 ) -> int: return sum(e for e in range(3 ,a_ ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(f"{solution() = }")
71
'''simple docstring''' def A__ ( UpperCAmelCase_ ): if num < 0: return False _UpperCamelCase : int = num _UpperCamelCase : int = 0 while num > 0: _UpperCamelCase : str = rev_num * 1_0 + (num % 1_0) num //= 1_0...
83
0
"""simple docstring""" import unittest from diffusers import FlaxAutoencoderKL from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): import jax @require_flax class ...
72
'''simple docstring''' def A__ ( UpperCAmelCase_ ): _UpperCamelCase : List[str] = abs(UpperCAmelCase_ ) _UpperCamelCase : int = 0 while n > 0: res += n % 1_0 n //= 1_0 return res def A__ ( UpperCAmelCase_ ): ...
83
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_xl...
73
'''simple docstring''' from math import pi def A__ ( UpperCAmelCase_ , UpperCAmelCase_ ): return 2 * pi * radius * (angle / 3_6_0) if __name__ == "__main__": print(arc_length(90, 10))
83
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase = logging.get_logger(__name__) _lowercase = { '''facebook/dpr-ctx_encoder-single-nq-base''': ( '''https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base/re...
74
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : int = logging.get_logger(__name__) snake_case_ : Optional[Any] = { 'RUCAIBox/mvp': 'https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json', } c...
83
0
'''simple docstring''' from queue import PriorityQueue from typing import Any import numpy as np def a_ ( __snake_case : dict , __snake_case : str , __snake_case : set , __snake_case : set , __snake_case : dict , ...
75
'''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.org/licenses/LICENSE-2.0 ...
83
0
import random from typing import Any def lowerCamelCase__ ( _a): for _ in range(len(_a)): SCREAMING_SNAKE_CASE : Tuple = random.randint(0 , len(_a) - 1) SCREAMING_SNAKE_CASE : Union[str, Any] = random.randint(0 , len(_a) - 1) SCREAMING_SNAKE_CASE ,SC...
76
'''simple docstring''' import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logg...
83
0
"""simple docstring""" import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def a_ ( ): '''simple docstring''' raise RuntimeError('CUDA out of memory.' ...
77
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .to...
83
0
"""simple docstring""" def _lowerCAmelCase ( lowercase_=28123 ): UpperCAmelCase = [1] * (limit + 1) for i in range(2 , int(limit**0.5 ) + 1 ): sum_divs[i * i] += i for k in range(i + 1 , limit // i + 1 ): ...
78
'''simple docstring''' import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class lowercase__ ( lowercase ): def __init__( self : Any ,lowerCamelCase__ : str ,lowerCamelCase__ : Tuple ,lowerCame...
83
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = { '...
79
'''simple docstring''' import os from datetime import datetime as dt from github import Github snake_case_ : Any = [ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def A__ ( ): ...
83
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor a__ : Optional[int] = logging.get_logger(__name__) class lowercase_ ( a__ ): def __init__( self , *a , **a ): warnings.war...
80
'''simple docstring''' import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(lowercase )...
83
0
"""simple docstring""" def _A ( lowercase , lowercase ): """simple docstring""" return "\n".join( f'''{number} * {i} = {number * i}''' for i in range(1 , number_of_terms + 1 ) ) if __name__ == "__main__": print(multiplicat...
81
'''simple docstring''' from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : Optional[Any] = logging.get_logger(__name__) snake_case_ : int = { 'microsoft/xprophetnet-large-wiki100-cased': ( 'http...
83
0
# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won't be considered # since ...
82
'''simple docstring''' def A__ ( UpperCAmelCase_ = 1_0_0_0 ): _UpperCamelCase : Dict = 3 _UpperCamelCase : Any = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 1_5 == 0: result -= a ...
83
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 __UpperCAmelCase = get_logger(__name__) __UpperCAmelCase = R'\n Args:\n input_ids (`jnp...
84
'''simple docstring''' from .data_collator import ( DataCollatorForLanguageModeling, DataCollatorForPermutationLanguageModeling, DataCollatorForSeqaSeq, DataCollatorForSOP, DataCollatorForTokenClassification, DataCollatorForWholeWordMask, DataCollatorWithPadding, DefaultDataCollator,...
83
0
'''simple docstring''' from collections import namedtuple _SCREAMING_SNAKE_CASE : Optional[Any] = namedtuple("from_to", "from_ to") _SCREAMING_SNAKE_CASE : Dict = { "cubicmeter": from_to(1, 1), "litre": from_to(0.0_0_1, 1000), "kilolitre": from_to(1, 1), "gallon...
85
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, Au...
83
0
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { """Salesforce/blip-vqa-base""": """https://huggingface.co/Salesforce...
86
'''simple docstring''' from dataclasses import dataclass, field from typing import Optional from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser @dataclass class lowercase__ : lowercase__ = field( metadata={"""help""": """...
83
0
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class snake_case_ ( unittest.TestCase ): def __UpperCamelCase ( self : Union[str, Any] ) -> int: ...
87
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy snake_case_ : Dict = logging.get_logger(__...
83
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowerCAmelCase : int = { 'configuration_clipseg': [ 'CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CLIPSegConfig', 'CLIPSegTextConfig', ...
88
'''simple docstring''' from __future__ import annotations from collections.abc import MutableSequence class lowercase__ : def __init__( self : List[Any] ,lowerCamelCase__ : int ,lowerCamelCase__ : MutableSequence[float] ): '''simple docstring''' if len(l...
83
0
'''simple docstring''' import shutil import tempfile import unittest from transformers import ( SPIECE_UNDERLINE, AddedToken, BatchEncoding, NllbTokenizer, NllbTokenizerFast, is_torch_available, ) from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_...
89
'''simple docstring''' import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class lowercase__ ( lowercase ): @require_torch def UpperCamelCase_ ( self : Dict ): ...
83
0
from itertools import permutations def lowerCamelCase_ ( UpperCamelCase__ : tuple ) -> bool: """simple docstring""" if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if n...
90
'''simple docstring''' import unittest import numpy as np from transformers import DistilBertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import j...
83
0
"""simple docstring""" import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() UpperCAmelCase_ : List[str] = [ ...
91
'''simple docstring''' import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer snake_case_ : ...
83
0
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = OrderedDict( [ ...
92
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_common import S...
83
0
'''simple docstring''' import os import string import sys _lowercase : str = 1 << 8 _lowercase : Tuple = { "tab": ord("\t"), "newline": ord("\r"), "esc": 2_7, "up": 6_5 + ARROW_KEY_FLAG, "down": 6_6 + ARROW_KEY_FLAG, "right": 6_7...
93
'''simple docstring''' def A__ ( UpperCAmelCase_ = 1 , UpperCAmelCase_ = 1_0_0_0 ): _UpperCamelCase : int = 1 _UpperCamelCase : Union[str, Any] = 0 for divide_by_number in range(UpperCAmelCase_ , digit + 1 ): _UpperCamelCase : list[int...
83
0
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass snake_case : int = (3, 9, -11, 0, 7, 5, 1, -1) snake_case : Optional[Any] = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class _snake_case : SCREAMING_SNAK...
94
'''simple docstring''' def A__ ( UpperCAmelCase_ ): if num < 0: return False _UpperCamelCase : int = num _UpperCamelCase : int = 0 while num > 0: _UpperCamelCase : str = rev_num * 1_0 + (num % 1_0) num //= 1_0...
83
0
import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging UpperCAmelCase : in...
95
'''simple docstring''' def A__ ( UpperCAmelCase_ ): _UpperCamelCase : List[str] = abs(UpperCAmelCase_ ) _UpperCamelCase : int = 0 while n > 0: res += n % 1_0 n //= 1_0 return res def A__ ( UpperCAmelCase_ ): ...
83
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 lowercase__ = logging.get_logger(__name_...
96
'''simple docstring''' from math import pi def A__ ( UpperCAmelCase_ , UpperCAmelCase_ ): return 2 * pi * radius * (angle / 3_6_0) if __name__ == "__main__": print(arc_length(90, 10))
83
0
'''simple docstring''' class lowercase : """simple docstring""" def __init__( self , UpperCamelCase_ ): '''simple docstring''' UpperCamelCase__ :Optional[int] = len(UpperCamelCase_ ) UpperCamelCase__ :str = [0] * len_array if len_ar...
97
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : int = logging.get_logger(__name__) snake_case_ : Optional[Any] = { 'RUCAIBox/mvp': 'https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json', } c...
83
0
"""simple docstring""" import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMInverseScheduler, DDIMScheduler, DPMSolverMultiste...
98
'''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.org/licenses/LICENSE-2.0 ...
83
0
from ..utils import DummyObject, requires_backends class A__ ( metaclass=__UpperCAmelCase ): """simple docstring""" __A : int = ['''sentencepiece'''] def __init__( self , *lowercase , **lowercase) -> List[str]: '''simple docstring...
99
'''simple docstring''' import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logg...
83
0
"""simple docstring""" import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() __magic_name__ = logging.get_logger(__name__) __magic_name__ ...
100
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .to...
83
0
import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( TEXT_GUIDED_IMAGE_INPAIN...
101
'''simple docstring''' import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class lowercase__ ( lowercase ): def __init__( self : Any ,lowerCamelCase__ : str ,lowerCamelCase__ : Tuple ,lowerCame...
83
0
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class _UpperCAmelCase ( __snake_case )...
102
'''simple docstring''' import os from datetime import datetime as dt from github import Github snake_case_ : Any = [ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def A__ ( ): ...
83
0
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching between checko...
103
'''simple docstring''' import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(lowercase )...
83
0
'''simple docstring''' from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin from .prior_transforme...
104
'''simple docstring''' from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : Optional[Any] = logging.get_logger(__name__) snake_case_ : int = { 'microsoft/xprophetnet-large-wiki100-cased': ( 'http...
83
0
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingStrategy, logging from .tokenizati...
105
'''simple docstring''' def A__ ( UpperCAmelCase_ = 1_0_0_0 ): _UpperCamelCase : Dict = 3 _UpperCamelCase : Any = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 1_5 == 0: result -= a ...
83
0
"""simple docstring""" def __SCREAMING_SNAKE_CASE ( A_ , A_ ): while b: lowerCAmelCase__ ,lowerCAmelCase__ : Optional[int] = b, a % b return a def __SCREAMING_SNAKE_CASE ( A_ , A_ ): return a if b == 0 else euclidean_gcd_recursive(A_ , a % b ) def ...
106
'''simple docstring''' from .data_collator import ( DataCollatorForLanguageModeling, DataCollatorForPermutationLanguageModeling, DataCollatorForSeqaSeq, DataCollatorForSOP, DataCollatorForTokenClassification, DataCollatorForWholeWordMask, DataCollatorWithPadding, DefaultDataCollator,...
83
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCAmelCase : Union[str, Any] = logging.get_logger(__name__) __lowerCAmelCase : int = { 'facebook/d...
107
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, Au...
83
0
"""simple docstring""" import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStructProcessor, ...
108
'''simple docstring''' from dataclasses import dataclass, field from typing import Optional from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser @dataclass class lowercase__ : lowercase__ = field( metadata={"""help""": """...
83
0
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy ...
109
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy snake_case_ : Dict = logging.get_logger(__...
83
0
from ....configuration_utils import PretrainedConfig from ....utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { 'CarlCochet/trajectory-transformer-halfcheetah-medium-v2': ( 'https://huggingface.co/CarlCochet/trajectory-transformer-...
110
'''simple docstring''' from __future__ import annotations from collections.abc import MutableSequence class lowercase__ : def __init__( self : List[Any] ,lowerCamelCase__ : int ,lowerCamelCase__ : MutableSequence[float] ): '''simple docstring''' if len(l...
83
0
"""simple docstring""" from __future__ import annotations from math import pi # Define the Reduced Planck Constant ℏ (H bar), speed of light C, value of # Pi and the function lowerCAmelCase__ = 1.0_5_4_5_7_1_8_1_7E-3_4 # unit of ℏ : J * s lowerCAmelCase__ = 3E8 # unit of c : m * s^-1 ...
72
'''simple docstring''' import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class lowercase__ ( lowercase ): @require_torch def UpperCamelCase_ ( self : Dict ): ...
83
0
import requests lowerCamelCase = '' # <-- Put your OpenWeatherMap appid here! lowerCamelCase = 'https://api.openweathermap.org/data/2.5/' def a_ ( SCREAMING_SNAKE_CASE__ : Union[str, Any] = "Chicago" , SCREAMING_SNAKE_CASE__ : Optional[Any] = APPID ...
199
'''simple docstring''' import unittest import numpy as np from transformers import DistilBertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import j...
83
0
from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A__ = logging.get_logger(__name__) A__ = { 'google/efficientnet-b7': 'ht...
82
'''simple docstring''' import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer snake_case_ : ...
83
0
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCAmelCase_ ( _lowercase): @staticmethod @abstractmethod def _UpperCamelCase ( __UpperCamelCase : ArgumentParser ) -> int: ra...
256
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_common import S...
83
0
"""simple docstring""" from ....configuration_utils import PretrainedConfig from ....utils import logging _lowerCamelCase : str = logging.get_logger(__name__) _lowerCamelCase : int = { 'Visual-Attention-Network/van-base': ( 'https://huggingface.co/Visual...
167
'''simple docstring''' def A__ ( UpperCAmelCase_ = 1 , UpperCAmelCase_ = 1_0_0_0 ): _UpperCamelCase : int = 1 _UpperCamelCase : Union[str, Any] = 0 for divide_by_number in range(UpperCAmelCase_ , digit + 1 ): _UpperCamelCase : list[int...
83
0
'''simple docstring''' def lowercase__ ( __lowercase : Union[str, Any] ) -> Optional[int]: """simple docstring""" __UpperCamelCase = abs(UpperCAmelCase_ ) __UpperCamelCase = 0 while n > 0: res += n % 10 n //=...
53
'''simple docstring''' def A__ ( UpperCAmelCase_ ): if num < 0: return False _UpperCamelCase : int = num _UpperCamelCase : int = 0 while num > 0: _UpperCamelCase : str = rev_num * 1_0 + (num % 1_0) num //= 1_0...
83
0
import unittest import numpy as np from transformers import DistilBertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.numpy as jnp from tran...
128
'''simple docstring''' def A__ ( UpperCAmelCase_ ): _UpperCamelCase : List[str] = abs(UpperCAmelCase_ ) _UpperCamelCase : int = 0 while n > 0: res += n % 1_0 n //= 1_0 return res def A__ ( UpperCAmelCase_ ): ...
83
0
import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", datefmt="%m/%d/%Y %H:%M:%S", level=logging.INFO ) lowercase__ :s...
101
'''simple docstring''' from math import pi def A__ ( UpperCAmelCase_ , UpperCAmelCase_ ): return 2 * pi * radius * (angle / 3_6_0) if __name__ == "__main__": print(arc_length(90, 10))
83
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule UpperCamelCase_ = {'tokenization_byt5': ['ByT5Tokenizer']} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys UpperCamelCase_ = ...
251
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : int = logging.get_logger(__name__) snake_case_ : Optional[Any] = { 'RUCAIBox/mvp': 'https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json', } c...
83
0
"""simple docstring""" import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): """simple docstring""" def ...
108
'''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.org/licenses/LICENSE-2.0 ...
83
0
'''simple docstring''' import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging __A : str = '\\n\n' __A : str = '\nPerplexity (...
120
'''simple docstring''' import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logg...
83
0
"""simple docstring""" def snake_case_ ( A_ : Optional[Any] ): '''simple docstring''' return sum(i for i in range(1, number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('''Program to check whether a number is a Perfect...
72
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .to...
83
0
import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def a_ ( SCREAMING_SNAKE_CASE__ : int , SCREAMING_SNAKE_CASE__ : List[str] , SCREAMI...
199
'''simple docstring''' import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class lowercase__ ( lowercase ): def __init__( self : Any ,lowerCamelCase__ : str ,lowerCamelCase__ : Tuple ,lowerCame...
83
0
from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging A__ = logging.get_logger(__name__) def _UpperCAmelCase ( snake_case ): """simple docstring""" if isinstance(UpperCAmelCase_ , np.ndarray ): re...
82
'''simple docstring''' import os from datetime import datetime as dt from github import Github snake_case_ : Any = [ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def A__ ( ): ...
83
0
"""simple docstring""" from collections.abc import Generator def lowercase ( ) -> Dict: _UpperCamelCase = 0, 1 while True: _UpperCamelCase = b, a + b yield b def lowercase ( a__ : str = 1000 ) -> Tuple: _Upper...
256
'''simple docstring''' import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(lowercase )...
83
0
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : Any = { 'configuration_informer': [ 'INFORMER_PRETRAINED_CONFIG_ARCHIVE_M...
167
'''simple docstring''' from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : Optional[Any] = logging.get_logger(__name__) snake_case_ : int = { 'microsoft/xprophetnet-large-wiki100-cased': ( 'http...
83
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_available,...
53
'''simple docstring''' def A__ ( UpperCAmelCase_ = 1_0_0_0 ): _UpperCamelCase : Dict = 3 _UpperCamelCase : Any = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 1_5 == 0: result -= a ...
83
0
from __future__ import annotations from statistics import mean def _lowerCAmelCase (_lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase): UpperCamelCase_ = [0] * no_of_processes UpperCamelCase_ = [0] * no_of_processes # Initialize remaining_time ...
128
'''simple docstring''' from .data_collator import ( DataCollatorForLanguageModeling, DataCollatorForPermutationLanguageModeling, DataCollatorForSeqaSeq, DataCollatorForSOP, DataCollatorForTokenClassification, DataCollatorForWholeWordMask, DataCollatorWithPadding, DefaultDataCollator,...
83
0
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging lowercase__ :int = logging.get_logger(__name__) lowercase_...
101
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, Au...
83
0
'''simple docstring''' from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline UpperCamelCase_ = logging.get_logger...
251
'''simple docstring''' from dataclasses import dataclass, field from typing import Optional from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser @dataclass class lowercase__ : lowercase__ = field( metadata={"""help""": """...
83
0
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : str ): '''simple docstring''' if length <= 0 or not isinstance(UpperCAmelCase_ , UpperCAmelCase_ ): raise ValueError("Length must be a positive integer." ) return [n * (2 * n - 1) for n in range(UpperCA...
108
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy snake_case_ : Dict = logging.get_logger(__...
83
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __A : int = { 'configuration_vision_text_dual_encoder': ['Vi...
120
'''simple docstring''' from __future__ import annotations from collections.abc import MutableSequence class lowercase__ : def __init__( self : List[Any] ,lowerCamelCase__ : int ,lowerCamelCase__ : MutableSequence[float] ): '''simple docstring''' if len(l...
83
0
"""simple docstring""" import argparse import logging import os import sys import numpy as np import onnxruntime import torch from bart_onnx.generation_onnx import BARTBeamSearchGenerator from bart_onnx.reduce_onnx_size import remove_dup_initializers import transformers from transformers import BartForCondi...
72
'''simple docstring''' import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class lowercase__ ( lowercase ): @require_torch def UpperCamelCase_ ( self : Dict ): ...
83
0
from __future__ import annotations import matplotlib.pyplot as plt # type: ignore import numpy # initial triangle of Koch snowflake lowerCamelCase = numpy.array([0, 0]) lowerCamelCase = numpy.array([0.5, 0.866_0254]) lowerCamelCase = numpy.array([1, 0]) lowerCamelCa...
199
'''simple docstring''' import unittest import numpy as np from transformers import DistilBertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import j...
83
0
import json import os import unittest from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES, XLMTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class __lowerCAmelCase ( lowerCamelCase__ , unittest.TestCase...
82
'''simple docstring''' import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer snake_case_ : ...
83
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase = { 'configuration_groupvit': [ 'GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GroupViTConfig', 'GroupViTOnnxCon...
256
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_common import S...
83
0
"""simple docstring""" import os def lowercase_ ( ): """simple docstring""" A_ : List[str] = os.path.join(os.path.dirname(UpperCAmelCase_ ) , '''num.txt''' ) with open(UpperCAmelCase_ ) as file_hand: return str(sum(int(UpperCAmelCase...
167
'''simple docstring''' def A__ ( UpperCAmelCase_ = 1 , UpperCAmelCase_ = 1_0_0_0 ): _UpperCamelCase : int = 1 _UpperCamelCase : Union[str, Any] = 0 for divide_by_number in range(UpperCAmelCase_ , digit + 1 ): _UpperCamelCase : list[int...
83
0
'''simple docstring''' import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampler...
53
'''simple docstring''' def A__ ( UpperCAmelCase_ ): if num < 0: return False _UpperCamelCase : int = num _UpperCamelCase : int = 0 while num > 0: _UpperCamelCase : str = rev_num * 1_0 + (num % 1_0) num //= 1_0...
83
0
from __future__ import annotations from collections.abc import MutableSequence class _lowercase : '''simple docstring''' def __init__( self , snake_case__ , snake_case__ ): '''simple docstring''' if len(lowerCamelCase__ ) != degree + 1: ...
128
'''simple docstring''' def A__ ( UpperCAmelCase_ ): _UpperCamelCase : List[str] = abs(UpperCAmelCase_ ) _UpperCamelCase : int = 0 while n > 0: res += n % 1_0 n //= 1_0 return res def A__ ( UpperCAmelCase_ ): ...
83
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def UpperCamelCase ( lowerCAmelCase__ ): '''simple docstr...
101
'''simple docstring''' from math import pi def A__ ( UpperCAmelCase_ , UpperCAmelCase_ ): return 2 * pi * radius * (angle / 3_6_0) if __name__ == "__main__": print(arc_length(90, 10))
83
0
'''simple docstring''' 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, TrainingJobAnal...
251
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : int = logging.get_logger(__name__) snake_case_ : Optional[Any] = { 'RUCAIBox/mvp': 'https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json', } c...
83
0
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : Optional[Any] ): '''simple docstring''' lowerCAmelCase : List[Any] = generate_pascal_triangle(UpperCAmelCase_ ) for row_idx in range(UpperCAmelCase_ ): # Print left spaces for _ in rang...
108
'''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.org/licenses/LICENSE-2.0 ...
83
0
'''simple docstring''' import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokenizer ...
120
'''simple docstring''' import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logg...
83
0
"""simple docstring""" lowerCAmelCase__ = 9.8_0_6_6_5 def snake_case_ ( A_ : Optional[int], A_ : Union[str, Any], A_ : Dict = g ): '''simple docstring''' if fluid_density <= 0: raise ValueError('''Impossible fluid densit...
72
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .to...
83
0
def a_ ( SCREAMING_SNAKE_CASE__ : str ): '''simple docstring''' _lowerCamelCase : Optional[int] =[False] * len(UpperCAmelCase_ ) _lowerCamelCase : List[Any] =[-1] * len(UpperCAmelCase_ ) def dfs(SCREAMING_SNAKE_CASE__ : Any , ...
199
'''simple docstring''' import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class lowercase__ ( lowercase ): def __init__( self : Any ,lowerCamelCase__ : str ,lowerCamelCase__ : Tuple ,lowerCame...
83
0
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from ...test_p...
82
'''simple docstring''' import os from datetime import datetime as dt from github import Github snake_case_ : Any = [ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def A__ ( ): ...
83
0
"""simple docstring""" import re def lowercase ( a__ : Dict ) -> Any: _UpperCamelCase = re.compile(R'''^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$''' ) if match := re.search(UpperCAmelCase_ , UpperCAmelCase_ ): return match.string == phone return False ...
256
'''simple docstring''' import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(lowercase )...
83
0
"""simple docstring""" from __future__ import annotations def lowercase_ ( _UpperCAmelCase ): """simple docstring""" A_ : Union[str, Any] = 0.00 A_ : Any = 0 for resistor in resistors: if resistor <= 0: A_ : Optional[...
167
'''simple docstring''' from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : Optional[Any] = logging.get_logger(__name__) snake_case_ : int = { 'microsoft/xprophetnet-large-wiki100-cased': ( 'http...
83
0
'''simple docstring''' import json import os from dataclasses import dataclass from functools import partial from typing import Callable import flax.linen as nn import jax import jax.numpy as jnp import joblib import optax import wandb from flax import jax_utils, struct, traverse_util from flax.serialization imp...
53
'''simple docstring''' def A__ ( UpperCAmelCase_ = 1_0_0_0 ): _UpperCamelCase : Dict = 3 _UpperCamelCase : Any = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 1_5 == 0: result -= a ...
83
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase : int =logging.get_logger(__name__) UpperCAmelCase : Uni...
128
'''simple docstring''' from .data_collator import ( DataCollatorForLanguageModeling, DataCollatorForPermutationLanguageModeling, DataCollatorForSeqaSeq, DataCollatorForSOP, DataCollatorForTokenClassification, DataCollatorForWholeWordMask, DataCollatorWithPadding, DefaultDataCollator,...
83
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 from ...image_pr...
101
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, Au...
83
0
'''simple docstring''' import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class _a ( unittest.TestCase ): '''simple docstring''' def ...
251
'''simple docstring''' from dataclasses import dataclass, field from typing import Optional from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser @dataclass class lowercase__ : lowercase__ = field( metadata={"""help""": """...
83
0
"""simple docstring""" import os import pytest from transformers.dynamic_module_utils import get_imports lowerCAmelCase__ = '\nimport os\n' lowerCAmelCase__ = '\ndef foo():\n import os\n return False\n' lowerCAmelCase__ = '\ndef foo():\n def bar():\n if T...
108
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy snake_case_ : Dict = logging.get_logger(__...
83
0
'''simple docstring''' def UpperCamelCase_ ( A__ : Union[str, Any] ): '''simple docstring''' lowerCAmelCase_ : Optional[Any] = [] lowerCAmelCase_ : Optional[Any] = set({"""(""", """[""", """{"""} ) lowerCAmelCase_ : Optional[in...
120
'''simple docstring''' from __future__ import annotations from collections.abc import MutableSequence class lowercase__ : def __init__( self : List[Any] ,lowerCamelCase__ : int ,lowerCamelCase__ : MutableSequence[float] ): '''simple docstring''' if len(l...
83
0
"""simple docstring""" from ..utils import DummyObject, requires_backends class __snake_case ( metaclass=_lowercase): snake_case__ : Any = ["note_seq"] def __init__( self : Tuple , *__lowerCAmelCase : Union[str, Any] , **__lowerCAmel...
72
'''simple docstring''' import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class lowercase__ ( lowercase ): @require_torch def UpperCamelCase_ ( self : Dict ): ...
83
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase = { 'configuration_xlm_roberta_xl': [ 'XLM_ROBERTA_XL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XLMRobertaXLConfig', 'XLMRobertaXLOnnxConfig', ...
199
'''simple docstring''' import unittest import numpy as np from transformers import DistilBertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import j...
83
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A__ = {'configuration_xlnet': ['XLNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XLNetConfig']...
82
'''simple docstring''' import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer snake_case_ : ...
83
0
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase = { 'configuration_autoformer': [ 'AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'AutoformerConfig'...
256
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_common import S...
83
0
"""simple docstring""" import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def lowerc...
167
'''simple docstring''' def A__ ( UpperCAmelCase_ = 1 , UpperCAmelCase_ = 1_0_0_0 ): _UpperCamelCase : int = 1 _UpperCamelCase : Union[str, Any] = 0 for divide_by_number in range(UpperCAmelCase_ , digit + 1 ): _UpperCamelCase : list[int...
83
0
'''simple docstring''' import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer a__ : ...
53
'''simple docstring''' def A__ ( UpperCAmelCase_ ): if num < 0: return False _UpperCamelCase : int = num _UpperCamelCase : int = 0 while num > 0: _UpperCamelCase : str = rev_num * 1_0 + (num % 1_0) num //= 1_0...
83
0