code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" import argparse import math import os import torch from neural_compressor.utils.pytorch import load from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, StableDiffusionPipeline, UNetaDConditionModel def lowerCamelCase_ (...
506
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Union[str, Any] = logging.get_logger(__name__) a__ : Optional[int] = { # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert } ...
51
0
'''simple docstring''' import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class lowerCAmelCase ( __SCREAMING_SNAKE_CASE , unittest.TestCase ): a : ...
721
'''simple docstring''' import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class lowerCAmelCase : def __init__( self , UpperCamelCase ): if isinstance(UpperCamelCase...
493
0
'''simple docstring''' import argparse import ast import logging import os import sys import pandas as pd import torch from tqdm import tqdm from transformers import BartForConditionalGeneration, RagRetriever, RagSequenceForGeneration, RagTokenForGeneration from transformers import logging as transformers_log...
418
'''simple docstring''' import math from numpy import inf from scipy.integrate import quad def SCREAMING_SNAKE_CASE_ ( __A : float ) -> float: if num <= 0: raise ValueError("math domain error" ) return quad(__A , 0 , __A , args=(__A) )[0] def SCREAM...
418
1
"""simple docstring""" import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils impor...
87
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _a : Optional[int] = { """configuration_pix2struct""": [ """PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Pix2Struc...
87
1
"""simple docstring""" from itertools import permutations def __snake_case ( __A ) -> Optional[Any]: if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if num[5] % 5 != 0: return False lowercase :...
607
def A__ ( snake_case_ : int ): if upper_limit < 0: raise ValueError('''Limit for the Catalan sequence must be ≥ 0''' ) SCREAMING_SNAKE_CASE__: List[Any]= [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 SCREAMING_SNAKE_CASE__: List[str]= 1 if upper_limit > 0: SCREAMING_SNAKE_CASE_...
64
0
"""simple docstring""" def snake_case (A_ :int ): '''simple docstring''' if not isinstance(A_ , A_ ): raise ValueError('multiplicative_persistence() only accepts integral values' ) if num < 0: raise ValueError('multiplicative_persistence() does not accept negative va...
118
"""simple docstring""" import json import os import unittest from transformers.models.roc_bert.tokenization_roc_bert import ( VOCAB_FILES_NAMES, RoCBertBasicTokenizer, RoCBertTokenizer, RoCBertWordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.tes...
118
1
from dataclasses import dataclass, field from typing import Optional from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser @dataclass class lowercase__ : """simple docstring""" __UpperCamelCase ...
648
from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Dict = logging.get_logger(__name__) _A : Union[str, Any] = { 'studio-ousia/luke-base': 'https://huggingface.co/studio-ousia/luke-base/resolve/main/config.json', 'studio-ousia/luke...
315
0
'''simple docstring''' import json import logging import os import re import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import datasets import numpy as np import torch import torchaudio from packaging import version from torch import nn import transform...
703
'''simple docstring''' import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from t...
399
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 ...
131
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from...
131
1
def _a ( ): '''simple docstring''' return [list(range(10_00 - i , -10_00 - i , -1 ) ) for i in range(10_00 )] SCREAMING_SNAKE_CASE__ : Tuple = generate_large_matrix() SCREAMING_SNAKE_CASE__ : List[Any] = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -...
636
import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class snake_case ( UpperCamelCase_ ): lowercase_ = ['i...
636
1
import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device from diffusers.utils...
57
'''simple docstring''' from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _UpperCAmelCase ( _lowerCamelCase : int ) -> int: _lowerCAmelCase : Any = prime_factors(_lowerCamelCase ) if is_square_free(_lowerCamelCase ): ...
384
0
"""simple docstring""" import argparse import math import traceback import dateutil.parser as date_parser import requests def snake_case__ ( __lowerCamelCase : Union[str, Any] ): """simple docstring""" lowerCamelCase__ : Dict ={} lowerCamelCase__ : Optional[int] =job["...
720
"""simple docstring""" def snake_case__ ( __lowerCamelCase : str ): """simple docstring""" return " ".join( ''''''.join(word[::-1] ) if len(__lowerCamelCase ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() ...
625
0
from ..utils import DummyObject, requires_backends class __a( metaclass=_a ): """simple docstring""" lowerCAmelCase = ['''torch''', '''torchsde'''] def __init__( self ,*_SCREAMING_SNAKE_CASE ,**_SCREAMING_SNAKE_CASE ) -> Union[str, Any]: requires_bac...
30
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __magic_name__ = logging.get_logger(__name__) __magic_name__ = { "uw-madison/mra-base-512-4": "https://huggingface.co/uw-madison/mra-base-512-4/resolve/main/config.json", } cl...
232
0
"""simple docstring""" def __magic_name__ ( lowercase , lowercase ): SCREAMING_SNAKE_CASE_: int ="""""" for word_or_phrase in separated: if not isinstance(lowercase , lowercase ): raise Exception("""join() accepts only strings to be joined""" ) ...
708
"""simple docstring""" def __magic_name__ ( lowercase = 200_0000 ): SCREAMING_SNAKE_CASE_: List[Any] =[0 for i in range(n + 1 )] SCREAMING_SNAKE_CASE_: Union[str, Any] =1 SCREAMING_SNAKE_CASE_: Optional[Any] =1 for i in range(2 , int(n**0.5 ) + 1 ): ...
36
0
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class A__ ( UpperCAmelCase_ ): UpperCAmelCase = [...
691
'''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/lice...
601
0
"""simple docstring""" from math import factorial, pi def _lowerCAmelCase ( UpperCamelCase_ , UpperCamelCase_ = 30 ): if not isinstance(UpperCamelCase_ , (int, float) ): raise ValueError("""maclaurin_sin() requires either an int or float for theta""" ...
248
"""simple docstring""" import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass # ...
248
1
'''simple docstring''' 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 lowerCAmelCase_ : Dict = datasets.utils.logging.get_logger(__name__)...
489
'''simple docstring''' import gc import random import unittest import numpy as np import torch from diffusers import ( DDIMScheduler, KandinskyVaaControlnetPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor...
489
1
from ..utils import DummyObject, requires_backends class lowercase ( metaclass=_lowerCamelCase ): lowerCamelCase_ =['transformers', 'torch', 'note_seq'] def __init__( self : Any , *__lowerCAmelCase : Any , **__lowerCAmelCase : List[str]) -> Union[str, Any]...
700
'''simple docstring''' import argparse import os import torch from transformers import FlavaConfig, FlavaForPreTraining from transformers.models.flava.convert_dalle_to_flava_codebook import convert_dalle_checkpoint def __a ( __lowerCamelCase : List[Any] ) -> Tuple: '''simple docstring''' ...
461
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a = logging.get_logger(__name__) a = { '''transfo-xl-wt103''': '''https://huggingface.co/transfo-xl-wt103/resolve/main/config.json''', } class lowercase_ ( _...
7
"""simple docstring""" from .configuration_bert_masked import MaskedBertConfig from .modeling_bert_masked import ( MaskedBertForMultipleChoice, MaskedBertForQuestionAnswering, MaskedBertForSequenceClassification, MaskedBertForTokenClassification, MaskedBertModel, ) from .modules import *
7
1
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVec...
702
'''simple docstring''' from collections.abc import Iterable from typing import Any class __UpperCAmelCase : '''simple docstring''' def __init__( self , _SCREAMING_SNAKE_CASE = None ) -> List[str]: A_ = value A_ = None #...
174
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE__ : Union[str, Any] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ : str = { "google/pix2struct-textcaps-b...
85
'''simple docstring''' import argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def A_ ( SCREAMING_SNAKE_CASE_ ) ->List[Any]: lowercase_ = [ """encoder.version""", """decoder.version""", """mo...
451
0
import os __snake_case :Tuple = {'''I''': 1, '''V''': 5, '''X''': 10, '''L''': 50, '''C''': 100, '''D''': 500, '''M''': 1000} def __snake_case ( _UpperCAmelCase ) -> Union[str, Any]: __a = 0 __a = 0 while index < len(_UpperCAmelCase ) - 1: __a...
702
import collections import gzip import os import urllib import numpy from tensorflow.python.framework import dtypes, random_seed from tensorflow.python.platform import gfile from tensorflow.python.util.deprecation import deprecated __snake_case :Optional[int] = collections.namedtuple('''_Datasets''', ['''trai...
60
0
from __future__ import annotations def lowercase__ ( A_: list[int] , A_: list[int] , A_: list[int] , A_: list[list[str]] , A_: int , ) -> None: """simple docstring""" __UpperCAmelCase =len(A_ ) ...
68
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer snake_case : List[Any] = {"""vocab_file""": """vocab.txt""", "...
545
0
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils import logging ...
709
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMSchedule...
372
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kand...
129
"""simple docstring""" def _A ( __lowercase = 10 , __lowercase = 22 ): """simple docstring""" lowerCamelCase__ = range(1 , __lowercase ) lowerCamelCase__ = range(1 , __lowercase ) return sum( ...
129
1
from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def _UpperCamelCase ( UpperCamelCase_ : bool = True , *UpperCamelCase_ : Optional[Any] , **UpperCamelCase_ : int...
365
from typing import Dict, Optional import numpy as np import datasets __snake_case : str = """ IoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union between the predicted segmentation and the ground truth. For binary (two classes) or ...
365
1
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py UpperCAmelCase_ : str = '''\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, t...
24
class UpperCAmelCase_ : """simple docstring""" def __init__( self , _a , _a , _a ) -> List[str]: _a : List[Any] = name _a : List[str] = value _a : List[str...
14
0
"""simple docstring""" from scipy.stats import pearsonr import datasets SCREAMING_SNAKE_CASE : Union[str, Any] = ''' Pearson correlation coefficient and p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. The calc...
709
"""simple docstring""" import enum import warnings from .. import MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING from ..utils import add_end_docstrings, is_tf_available from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf class _UpperCAmelCase ( ...
229
0
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_co...
58
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __SCREAMING_SNAKE_CASE ={ "configuration_mctct": ["MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MCTCTConfig"], "feature_extraction_mctct": ["MCTCTFeatureE...
425
0
from collections.abc import Callable import numpy as np def _A ( lowerCamelCase , lowerCamelCase , lowerCamelCase , lowerCamelCase , lowerCamelCase ): a__ : Any = int(np.ceil((x_end - xa) / step_size ) ) a__ : Any = np.zeros((n + 1,)...
706
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available SCREAMING_SNAKE_CASE__ : List[str] = {"""configuration_van""": ["""VAN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """VanConfig"""]} try: if not is_torch_av...
629
0
"""simple docstring""" from math import sqrt import numpy as np from sympy import symbols # Coefficient # Speed of light (m/s) _snake_case = 2_9979_2458 # Symbols _snake_case , _snake_case , _snake_case , _snake_case = symbols("ct x y z") def s...
510
"""simple docstring""" import os import sys _snake_case = os.path.join(os.path.dirname(__file__), "src") sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, Auto...
510
1
import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __A =logging.get_logger(__name__) __A ={"vocab_file": "vocab.json",...
241
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import KarrasVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class UpperCAmelCase__ ( __UpperCamelCase ): ...
241
1
import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline a__ = { '''n_samples''': 64, '''horizon''': 32, '''num_inference_steps''': 20, '''n_guide_steps''': 2, # can set to 0 for faster sampling, does not use value network ...
14
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transformers.testing_utils import DUM...
14
1
def UpperCAmelCase_ ( UpperCAmelCase__ = 1_0_0_0 ): lowercase_ = 3 lowercase_ = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 1_5 == 0: result -= a a += 1 return result if __name__ == ...
650
from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_images, to_numpy_array, valid_...
650
1
import argparse import os import torch from transformers import FlavaConfig, FlavaForPreTraining from transformers.models.flava.convert_dalle_to_flava_codebook import convert_dalle_checkpoint def SCREAMING_SNAKE_CASE ( __lowerCAmelCase ) -> int: # encoder.embeddings are double...
33
import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging if is_torch_available(...
234
0
import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.version import Version lowerCamelCase : Any = ...
713
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import logging if TYPE_CHECKIN...
649
0
'''simple docstring''' from random import randint from tempfile import TemporaryFile import numpy as np def _lowerCAmelCase ( __magic_name__ : Tuple , __magic_name__ : str , __magic_name__ : Union[str, Any] ) -> List[Any]: lowercase : Union[str, ...
92
import unittest import numpy as np import torch from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad class __SCREAMING_SNAKE_CASE ( unittest.TestCase): def UpperCAmelCase__ ( self : Any ): _UpperCAmelCase ...
684
0
'''simple docstring''' class a__ : def __init__( self ) -> str: __A = 0 __A = 0 __A = {} def _lowerCamelCase ( self , lowercase__ ) -> List[Any]: if vert...
717
import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_available, is_torch_availabl...
205
0
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/...
22
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) SCREAMING_SNAKE_CASE_ = {'''configuration_beit''': ['''BEIT_PRETRAINED_CONFIG_ARC...
373
0
"""simple docstring""" import itertools import os from collections import Counter, defaultdict from concurrent.futures import ThreadPoolExecutor, as_completed import numpy as np import datasets from .execute import check_correctness __lowercase = """\ @misc{chen2021eval...
135
"""simple docstring""" from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf fro...
135
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __magic_name__ : int = logging.get_logger(__name__) __magic_name__ : List[str] = { ...
280
from manim import * class A__ ( __snake_case ): '''simple docstring''' def _SCREAMING_SNAKE_CASE ( self : Union[str, Any] ): """simple docstring""" UpperCamelCase = Rectangle(height=0.5 ...
280
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowercase = { '''configuration_bridgetower''': [ '''BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BridgeT...
296
"""simple docstring""" from math import sqrt import numpy as np from sympy import symbols # Coefficient # Speed of light (m/s) __lowercase = 299_792_458 # Symbols __lowercase , __lowercase , __lowercase , __lowercase = symbols('''ct x y z''') def low...
296
1
from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class _lowerCamelCase ( yaml.SafeLoader ): """simple docstring""" def __SCREAMING_SNAKE_CASE ( self , __SCREAMING_SNAKE_CASE ) -> str: """simple do...
285
import inspect import unittest from transformers import YolosConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test_model...
285
1
'''simple docstring''' def __UpperCAmelCase ( SCREAMING_SNAKE_CASE__: str ) -> list: """simple docstring""" if n_term == "": return [] __a = [] for temp in range(int(SCREAMING_SNAKE_CASE__ ) ): series.append(f"""1/{temp + 1}""" if series ...
270
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCamelCase : Tuple = { """configuration_blip_2""": [ """BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP""", ...
270
1
"""simple docstring""" import importlib.metadata from typing import Union from packaging.version import Version, parse from .constants import STR_OPERATION_TO_FUNC lowercase__ = parse(importlib.metadata.version("torch")) def __magic_name__ ( _lowerCamelCase : Union[s...
581
"""simple docstring""" from __future__ import annotations import math def __magic_name__ ( _lowerCamelCase : float , _lowerCamelCase : int ): __a : Tuple = u for i in range(1 , _lowerCamelCase ): __a : List...
581
1
'''simple docstring''' import unittest from transformers import AutoTokenizer, FalconConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_m...
713
'''simple docstring''' from collections.abc import Callable def UpperCamelCase ( a , a , a ) -> float: '''simple docstring''' __magic_name__ = a __magic_name__ = b if function(a ) == 0: # one of the a or b is a root for the function ...
245
0
import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_vision, slow, torch_device f...
81
"""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, RegNetP...
134
0
def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase ): return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(__lowerCamelCase ) ) def lowerCAmelCase_ ( __lowerCamelCase...
203
import importlib.metadata import warnings from copy import deepcopy from packaging import version from ..utils import logging from .import_utils import is_accelerate_available, is_bitsandbytes_available if is_bitsandbytes_available(): import bitsandbytes as bnb import torch import torch.nn as nn fro...
203
1
'''simple docstring''' import requests __snake_case = '''YOUR API KEY''' def a ( __a , __a = giphy_api_key ) -> list: '''simple docstring''' UpperCamelCase__ :int = '''+'''.join(query.split() ) UpperCamelCase__ :Tuple = f'''https://api.gip...
189
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, ...
189
1
'''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, TestCasePlus, execu...
624
'''simple docstring''' from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, rando...
624
1
'''simple docstring''' def _A ( ): """simple docstring""" __lowercase = 0 for i in range(1 , 1001 ): total += i**i return str(A__ )[-10:] if __name__ == "__main__": print(solution())
41
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqCo...
41
1
"""simple docstring""" from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_fo...
713
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _UpperCAmelCase = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """...
36
0
from string import ascii_uppercase _lowerCAmelCase = {str(ord(c) - 55): c for c in ascii_uppercase} def _lowerCAmelCase ( _lowerCAmelCase ,_lowerCAmelCase ): '''simple docstring''' if isinstance(_lowerCAmelCase ,_lowerCAmelCase ): raise TypeError("""int() can't convert non-string...
569
import os import numpy import onnx def _lowerCAmelCase ( _lowerCAmelCase ,_lowerCAmelCase ): '''simple docstring''' A_ : List[str] = a.name A_ : int = b.name A_ : int = """""" A_ : Union[str, Any] = """""" A_ ...
569
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a= logging.get_logger(__name__) a= { '''s-JoL/Open-Llama-V1''': '''https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json''', } class __lowercase ( _lowerCamelCase ): ...
721
'''simple docstring''' import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokenization...
287
0
'''simple docstring''' import copy 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 from ..auto import CONFIG_MAPPING UpperCAmelCase_...
539
'''simple docstring''' from __future__ import annotations import csv import requests from bsa import BeautifulSoup def SCREAMING_SNAKE_CASE ( a_ : str = "" ): __a = url or 'https://www.imdb.com/chart/top/?ref_=nv_mv_250' __a = Beautiful...
539
1
'''simple docstring''' # HF Trainer benchmarking tool # # This tool can be used to run and compare multiple dimensions of the HF Trainers args. # # It then prints a report once in github format with all the information that needs to be shared # with others and second time in a console-friendly format, so it's ...
721
from __future__ import annotations from collections.abc import MutableSequence class lowerCAmelCase_ : '''simple docstring''' def __init__( self , lowerCamelCase , lowerCamelCase ): '''simple docstring''' if len(lowerCamelCase ) != degree + 1: raise V...
412
0
from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Any = logging.get_logger(__name__) a_ : int = { 'google/fnet-base': 'https://huggingface.co/google/fnet-base/resolve/main/config.json', 'google/fnet-large': 'https://huggingface.co/go...
623
from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def __lowercase( UpperCAmelCase__ = "laptop" ): """simple docstring""" lowerCamelCase = F"""https://www.amazon.in/laptop/s?k={product}""" l...
623
1
from __future__ import annotations def __snake_case ( _UpperCAmelCase ): """simple docstring""" lowercase = len(SCREAMING_SNAKE_CASE_ ) # We need to create solution object to save path. lowercase = [[0 for _ in range(SCREAM...
700
from __future__ import annotations import os from collections.abc import Mapping __magic_name__ = tuple[int, int] class a__ : """simple docstring""" def __init__( self :List[Any] , lowercase__ :set[int] , lowercase__ :Mapping[EdgeT, int] ...
314
0
def SCREAMING_SNAKE_CASE ( snake_case__ , snake_case__ , snake_case__ ) -> float: __UpperCAmelCase =(num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series return total def SCREAMING_SNAKE_CASE ( ) -> str: pri...
132
from importlib import import_module from .logging import get_logger SCREAMING_SNAKE_CASE__ : Union[str, Any] = get_logger(__name__) class UpperCAmelCase_ : def __init__( self , _lowerCAmelCase , _lowerCAmelCase=None ): UpperC...
79
0
"""simple docstring""" from ....configuration_utils import PretrainedConfig from ....utils import logging __lowerCamelCase = logging.get_logger(__name__) # TODO: upload to AWS __lowerCamelCase = { "yjernite/retribert-base-uncased": ( "https://huggingface.co/yjernite/retribert-...
190
"""simple docstring""" from pathlib import Path import fire def lowercase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> Optional[int]: __magic_name__ = Path(__UpperCamelCase ) __magic_name__ = Path(__UpperCamelCase ) dest_dir.m...
190
1
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 lowerCamelCase : Tuple = get_logger(__name__) lowerCamelCase : List[str] = r''' Args: input_ids (`jnp.ndarray` of s...
149
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, ...
149
1
import unittest from transformers import BertGenerationConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common impo...
89
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class __magic_name__ ( unittest.TestCase): ...
89
1
import os from tempfile import TemporaryDirectory from unittest import TestCase import pytest from absl.testing import parameterized from datasets import config from datasets.arrow_reader import HF_GCP_BASE_URL from datasets.builder import DatasetBuilder from datasets.dataset_dict import IterableDatasetDict fro...
569
class _UpperCAmelCase : def __init__( self , a__ , a__ ): A_ : str = name A_ : int = val def __str__( self ): return F"""{self.__class__.__name__}({self.name}, {self.val})""" def __lt__( self ...
569
1
import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transformers import glue_compute_metrics as compute...
714
def a__ ( snake_case , snake_case ): """simple docstring""" while a != 0: __SCREAMING_SNAKE_CASE, __SCREAMING_SNAKE_CASE : Any = b % a, a return b def a__ ( snake_case , snake_case ): """simple docstring""" if gcd(snake_case , sn...
131
0
'''simple docstring''' import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase : Optional[int] = logging.get_logger(__name__) lowerC...
444
'''simple docstring''' def lowerCAmelCase_ ( _lowerCamelCase: list ): if len(_lowerCamelCase ) <= 1: return [tuple(_lowerCamelCase )] __SCREAMING_SNAKE_CASE : Optional[int] = [] def generate(_lowerCamelCase: int , _lowerCamelCase: list ): __SCREAMI...
578
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A_ : List[Any] =logging.get_logger(__name__) A_ : Any ={ '''camembert-...
606
'''simple docstring''' import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def snake_case_ ...
606
1
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.utils import logging logging.set_verbosity...
39
import collections import importlib.util import os import re from pathlib import Path snake_case__ : Optional[int] = '''src/transformers''' # Matches is_xxx_available() snake_case__ : Union[str, Any] = re.compile(R'''is\_([a-z_]*)_available()''') # Catches a o...
392
0
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils impor...
714
def __UpperCamelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ): """simple docstring""" if index == r: for j in range(_lowerCAmelCase ): print(data[j] , end=" " ) print(" " ) ...
405
0
from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class _a ( UpperCamelCase__ ): def __init__( self: int , U...
43
class _a : def __init__( self: Tuple , UpperCamelCase_: Dict ) -> List[str]: """simple docstring""" lowercase__ = val lowercase__ = None lowercase__ = None def lowerCamelCase_ ( ...
43
1
'''simple docstring''' import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() lowerCAmelCase: Optio...
718
'''simple docstring''' import unittest import numpy as np from transformers import BertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available()...
195
0
'''simple docstring''' import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import List import timm import torch import torch.nn as nn from huggingface_hub import hf_hub_download from torch import Tensor from transformers import ...
447
'''simple docstring''' def lowerCamelCase__ ( SCREAMING_SNAKE_CASE : List[Any] , SCREAMING_SNAKE_CASE : Union[str, Any] ): # "extended trapezoidal rule" # int(f) = dx/2 * (f1 + 2f2 + ... + fn) UpperCAmelCase = (boundary[1] - boundary[0]) / steps UpperCAmelCase = ...
447
1
import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration A : Tuple = 50000 A : Optional[int] = 5000 A , A : Dict = os.path.split(__file__) A : Tuple ...
473
import os from datetime import datetime as dt from github import Github A : Union[str, Any] = [ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def _lowe...
473
1
import pytest _lowerCamelCase : Dict = '''__dummy_dataset1__''' _lowerCamelCase : Optional[int] = ''' import json import os import datasets REPO_URL = "https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/" URLS = {"train": REPO_URL + "wikiann-bn-tr...
686
import random def a_ ( __lowercase : str , __lowercase : Any , __lowercase : Any ) -> Optional[Any]: _snake_case = a[left_index] _snake_case = left_index + 1 for j in range(left_index + 1 , __lowercase ): if a[j] ...
686
1
'''simple docstring''' # Copyright 2023 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/LI...
324
'''simple docstring''' import ast import os import re import shutil import tempfile import unittest from unittest import mock import torch from accelerate.test_utils.examples import compare_against_test from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command, s...
324
1
from __future__ import annotations from random import choice def _A ( lowerCamelCase ): return choice(lowerCamelCase ) def _A ( lowerCamelCase , lowerCamelCase ): a__ : List[str] = random_pivot(lowerCamelCase ) # partition based on pivot # linear time a__ ...
112
import pickle import numpy as np from matplotlib import pyplot as plt class __lowerCAmelCase : def __init__( self , snake_case , snake_case , snake_case , snake_case , snake_case , snake_case=0.2 , snake_case=0.2 ...
112
1
'''simple docstring''' import unittest import numpy as np from transformers import MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING, TF_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING from transformers.pipelines import AudioClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test,...
702
'''simple docstring''' import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor UpperCAmelCase = logging.get_logger(__name__) class __snake_case( _lowerCAmelCase ): '''simple docstring''' def __init__( ...
344
0
import inspect from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusio...
67
# Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config # - generate model_cards - usefu...
290
0
'''simple docstring''' def a ( __a = 1000 ) -> int: '''simple docstring''' return sum(2 * a * ((a - 1) // 2) for a in range(3 , n + 1 ) ) if __name__ == "__main__": print(solution())
280
'''simple docstring''' from __future__ import annotations import csv import requests from bsa import BeautifulSoup def a ( __a = "" ) -> dict[str, float]: '''simple docstring''' UpperCamelCase__ :Optional[Any] = url or '''https://www.imdb.com/chart/top/?r...
280
1
from abc import ABC, abstractmethod from argparse import ArgumentParser class __lowercase ( snake_case__ ): @staticmethod @abstractmethod def _lowercase ( __lowerCamelCase : ArgumentParser ) -> Union[str, Any]: ...
377
from manim import * class lowercase ( snake_case__): """simple docstring""" def _SCREAMING_SNAKE_CASE ( self : List[Any] ) -> Union[str, Any]: UpperCAmelCase_= Rectangle(height=0.5 , width=0.5 ) UpperCAmelCase_= Rectangle(height=0.25 , w...
593
0
def A__ ( _a : str ): '''simple docstring''' snake_case__ : Union[str, Any] ="""""" for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def A__ ( _a : str ): '''simple ...
720
import numpy as np # Importing the Keras libraries and packages import tensorflow as tf from tensorflow.keras import layers, models if __name__ == "__main__": # Initialising the CNN # (Sequential- Building the model layer by layer) __lowerCamelCase : str = models.Sequential() ...
448
0
from pickle import UnpicklingError import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict from ..utils import logging lowerCamelCase : Union[str, Any] = logging.get_logger(__name__) def __lowerCAme...
367
from __future__ import annotations def __lowerCAmelCase ( __snake_case ): __lowerCAmelCase = len(__snake_case ) # We need to create solution object to save path. __lowerCAmelCase = [[0 for _ in range(__snake_case )] for _ in range(...
367
1
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from ...test_modeling_common i...
1
import argparse import os import re import numpy as np import PIL import torch from timm import create_model from torch.optim.lr_scheduler import OneCycleLR from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, RandomResizedCrop, Resize, ToTensor from accelerate import Acceler...
1
1
"""simple docstring""" import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor...
610
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase ) -> tuple[int, int]: """simple docstring""" try: lowerCAmelCase_ : Tuple = float(__UpperCamelCase ) except ValueError: raise ValueError("Please enter a valid number" ) lowerCAmelCa...
610
1
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner import Split, Tok...
582
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from datasets.u...
582
1
'''simple docstring''' from functools import lru_cache @lru_cache def _A ( A ) -> int: if num < 0: raise ValueError("Number should not be negative." ) return 1 if num in (0, 1) else num * factorial(num - 1 ) if __name__ == "__main__": import doctest doctest.testmod...
372
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCAmelCase : Dict = {"""configuration_van""": ["""VAN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """VanConfig"""]} try: if not is_to...
372
1
"""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...
91
"""simple docstring""" from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowerCamelCase__ ( UpperCAmelCase_ ): lowerCAmelCase = """ClapFeatureExtractor""" lowerCAmelCase = ("""RobertaTokenizer""", """RobertaToken...
91
1
"""simple docstring""" import warnings from .state import AcceleratorState, GradientState warnings.filterwarnings('ignore', category=UserWarning, module='torch.optim.lr_scheduler') class _UpperCAmelCase : '''simple docstring''' def __init__( self , A , A , A = True...
506
"""simple docstring""" from math import factorial def SCREAMING_SNAKE_CASE__ ( SCREAMING_SNAKE_CASE__ : int = 2_0 ): """simple docstring""" snake_case_ : int = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,......
480
0
from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils import stable_softmax if is_to...
706
lowercase_ = {str(digit): digit**5 for digit in range(10)} def __lowerCAmelCase ( __SCREAMING_SNAKE_CASE : int ): '''simple docstring''' return sum(DIGITS_FIFTH_POWER[digit] for digit in str(__SCREAMING_SNAKE_CASE ) ) def __lowerCAmelCase ...
390
0
'''simple docstring''' import itertools import math def _snake_case ( A ) -> bool: if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even n...
90
"""simple docstring""" from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_vision_available(): from PIL import Image from ..image_utils import load...
553
0
from __future__ import annotations import unittest from transformers import DebertaVaConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_at...
143
import enum import warnings from .. import MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING from ..utils import add_end_docstrings, is_tf_available from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf class __lowercase ( enum.Enum ...
143
1
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils impor...
395
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta.tokenization_ta import TaToke...
395
1
'''simple docstring''' import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokeniza...
187
'''simple docstring''' import logging import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import librosa import torch from datasets import DatasetDict, load_dataset from packaging import version from torch import nn from transformers import ( HfArgum...
187
1
import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weights from .dataclasses import BnbQua...
613
import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_vision, slow, torch_devic...
504
0
import importlib import os import sys # This is required to make the module import works (when the python process is running from the root of the repo) sys.path.append(".") def _lowerCamelCase ( _a ): """simple docstring""" _lowerCamelCase = test_file.split(os.path.sep ) if c...
720
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "facebook/xmod-base": "https://huggingface.co/faceb...
297
0
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class __a ( __magic_name__ ): """simple docstring""" @staticmethod @abstractmethod def SCREAMING_SNAKE_CASE_ ( snake_case ): """simple docstrin...
453
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta.toke...
453
1
def _lowerCAmelCase ( ): """simple docstring""" __SCREAMING_SNAKE_CASE : str = 0 for i in range(1 , 1001 ): total += i**i return str(__lowerCamelCase )[-10:] if __name__ == "__main__": print(solution())
447
from abc import ABC, abstractmethod from typing import Optional, Union from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit from ..utils.typing import NestedDataStructureLike, PathLike class _SCREAMING_SNAKE_CASE (UpperCamelCase ): def __init__( sel...
447
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): A__ : str = '''bert-generation''' def __init__( self : Tuple , __lowerCamelCase : Optional[int]=5_0_3_5_8 ...
103
import math from collections.abc import Iterator from itertools import takewhile def UpperCamelCase__ ( _A: int ): '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: ...
479
0
"""simple docstring""" def snake_case ( UpperCamelCase__ : int ) -> Dict: lowerCamelCase : int = generate_pascal_triangle(UpperCamelCase__ ) for row_idx in range(UpperCamelCase__ ): # Print left spaces for _ in range(num_rows - r...
705
"""simple docstring""" 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_atten...
42
0
'''simple docstring''' from collections.abc import Sequence from queue import Queue class a_ : def __init__( self : Union[str, Any] , __lowerCAmelCase : str , __lowerCAmelCase : Optional[int] , __lowerCAmelCase : List[str] , __lowerCAmelCase ...
356
'''simple docstring''' from collections import defaultdict def lowerCamelCase__ ( a , a ): __snake_case = first_str.lower().strip() __snake_case = second_str.lower().strip() # Remove whitespace __snake_case = first_str.replace(' ' , '' ...
356
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a_ = logging.get_logger(__name__) a_ = { '''facebook/dpr-ctx_encoder-single-nq-base''': ( '''https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base/resolve/main/config.js...
48
"""simple docstring""" import json import multiprocessing as mp import re from collections import defaultdict from functools import partial from typing import Dict, List, Optional, Set, Tuple, Type from datasets import Dataset from datasketch import MinHash, MinHashLSH from dpu_utils.utils.iterators import Thread...
48
1