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""" from __future__ import annotations class __A : """simple docstring""" def __init__( self , __A ) -> None: a =data a =None a =None def _A ( lowercase ): # In Order traversal o...
81
'''simple docstring''' import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class snake_case ( l...
55
0
def _UpperCAmelCase ( snake_case ): """simple docstring""" return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
82
'''simple docstring''' import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # 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 six # ...
55
0
'''simple docstring''' def A__ ( UpperCAmelCase_ , UpperCAmelCase_ ): while second != 0: _UpperCamelCase : str = first & second first ^= second _UpperCamelCase : Tuple = c << 1 return first if __name__ == "__main__": import ...
83
'''simple docstring''' from __future__ import annotations from fractions import Fraction def __snake_case ( UpperCAmelCase_ : int , UpperCAmelCase_ : int ): return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) ...
55
0
"""simple docstring""" from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ...
84
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging a_ : Any = log...
55
0
'''simple docstring''' import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAP...
85
'''simple docstring''' import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNe...
55
0
"""simple docstring""" from abc import ABC, abstractmethod from typing import List, Optional class A__ ( _lowerCamelCase): def __init__( self ): # test for the above condition self.test() def __lowerCamelCase ( self ): __lowerCAmelCase : Optional[int] ...
86
'''simple docstring''' import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils impo...
55
0
from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from ...
87
'''simple docstring''' import math def __snake_case ( UpperCAmelCase_ : float , UpperCAmelCase_ : float ): return math.pow(UpperCAmelCase_ , 2 ) - a def __snake_case ( UpperCAmelCase_ : float ): return 2 * x d...
55
0
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import tensorflow as tf from transformers import AutoTokenizer, TFAutoModelForSeq...
88
'''simple docstring''' import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available ...
55
0
'''simple docstring''' from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerate_...
89
'''simple docstring''' from __future__ import annotations def __snake_case ( UpperCAmelCase_ : int ): lowerCamelCase_ = 2 lowerCamelCase_ = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(UpperCAmelCase_ ) if n > 1: fac...
55
0
import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class __lowerCAmelCase ( __magic_name__...
90
'''simple docstring''' import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from...
55
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(): impo...
91
'''simple docstring''' from __future__ import annotations from typing import Generic, TypeVar a_ : List[str] = TypeVar("""T""") class snake_case ( Generic[T] ): """simple docstring""" def __init__( self , UpperCamelCase ): ...
55
0
def _a ( SCREAMING_SNAKE_CASE_ : int ): # noqa: E741 __lowerCAmelCase = len(SCREAMING_SNAKE_CASE_ ) __lowerCAmelCase = 0 __lowerCAmelCase = [0] * n __lowerCAmelCase = [False] * n __lowerCAmelCase = [Fa...
92
'''simple docstring''' a_ : Any = """0.21.0""" from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_dispatch, ) from .data_load...
55
0
'''simple docstring''' import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) i...
93
'''simple docstring''' a_ : str = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ a_ : Any...
55
0
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast snake_case : List[Any] = datasets.utils.logging.get_logger(__name__) @dataclass class _snake_ca...
94
'''simple docstring''' import math def __snake_case ( UpperCAmelCase_ : int ): lowerCamelCase_ = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(UpperCAmelCase_ ) def __snake_case ( UpperCAmelCase_ : ...
55
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase : Any = logging.get_logger(__name__) UpperCAmelCase : str = { """kssteven/i...
95
'''simple docstring''' import os def __snake_case ( UpperCAmelCase_ : str = "matrix.txt" ): with open(os.path.join(os.path.dirname(UpperCAmelCase_ ) , UpperCAmelCase_ ) ) as in_file: lowerCamelCase_ = in_file.read() lowerCamelCase_ = [[int(UpperCAme...
55
0
"""simple docstring""" import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow lowercase__ = logging.getLogger() ...
96
'''simple docstring''' from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStr...
55
0
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
97
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, ...
55
0
"""simple docstring""" import datasets from .evaluate import evaluate lowerCAmelCase__ : Optional[Any] = '\\n@inproceedings{Rajpurkar2016SQuAD10,\n title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text},\n author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Lian...
98
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class snake_case ...
55
0
from scipy.stats import pearsonr import datasets lowercase : int = """ Pearson correlation coefficient and p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assumption ...
99
'''simple docstring''' from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, float...
55
0
"""simple docstring""" import os import re 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 logging __magic_name__ = logging.get_logger(__name__) __magic_n...
100
'''simple docstring''' 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, TestCase...
55
0
from random import shuffle import tensorflow as tf from numpy import array def UpperCamelCase ( lowerCAmelCase__ , lowerCAmelCase__ ): '''simple docstring''' lowercase = int(lowerCAmelCase__ ) assert noofclusters < len(lowerCAmelCase__ ) # Find out the dimension...
101
'''simple docstring''' import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging a_ : Dict ...
55
0
"""simple docstring""" import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, ...
102
'''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/LICENS...
55
0
import math import random from typing import Any from .hill_climbing import SearchProblem def UpperCamelCase( __UpperCamelCase : Optional[Any] ,__UpperCamelCase : bool = True ,__UpperCamelCase : float = math.inf ,__UpperCamelCase : float = -math.inf ,__UpperCamelCa...
103
'''simple docstring''' import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class snake_case ( l...
55
0
'''simple docstring''' import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from...
104
'''simple docstring''' import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # 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 six # ...
55
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a : Union[str, Any] = { '''configuration_jukebox''': [ '''JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''JukeboxConfi...
105
'''simple docstring''' from __future__ import annotations from fractions import Fraction def __snake_case ( UpperCAmelCase_ : int , UpperCAmelCase_ : int ): return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) ...
55
0
"""simple docstring""" __UpperCamelCase : Dict = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers....
106
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging a_ : Any = log...
55
0
import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class snake_case__ (unittest.TestCase ): """simple docstring""" def __UpperCAmelCase ( self : List[Any] ) -> Optional[Any]: a = [ "safet...
107
'''simple docstring''' import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNe...
55
0
"""simple docstring""" from typing import List from .keymap import KEYMAP, get_character def a__ ( SCREAMING_SNAKE_CASE : str ): '''simple docstring''' def decorator(SCREAMING_SNAKE_CASE : Tuple ): lowerCAmelCase : Optional[int] = getattr(SCRE...
108
'''simple docstring''' import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils impo...
55
0
"""simple docstring""" import sys from collections import defaultdict class SCREAMING_SNAKE_CASE__ : def __init__( self ) -> str: '''simple docstring''' UpperCAmelCase : Optional[int] = [] def SCREAMING_SNAKE_CASE ( self , _SCREAMING_SNAKE_CASE ...
109
'''simple docstring''' import math def __snake_case ( UpperCAmelCase_ : float , UpperCAmelCase_ : float ): return math.pow(UpperCAmelCase_ , 2 ) - a def __snake_case ( UpperCAmelCase_ : float ): return 2 * x d...
55
0
from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record lowerCAmelCase = '\\n@article{wang2019superglue,\n title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding Systems},\n author={Wang,...
110
'''simple docstring''' import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available ...
55
0
import math def lowerCamelCase_ ( _UpperCamelCase ) -> Tuple: """simple docstring""" snake_case_ : Tuple = 0 snake_case_ : List[Any] = 0 while num > 0: snake_case_ : int = num % 8 snake_case_ : Union[str, ...
279
'''simple docstring''' from __future__ import annotations def __snake_case ( UpperCAmelCase_ : int ): lowerCamelCase_ = 2 lowerCamelCase_ = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(UpperCAmelCase_ ) if n > 1: fac...
55
0
'''simple docstring''' from __future__ import annotations from typing import Generic, TypeVar __SCREAMING_SNAKE_CASE : List[str] = TypeVar("""T""") class lowerCamelCase_ (Generic[T] ): '''simple docstring''' def __init__( self : int , A : Tuple ...
31
'''simple docstring''' import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from...
55
0
import argparse UpperCamelCase = """docs/source/_static/js/custom.js""" def __lowerCamelCase ( snake_case__ ) -> Optional[int]: """simple docstring""" with open(UpperCAmelCase_ ,encoding="""utf-8""" ,newline="""\n""" ) as f: ...
306
'''simple docstring''' from __future__ import annotations from typing import Generic, TypeVar a_ : List[str] = TypeVar("""T""") class snake_case ( Generic[T] ): """simple docstring""" def __init__( self , UpperCamelCase ): ...
55
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils im...
177
'''simple docstring''' a_ : Any = """0.21.0""" from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_dispatch, ) from .data_load...
55
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs if is_torch_available...
201
'''simple docstring''' a_ : str = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ a_ : Any...
55
0
def __SCREAMING_SNAKE_CASE ( UpperCamelCase__ , UpperCamelCase__ ) -> str: '''simple docstring''' return 1 if input_a == input_a else 0 def __SCREAMING_SNAKE_CASE ( ) -> Union[str, Any]: '''simple docstring''' assert xnor_gate(0 , 0 ) == 1 as...
273
'''simple docstring''' import math def __snake_case ( UpperCAmelCase_ : int ): lowerCamelCase_ = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(UpperCAmelCase_ ) def __snake_case ( UpperCAmelCase_ : ...
55
0
'''simple docstring''' A__ : Dict =[ """VerificationMode""", """Version""", """disable_progress_bar""", """enable_progress_bar""", """is_progress_bar_enabled""", """experimental""", ] from .info_utils import VerificationMode from .logging import disa...
70
'''simple docstring''' import os def __snake_case ( UpperCAmelCase_ : str = "matrix.txt" ): with open(os.path.join(os.path.dirname(UpperCAmelCase_ ) , UpperCAmelCase_ ) ) as in_file: lowerCamelCase_ = in_file.read() lowerCamelCase_ = [[int(UpperCAme...
55
0
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 .tokenization_realm import RealmTokenizer ...
296
'''simple docstring''' from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStr...
55
0
class _a : '''simple docstring''' def __init__( self ): A__ : Any = 0 A__ : str = 0 A__ : Optional[int] = {} def __A ( self , A__ ): if vertex not in self.adjacency: A__ : ...
192
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, ...
55
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, ...
40
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class snake_case ...
55
0
"""simple docstring""" def lowercase ( a__ : int ) -> Union[str, Any]: _UpperCamelCase = int(UpperCAmelCase_ ) if decimal in (0, 1): # Exit cases for the recursion return str(UpperCAmelCase_ ) _UpperCamelCase , _UpperCamelCase = ...
256
'''simple docstring''' from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, float...
55
0
def lowerCamelCase_ ( _UpperCamelCase ) -> str: """simple docstring""" if not head: return True # split the list to two parts snake_case_ , snake_case_ : List[Any] = head.next, head while fast and fast.next: snake_case_ : U...
279
'''simple docstring''' 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, TestCase...
55
0
'''simple docstring''' from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar __SCREAMING_SNAKE_CASE : Union[str, Any] = TypeVar("""KEY""") __SCREAMING_SNAKE_CASE : Tuple = TypeVar("""VAL""") @dataclass(frozen=snake_...
31
'''simple docstring''' import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging a_ : Dict ...
55
0
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_spa...
306
'''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/LICENS...
55
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __A = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_xlm""": ["...
177
'''simple docstring''' import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class snake_case ( l...
55
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase_ = {"""configuration_plbart""": ["""PLBART_PRETRAINED_CONFIG_ARCHIVE_MAP...
201
'''simple docstring''' import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # 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 six # ...
55
0
import unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_tor...
273
'''simple docstring''' from __future__ import annotations from fractions import Fraction def __snake_case ( UpperCAmelCase_ : int , UpperCAmelCase_ : int ): return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) ...
55
0
'''simple docstring''' from math import sqrt def UpperCamelCase__ ( lowerCAmelCase ): """simple docstring""" assert isinstance(UpperCAmelCase_ , UpperCAmelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" ...
70
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging a_ : Any = log...
55
0
import unittest from transformers import AutoTokenizer, FalconConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_co...
296
'''simple docstring''' import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNe...
55
0
def UpperCamelCase (lowercase_: int = 50000000 ) -> Tuple: A__ : List[str] = set() A__ : Optional[int] = int((limit - 24) ** (1 / 2) ) A__ : Tuple = set(range(3 , prime_square_limit + 1 , 2 ) ) primes.add(2 ...
192
'''simple docstring''' import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils impo...
55
0
"""simple docstring""" import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, ...
40
'''simple docstring''' import math def __snake_case ( UpperCAmelCase_ : float , UpperCAmelCase_ : float ): return math.pow(UpperCAmelCase_ , 2 ) - a def __snake_case ( UpperCAmelCase_ : float ): return 2 * x d...
55
0
"""simple docstring""" UpperCAmelCase = """Tobias Carryer""" from time import time class UpperCAmelCase_ : def __init__( self : Dict , __UpperCamelCase : Optional[int] , __UpperCamelCase : str , __UpperCamelCase : Dict , __...
256
'''simple docstring''' import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available ...
55
0
import requests from bsa import BeautifulSoup def lowerCamelCase_ ( _UpperCamelCase = "AAPL" ) -> Union[str, Any]: """simple docstring""" snake_case_ : List[str] = f'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}''' snake_case_ : List[Any]...
279
'''simple docstring''' from __future__ import annotations def __snake_case ( UpperCAmelCase_ : int ): lowerCamelCase_ = 2 lowerCamelCase_ = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(UpperCAmelCase_ ) if n > 1: fac...
55
0
'''simple docstring''' import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_model...
31
'''simple docstring''' import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from...
55
0
def __lowerCamelCase ( snake_case__ = 10_00 ) -> Tuple: """simple docstring""" _SCREAMING_SNAKE_CASE = 2**power _SCREAMING_SNAKE_CASE = 0 while n: _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = ...
306
'''simple docstring''' from __future__ import annotations from typing import Generic, TypeVar a_ : List[str] = TypeVar("""T""") class snake_case ( Generic[T] ): """simple docstring""" def __init__( self , UpperCamelCase ): ...
55
0
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase (_UpperCAmelCase ): """simple docstring""" _UpperCAmelCase :Optional[Any] = ["image_processor", "tokenizer"] _UpperC...
177
'''simple docstring''' a_ : Any = """0.21.0""" from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_dispatch, ) from .data_load...
55
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase_ = { """configuration_timesformer""": ["""TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TimesformerConfig"""], } try: if not is_torch_availab...
201
'''simple docstring''' a_ : str = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ a_ : Any...
55
0
def __SCREAMING_SNAKE_CASE ( UpperCamelCase__ ) -> Tuple: '''simple docstring''' UpperCAmelCase = [[0 for _ in range(UpperCAmelCase_ )] for _ in range(m + 1 )] for i in range(m + 1 ): UpperCAmelCase = 1 for n in range(m + 1 ): for k in range(1 , Upp...
273
'''simple docstring''' import math def __snake_case ( UpperCAmelCase_ : int ): lowerCamelCase_ = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(UpperCAmelCase_ ) def __snake_case ( UpperCAmelCase_ : ...
55
0
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging A__ : List[Any] =log...
70
'''simple docstring''' import os def __snake_case ( UpperCAmelCase_ : str = "matrix.txt" ): with open(os.path.join(os.path.dirname(UpperCAmelCase_ ) , UpperCAmelCase_ ) ) as in_file: lowerCamelCase_ = in_file.read() lowerCamelCase_ = [[int(UpperCAme...
55
0
import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig SCREAMING_SNAKE_CASE_ = { """facebook/maskformer-swin-b...
296
'''simple docstring''' from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStr...
55
0
import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceFeatur...
192
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, ...
55
0
"""simple docstring""" import operator def lowercase ( A_ , A_ = False , A_ = None )-> List[str]: '''simple docstring''' a : Union[str, Any] = operator.lt if reverse else operator.gt a : List[str] = solut...
40
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class snake_case ...
55
0
"""simple docstring""" import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class UpperCAmelCase_ ( _lowercase): snake_case__ = '''''' snake_case__ = ( ...
256
'''simple docstring''' from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, float...
55
0
class __lowerCAmelCase : def __init__(self ) -> Tuple: '''simple docstring''' snake_case_ : Dict = {} # Mapping from char to TrieNode snake_case_ : List[str] = False def lowerCamelCase (self , __magic_name__ ...
279
'''simple docstring''' 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, TestCase...
55
0
'''simple docstring''' import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Value from .base import TaskTemplate @dataclass(frozen=snake_case__ ) class lowerCamelCase_ (snake_case__ ): '''simple docstring''' __Upper...
31
'''simple docstring''' import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging a_ : Dict ...
55
0
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class __Upp...
306
'''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/LICENS...
55
0
"""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 __A = logging.get_logger(__name__) class ...
177
'''simple docstring''' import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class snake_case ( l...
55
0
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, ControlNetModel, DDIMScheduler, StableDiffusionControlNet...
201
'''simple docstring''' import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # 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 six # ...
55
0
import tempfile import unittest from make_student import create_student_by_copying_alternating_layers from transformers import AutoConfig from transformers.file_utils import cached_property from transformers.testing_utils import require_torch __A : List[str] = """sshleifer/bart-tiny-random""" __...
273
'''simple docstring''' from __future__ import annotations from fractions import Fraction def __snake_case ( UpperCAmelCase_ : int , UpperCAmelCase_ : int ): return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) ...
55
0
'''simple docstring''' import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase ( snake_case_ ): _lowercase: Union[str, Any] = (CMStochasticIterativeScheduler,) _lo...
70
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging a_ : Any = log...
55
0
from __future__ import annotations from functools import lru_cache from math import ceil SCREAMING_SNAKE_CASE_ = 1_0_0 SCREAMING_SNAKE_CASE_ = set(range(3, NUM_PRIMES, 2)) primes.add(2) SCREAMING_SNAKE_CASE_ = 42 for prime in range(3, ceil(NUM_PRIMES*...
296
'''simple docstring''' import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNe...
55
0
import numpy class _a : '''simple docstring''' def __init__( self , A__ , A__ ): A__ : Optional[Any] = input_array # Random initial weights are assigned where first argument is the # number of nodes in previous layer and second argu...
192
'''simple docstring''' import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils impo...
55
0
"""simple docstring""" def lowercase ( A_ , A_ )-> List[Any]: '''simple docstring''' a : Any = len(UpperCAmelCase_ ) a : Any = len(UpperCAmelCase_ ) a : List[str] = [[False for ...
40
'''simple docstring''' import math def __snake_case ( UpperCAmelCase_ : float , UpperCAmelCase_ : float ): return math.pow(UpperCAmelCase_ , 2 ) - a def __snake_case ( UpperCAmelCase_ : float ): return 2 * x d...
55
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { """alibaba-damo/mgp-str-base""": """https://huggingface.co/alibaba-damo/mgp-str-base/resolve/main/config.json""", } class ...
256
'''simple docstring''' import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available ...
55
0
import argparse import datetime def lowerCamelCase_ ( _UpperCamelCase ) -> List[Any]: """simple docstring""" snake_case_ : str = { '''0''': '''Sunday''', '''1''': '''Monday''', '''2''': '''Tuesday''', '''3''': '''Wednesday''', ...
279
'''simple docstring''' from __future__ import annotations def __snake_case ( UpperCAmelCase_ : int ): lowerCamelCase_ = 2 lowerCamelCase_ = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(UpperCAmelCase_ ) if n > 1: fac...
55
0
'''simple docstring''' from ....configuration_utils import PretrainedConfig from ....utils import logging __SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) __SCREAMING_SNAKE_CASE : Optional[int] = { """Visual-Attention-Network/van-base""": ( """https://huggingf...
31
'''simple docstring''' import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from...
55
0
import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configuration_pegasus import DEFAULTS...
306
'''simple docstring''' from __future__ import annotations from typing import Generic, TypeVar a_ : List[str] = TypeVar("""T""") class snake_case ( Generic[T] ): """simple docstring""" def __init__( self , UpperCamelCase ): ...
55
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 __A = logging.get_logger(__name__) __A = { """google/mobilenet_v1_1...
177
'''simple docstring''' a_ : Any = """0.21.0""" from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_dispatch, ) from .data_load...
55
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { """shi-labs/nat-mini-in...
201
'''simple docstring''' a_ : str = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ a_ : Any...
55
0
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class A_ (a_ ): UpperCAmelCase__ = (KDPMaDiscreteScheduler,) UpperCAmelCase__ = 1_0 def _lowercase ( self , **_A ): ...
273
'''simple docstring''' import math def __snake_case ( UpperCAmelCase_ : int ): lowerCamelCase_ = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(UpperCAmelCase_ ) def __snake_case ( UpperCAmelCase_ : ...
55
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : Any =logging.get_logger(__name__) A__ : List[Any] ={ """google/fnet-base""": """https://huggingface.co/google/fnet-base/resolve/main/config.json""", ...
70
'''simple docstring''' import os def __snake_case ( UpperCAmelCase_ : str = "matrix.txt" ): with open(os.path.join(os.path.dirname(UpperCAmelCase_ ) , UpperCAmelCase_ ) ) as in_file: lowerCamelCase_ = in_file.read() lowerCamelCase_ = [[int(UpperCAme...
55
0
import requests from bsa import BeautifulSoup def __lowercase ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> Union[str, Any]: '''simple docstring''' SCREAMING_SNAKE_CASE = BeautifulSoup(requests.get(UpperCAmelCase_ , params=UpperCAmelCase_ ).co...
296
'''simple docstring''' from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStr...
55
0
from typing import Any class _a : '''simple docstring''' def __init__( self , A__ ): A__ : str = data A__ : Tuple = None class _a : '''simple docstring''' def __init__( self ): A__ : s...
192
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, ...
55
0
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoC...
40
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class snake_case ...
55
0
"""simple docstring""" import os import sys import transformers UpperCAmelCase = """3""" print("""Python version:""", sys.version) print("""transformers version:""", transformers.__version__) try: import torch print("""Torch version:""", torch.__version__) print("""Cuda available:""", torch.cuda.is_...
256
'''simple docstring''' from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, float...
55
0
import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import TensorTy...
279
'''simple docstring''' 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, TestCase...
55
0
'''simple docstring''' from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCamelCase_ (snake_case__ ): '''simple docstring''' @staticmethod @abstractmethod def _A ( A : List[str] ): raise NotImplementedError() ...
31
'''simple docstring''' import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging a_ : Dict ...
55
0
def __lowerCamelCase ( snake_case__ ) -> Optional[Any]: """simple docstring""" if not nums: # Makes sure that the list is not empty raise ValueError("""List is empty""" ) _SCREAMING_SNAKE_CASE = sum(UpperCAmelCase_ ) / l...
306
'''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/LICENS...
55
0
"""simple docstring""" import itertools import string from collections.abc import Generator, Iterable def SCREAMING_SNAKE_CASE__ ( __UpperCAmelCase , __UpperCAmelCase ) -> str: lowercase__: Union[str, Any] = iter(UpperCAmelCase_ ) while True: lowercase__: Dict = ...
177
'''simple docstring''' import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class snake_case ( l...
55
0
from __future__ import annotations import math import random from typing import Any class lowercase__ : '''simple docstring''' def __init__( self ) -> Optional[Any]: """simple docstring""" UpperCamelCase__ : Dict ...
201
'''simple docstring''' import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # 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 six # ...
55
0
import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import ...
273
'''simple docstring''' from __future__ import annotations from fractions import Fraction def __snake_case ( UpperCAmelCase_ : int , UpperCAmelCase_ : int ): return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) ...
55
0
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.uti...
70
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging a_ : Any = log...
55
0
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex from .utils import require...
296
'''simple docstring''' import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNe...
55
0
def UpperCamelCase (lowercase_: list ) -> Tuple: if len(UpperCAmelCase_ ) < 2: return collection def circle_sort_util(lowercase_: list , lowercase_: int , lowercase_: int ) -> bool: A__ : Dict = False if low == high: return swapped A__ ...
192
'''simple docstring''' import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils impo...
55
0
"""simple docstring""" def lowercase ( A_ = 50 )-> List[str]: '''simple docstring''' a : Tuple = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in ...
40
'''simple docstring''' import math def __snake_case ( UpperCAmelCase_ : float , UpperCAmelCase_ : float ): return math.pow(UpperCAmelCase_ , 2 ) - a def __snake_case ( UpperCAmelCase_ : float ): return 2 * x d...
55
0
"""simple docstring""" from __future__ import annotations from fractions import Fraction def lowercase ( a__ : int , a__ : int ) -> List[Any]: return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) def lowercase ( a_...
256
'''simple docstring''' import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available ...
55
0
import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = {"""vocab_file""": """sentencepiece.model"...
279
'''simple docstring''' from __future__ import annotations def __snake_case ( UpperCAmelCase_ : int ): lowerCamelCase_ = 2 lowerCamelCase_ = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(UpperCAmelCase_ ) if n > 1: fac...
55
0
'''simple docstring''' import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def UpperCamelCase_ ( _UpperCAmelCase : di...
31
'''simple docstring''' import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from...
55
0
class __UpperCAmelCase : def __init__( self: List[str] , UpperCAmelCase_: Optional[int] ): '''simple docstring''' _SCREAMING_SNAKE_CASE = len(UpperCAmelCase_ ) _SCREAMING_SNAKE_CASE = [0] * len_array ...
306
'''simple docstring''' from __future__ import annotations from typing import Generic, TypeVar a_ : List[str] = TypeVar("""T""") class snake_case ( Generic[T] ): """simple docstring""" def __init__( self , UpperCamelCase ): ...
55
0
"""simple docstring""" import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCSTRING, Ber...
177
'''simple docstring''' a_ : Any = """0.21.0""" from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_dispatch, ) from .data_load...
55
0