code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
def UpperCamelCase ( __lowerCamelCase : int , __lowerCamelCase : list[int] , __lowerCamelCase : int ): def count_of_possible_combinations(__lowerCamelCase : int ) -> int: if target < 0: return 0 if target == 0:...
59
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, ) __lowerCamelCase = {"""configuration_xglm""": ["""...
59
1
'''simple docstring''' from __future__ import annotations import math def __lowerCamelCase ( __snake_case : list, __snake_case : list ) -> list: """simple docstring""" if len(__snake_case ) != 2 or len(a[0] ) != 2 or len(__snake_case ) != 2 or len(b[0] ) != 2: ...
136
'''simple docstring''' import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings.warn(e) warnings.warn( 'The con...
136
1
'''simple docstring''' import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging.INFO) a : ...
56
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow ...
56
1
'''simple docstring''' from __future__ import annotations class lowerCAmelCase_ : '''simple docstring''' def __init__( self : str , _UpperCAmelCase : int ): """simple docstring""" UpperCAmelCase__ = data UpperCAmelCase__ ...
61
'''simple docstring''' import enum import shutil import sys UpperCAmelCase_ , UpperCAmelCase_ = shutil.get_terminal_size() UpperCAmelCase_ = {'UP': 'A', 'DOWN': 'B', 'RIGHT': 'C', 'LEFT': 'D'} class lowerCAmelCase_ ( enum.Enum ): '''simple docstring''' lowerCAme...
61
1
"""simple docstring""" import builtins import sys from ...utils.imports import _is_package_available from . import cursor, input from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor from .keymap import KEYMAP _snake_case = ...
294
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class A_ : '''simple docstring''' pass
61
0
from __future__ import annotations def _snake_case( SCREAMING_SNAKE_CASE__ : Optional[Any] , SCREAMING_SNAKE_CASE__ : List[Any] , SCREAMING_SNAKE_CASE__ : Optional[int] , SCREAMING_SNAKE_CASE__ : List[str] ) -> int: # noqa: E741 ...
360
from collections.abc import Sequence def _snake_case( SCREAMING_SNAKE_CASE__ : Sequence[int] | None = None ) -> int: '''simple docstring''' if nums is None or not nums: raise ValueError('Input sequence should not be empty' ) A__ ...
282
0
import asyncio import os import re import sys import tempfile import unittest from contextlib import contextmanager from copy import deepcopy from distutils.util import strtobool from enum import Enum from importlib.util import find_spec from pathlib import Path from unittest.mock import patch import pyarrow as pa...
257
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import Config...
257
1
def __lowerCamelCase ( __a :int = 1_0_0 ) -> int: """simple docstring""" A__ = n * (n + 1) * (2 * n + 1) / 6 A__ = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__main__": print(F'''{so...
368
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __lowerCamelCase ( __a :int ) -> int: """simple docstring""" A__ = prime_factors(__a ) if is_square_free(__a ): return -1 if l...
276
0
"""simple docstring""" import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem SCREAMING_SNAKE_CASE : Union[str, Any] = importlib.util.find_spec("""s3fs""") is not None ...
102
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch ...
343
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowerCAmelCase = { '''configuration_roberta''': ['''ROBERT...
107
'''simple docstring''' import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.au...
107
1
'''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 functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'microsoft/unispeech-large-1500h-cv': ( 'https://huggingface.co/microsoft/unispe...
353
from __future__ import annotations import os from collections.abc import Mapping _lowerCamelCase = tuple[int, int] class a : '''simple docstring''' def __init__( self : str , __snake_case : set[int] , __snake_case ...
177
0
"""simple docstring""" import string import numpy def lowercase ( A_ , A_ )-> int: '''simple docstring''' return b if a == 0 else greatest_common_divisor(b % a , A_ ) class _A : """simple docstring""...
40
"""simple docstring""" __lowercase = { """Pillow""": """Pillow<10.0.0""", """accelerate""": """accelerate>=0.20.3""", """av""": """av==9.2.0""", """beautifulsoup4""": """beautifulsoup4""", """black""": """black~=23.1""", """codecarbon""": """codecarbon==1....
40
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _lowerCamelCase = { """configuration_vision_text_dual_encoder""": ["""VisionTextDualEncoderConfig""...
352
# This model implementation is heavily inspired by https://github.com/haofanwang/ControlNet-for-Diffusers/ 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 dif...
177
0
'''simple docstring''' from __future__ import annotations import csv import requests from bsa import BeautifulSoup def __UpperCAmelCase ( a_: str = "" ): _UpperCAmelCase : List[str] = url or "https://www.imdb.com/chart/top/?ref_=nv_mv_250" _UpperCAmelCase : Unio...
145
"""simple docstring""" def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: str ) -> List[str]: '''simple docstring''' assert x is not None assert y is not None __lowerCamelCase : Optional[int] = len(_lowerCamelCase ...
135
0
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class __a ( lowerCAmelCase__ ): @staticmethod @abstractmethod def snake_case_ ( a__ ): raise NotImplementedError() @abstractmethod def ...
353
"""simple docstring""" import mpmath # for roots of unity import numpy as np class __a : def __init__( self , a__=None , a__=None ): # Input as list _lowerCamelCase = list(poly_a or [0] )[:] _lowerCamelCase = list(p...
80
0
"""simple docstring""" import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py _a = 'src/diffusers' # Matches is_xxx_available() _a = re.compile(R'is\_([a-z_]*)_avai...
61
"""simple docstring""" def __a ( __lowerCamelCase = 3, __lowerCamelCase = 7, __lowerCamelCase = 100_0000 ): UpperCAmelCase_ : Dict = 0 UpperCAmelCase_ : List[Any] = 1 for current_denominator in range(1, limit + 1 ): UpperCAmelCase_ : Dict ...
61
1
from __future__ import annotations import inspect import unittest from math import floor import numpy as np from transformers import CvtConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_avail...
148
import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigT...
148
1
import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel a_ = logging.getLogger(__name__) def _...
340
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class lowercase__ ( _UpperCAmelCase ): a_ ...
340
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCamelCase : str = { "configuration_deberta": ["DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP", "DebertaConfig", "Deber...
356
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowerCamelCase : Optional[Any] = { "configuration_conditional_detr": [ "CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP", "ConditionalDetrConfig",...
159
0
import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": __a = argparse.ArgumentParser() parser.add_argument('--dump_path', default=None, type=str, require...
30
'''simple docstring''' A__: Optional[int] = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] A__: Any = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] A__: int = { 0: '''Sunday''', 1: '''Monday''', 2: '''Tuesday''', 3: '''Wednesday''', 4: '''T...
276
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 PIL import Image...
359
import unittest from transformers import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device if is_torch_available(): import torch from transformers import AutoModelForImageClassification if is_vision_available(): from tr...
200
0
from __future__ import annotations def __magic_name__ ( A : list ): '''simple docstring''' if len(A ) == 0: return [] a , a = min(A ), max(A ) a = int(max_value - min_value ) + 1 a = [[] for _ in range(A )] for i in my_list: ...
107
from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelerate.test_utils import Re...
107
1
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_MAPPING from ...
148
import random from typing import Any def _A ( SCREAMING_SNAKE_CASE : list ): """simple docstring""" for _ in range(len(SCREAMING_SNAKE_CASE ) ): a__ : Tuple =random.randint(0 , len(SCREAMING_SNAKE_CASE ) - 1 ) a__ : Any =ra...
148
1
from __future__ import annotations UpperCAmelCase__ = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] UpperCAmelCase__ = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def _a ( a :list[float] ) -> list[float]: a = [] a = ...
0
"""simple docstring""" from collections.abc import Sequence def SCREAMING_SNAKE_CASE__ ( __UpperCAmelCase , __UpperCAmelCase = False ) -> float: if not arr: return 0 lowercase__: Any = 0 if allow_empty_subarrays else float('''-inf''' ) lowercase__: Union[str, Any] ...
177
0
'''simple docstring''' import argparse import collections import json import os import re import string import sys import numpy as np __UpperCAmelCase =re.compile(R"\b(a|an|the)\b", re.UNICODE) __UpperCAmelCase =None def __lowerCAmelCase ( ) -> Union[str, Any]: __lo...
237
'''simple docstring''' from bisect import bisect from itertools import accumulate def __lowerCAmelCase ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ ) -> str: __lowerCamelCase = sorted(zip(UpperCamelCase__ , UpperCamelCase__ ) ...
237
1
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.uti...
43
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from .....
177
0
"""simple docstring""" from math import factorial def lowerCAmelCase (__UpperCamelCase : int = 1_0_0 ): """simple docstring""" return sum(map(__UpperCamelCase , str(factorial(__UpperCamelCase ) ) ) ) if __name__ == "__main__": print(solution(int(input('''Enter the Number:...
85
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowercase = { '''configuration_conditional_detr''': [ '''CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''C...
85
1
_SCREAMING_SNAKE_CASE = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100_000)] def snake_case ( snake_case__ :Optional[int]) -> int: _A = 0 while number: # Increased Speed Slightly by checking every 5 digits together. ...
180
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
80
0
'''simple docstring''' __UpperCAmelCase ={ 0: "0", 1: "1", 2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", 1_0: "a", 1_1: "b", 1_2: "c", 1_3: "d", 1_4: "e", 1_5: "f", } def __lowerCAmelCase ( UpperCamelCase__ ...
237
'''simple docstring''' import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class a__ ( UpperCAmelCase__ , UpperCAmelCase__ ): @register_to_config def __init__( self : Any , *, ...
237
1
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_mo...
148
"""simple docstring""" import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available...
148
1
'''simple docstring''' import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def SCREAMING_SNAKE_CASE__ ( snake_case : Dict ) -> Tuple: """simple docstring""" def wrappe...
345
'''simple docstring''' from typing import Dict, Iterable, 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, resize, ...
345
1
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def lowercase_ ( _lowerCamelCase : int): lowercase__ : Dict = int(number**0.5) return number == sq * sq def lowercase_ ( _lowerCamelCase : int , _lowerCa...
87
import argparse import collections import json from pathlib import Path import requests import torch import yaml from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTImageProcessor, MobileViTVaConfig, MobileViTVaForImageClassification, ...
159
0
"""simple docstring""" import unittest import numpy as np import torch from diffusers import DDIMPipeline, DDIMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, slow, torch_device from ..pipeline_params import UNCONDITIONAL_IMAGE_GENERATION_BATCH_PARAM...
350
"""simple docstring""" import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( "The `image_to_image.py` script is outdated. Please use directly `from diffusers import" " StableDiffusionImg2ImgPipeline` instead." )
2
0
import os def A ( ) -> List[Any]: with open(os.path.dirname(a_ ) + '/grid.txt' ) as f: __UpperCamelCase : str =[] # noqa: E741 for _ in range(20 ): l.append([int(a_ ) for x in f.readline()....
71
'''simple docstring''' def snake_case_ ( SCREAMING_SNAKE_CASE__ ): """simple docstring""" _SCREAMING_SNAKE_CASE : int = 0 while len(SCREAMING_SNAKE_CASE__ ) > 1: _SCREAMING_SNAKE_CASE : Any = 0 # Consider two files with minimum...
200
0
'''simple docstring''' from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __lowerCamelCase ( lowerCAmelCase_ ) -> int: _a : Union[str, Any] = prime_factors(lowerCAmelCase_ ) if is_square_free(lowerCAmelCase_ ): return ...
352
'''simple docstring''' import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from transformers i...
107
0
"""simple docstring""" from collections import namedtuple __A = namedtuple("from_to", "from_ to") __A = { "cubicmeter": from_to(1, 1), "litre": from_to(0.001, 1_000), "kilolitre": from_to(1, 1), "gallon": from_to(0.00_454, 264.172), "cubicyard": from_t...
148
"""simple docstring""" from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf __A ...
148
1
from __future__ import annotations from math import pi def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ) -> dict[str, float]: if (inductance, frequency, reactance).count(0 ) != 1: raise ValueError('One and only one argument must be ...
45
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder _UpperCAmelCase : Any = datasets.utils.logging.get_logger(__name__) class lowerCAmelCase ( folder_based_builder.FolderBasedBuilderConfig...
45
1
'''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 __lowerCAmelCase : List[Any] ...
237
'''simple docstring''' from __future__ import annotations def UpperCamelCase ( _lowerCamelCase : list[int | str] ): create_state_space_tree(_lowerCamelCase , [] , 0 , [0 for i in range(len(_lowerCamelCase ) )] ) def ...
237
1
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before toke...
370
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class lowerCAmelCase_ ( unittest.TestCase ): UpperCAmelCase__ : Union[str, Any] = JukeboxTokenizer UpperCAmelCase__ : Optional[int] = { ...
103
0
'''simple docstring''' import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin _SCREAMING_SNAKE_CASE : List[Any] = "\nHugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company...
85
'''simple docstring''' import os _SCREAMING_SNAKE_CASE : int = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000} def UpperCamelCase_( snake_case : str ): '''simple docstring''' snake_case_ = 0 snake_case_ = ...
85
1
'''simple docstring''' from __future__ import annotations def lowerCamelCase (_SCREAMING_SNAKE_CASE : list[float] , _SCREAMING_SNAKE_CASE : Tuple ): print(F"""Vertex\tShortest Distance from vertex {src}""" ) for i, d in enumerate(_SCREAMING_SNAKE_CASE ...
294
'''simple docstring''' from __future__ import annotations from dataclasses import dataclass @dataclass class __UpperCamelCase : A_ = 42 A_ = None A_ = None def lowerCamelCase (_SCREAMING_SNAKE_CASE : TreeNode | None ): # Val...
294
1
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")): raise OptionalDependencyNotAvailable() ...
36
'''simple docstring''' 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...
237
0
"""simple docstring""" def SCREAMING_SNAKE_CASE__ ( )-> int: '''simple docstring''' return [ a * b * (1000 - a - b) for a in range(1 , 999 ) for b in range(snake_case , 999 ) if (a * a + b * b == (1000 - a - b) ** 2) ...
298
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .sche...
298
1
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_download, hf_hub_url from PIL import Image from transformers import DetaConfig, DetaForObjectDetection, DetaImageProcessor, SwinConfig from transformers.utils import logging l...
259
import inspect import unittest from transformers import DPTConfig from transformers.file_utils import is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_commo...
259
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available snake_case_ = { """configuration_tapas""": ["""TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TapasConfig"""], """tokenization_...
353
"""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, UNetaDCond...
181
0
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging a_ = logging.get_logger(__name__) def a__ ( _UpperCamelCase : int ,_UpperCamelCase : List[Any] ): __lowerCamelCase = ...
330
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase : int = logging.get_logger(__name__) lowerCamelCase : List[Any] = { 'google/realm-cc-news-pretrained-embedder': ( 'https://huggingface.co/google/realm-c...
2
0
"""simple docstring""" import math from collections.abc import Iterator from itertools import takewhile def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: ...
365
"""simple docstring""" import random def _lowerCamelCase ( _UpperCamelCase , _UpperCamelCase , _UpperCamelCase = False ): '''simple docstring''' __lowerCAmelCase = {i: [] for i in range(_UpperCamelCase )} # if probability is greater or equal than 1, then generate a co...
259
0
from __future__ import annotations def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = [] lowercase__ , lowercase__ = input_list[low...
110
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __lowerCAmelCase : str = logging.get_logger(__name__) __lowerCAmelCase : Dict = {...
107
0
import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class _lowerCamelCase ( UpperCamelCase ): """simple docstring""" @require_torch def _snake_case ( sel...
65
from collections import deque from .hash_table import HashTable class _lowerCamelCase ( UpperCamelCase ): """simple docstring""" def __init__( self , *_SCREAMING_SNAKE_CASE , **_SCREAMING_SNAKE_CASE )->str: '''simple docstring''' super().__ini...
65
1
"""simple docstring""" import argparse import gc import json import os import re import torch from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedTokenizerFast, RwkvConfig from transformers.modeling_utils import WEIGHTS_INDEX_NAM...
45
"""simple docstring""" import math def lowercase ( lowerCAmelCase__ : list , lowerCAmelCase__ : int ) -> int: __a = len(lowerCAmelCase__ ) __a = int(math.floor(math.sqrt(lowerCAmelCase__ ) ) ) __a = 0 while arr...
45
1
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...
355
def __lowercase ( _SCREAMING_SNAKE_CASE = 1 , _SCREAMING_SNAKE_CASE = 10_00 ) -> int: '''simple docstring''' SCREAMING_SNAKE_CASE = 1 SCREAMING_SNAKE_CASE = 0 for divide_by_number in range(_SCREAMING_SNAKE_CASE , dig...
193
0
'''simple docstring''' def A__ ( UpperCAmelCase_ , UpperCAmelCase_ ): return price * (1 + tax_rate) if __name__ == "__main__": print(F"""{price_plus_tax(100, 0.25) = }""") print(F"""{price_plus_tax(1_25.50, 0.05) = }""")
83
# Lint as: python3 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 A__ : Tuple ...
103
0
import argparse from collections import defaultdict import yaml lowercase : Union[str, Any] = 'docs/source/en/_toctree.yml' def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : Tuple) -> Tuple: '''simple docstring''' __UpperCamelCase : ...
151
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import BatchEncoding, PreTrainedTokenizer from ...utils import logging lowercase : Dict = logging.get_logge...
151
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) _snake_case = { 'configuration_perceiver': ['PERCEIVER_...
294
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) _snake_case = { 'configuration_perceiver': ['PERCEIVER_...
294
1
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) class lowerCAmelCase_ ( lowerCamelCase__ ): '''simple docstring''' __snake_case = "encoder-decoder" __snake_case = True def...
368
import os def __lowerCAmelCase ()-> List[Any]: """simple docstring""" snake_case_ = os.path.join(os.path.dirname(SCREAMING_SNAKE_CASE ) , '''num.txt''' ) with open(SCREAMING_SNAKE_CASE ) as file_hand: return str(sum(int(SCREAMING_SNAKE_CASE ) for line in file_hand ) )[...
267
0
"""simple docstring""" import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) __magic_name__ = { "sample_size": 32, "in_channels": 3, "out_channels": 3, "layers_per_block": 2, "num_class_em...
100
'''simple docstring''' import unittest from diffusers import FlaxAutoencoderKL from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): import jax @require_flax class l...
267
0
def _lowercase ( _UpperCAmelCase ) -> int: assert ( isinstance(_UpperCAmelCase , _UpperCAmelCase ) and number_of_steps > 0 ), F"""number_of_steps needs to be positive integer, your input {number_of_steps}""" if number_of_steps == 1: return 1 lowerCamelCase , ...
262
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mobilebert import MobileBertTokenizer UpperCAmelCase__ : Optional[int] =logging.get_logger(__name__) ...
262
1
'''simple docstring''' import pytest import datasets # Import fixture modules as plugins a : Optional[int] = ['tests.fixtures.files', 'tests.fixtures.hub', 'tests.fixtures.fsspec'] def __magic_name__ ( __UpperCAmelCase, __UpperCAmelCase ) -> Optional[int]: '''simple docstrin...
56
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelC...
181
0
"""simple docstring""" # Copyright 2021 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...
364
import math import unittest def a__ ( A__ ): assert isinstance(A__, A__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3...
162
0
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { '''xlnet-base-cased''': '''https://huggingface.co/xlnet-base-cased/resolve/main/confi...
319
import sys def _A ( SCREAMING_SNAKE_CASE__ : List[str] ): UpperCamelCase :Any = len(SCREAMING_SNAKE_CASE__ ) UpperCamelCase :Any = [[0 for x in range(SCREAMING_SNAKE_CASE__ )] for x in range(SCREAMING_SNAKE_CASE__ )] UpperCamelCase ...
259
0
"""simple docstring""" import argparse import os import re _A = 'src/transformers' # Pattern that looks at the indentation in a line. _A = re.compile(r'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. _A = re.compile(r'^\s*"([^"]+)":') # Pattern that matches ...
353
"""simple docstring""" 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 .util...
205
0
import qiskit def lowerCAmelCase_ ( __A, __A ) -> qiskit.result.counts.Counts: '''simple docstring''' UpperCAmelCase__ = qiskit.Aer.get_backend("aer_simulator" ) UpperCAmelCase__ = qiskit.QuantumCircuit(4, 2 ) # e...
65
import math def lowerCAmelCase_ ( __A ) -> bool: '''simple docstring''' return math.sqrt(__A ) * math.sqrt(__A ) == num def lowerCAmelCase_ ( __A ) -> bool: '''simple docstring''' UpperC...
65
1
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() A : str = logging.get_logger(__name__) A : Any = { 'post_extract_proj': 'feature_projection.projec...
33
from __future__ import annotations def __lowerCAmelCase ( a__ , a__ = None ) -> list[list[str]]: __a = word_bank or [] # create a table __a = len(a__ ) + 1 __a = [] for _ in range(a__ ): table.append([] ) # seed value...
33
1
from __future__ import annotations def a__ ( __UpperCamelCase , __UpperCamelCase ): SCREAMING_SNAKE_CASE_ = sorted(numsa + numsa ) SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ = divmod(len(UpperCamelCase__ ) , 2 ) if mod == 1: return a...
118
import unittest from transformers import AutoConfig, AutoTokenizer, BertConfig, TensorType, is_flax_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, slow if is_flax_available(): import jax from transformers.models.auto.modeling_flax_auto imp...
193
0
'''simple docstring''' import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class a__ ( pl.LightningModule ): '''simple docstring''' ...
228
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, TimestepE...
228
1
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py lowercase__ = "\\n@INPROCEEDINGS{Papineni02bleu:a,\n author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu},\n title = {B...
151
'''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 U...
151
1
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def SCREAMING_SNAKE_CASE ( lowercase_ ) -> bool: """simple docstring""" A__ = int(number**0.5 ) return number == sq * sq def SCREAMING_SNAKE_CASE ( lowe...
231
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 UpperCamelCase_ ( unittest.TestCase ): '''simple docstring...
231
1
"""simple docstring""" import re from filelock import FileLock try: import nltk lowerCamelCase_ = True except (ImportError, ModuleNotFoundError): lowerCamelCase_ = False if NLTK_AVAILABLE: with FileLock('''.lock''') as lock: nltk.download('''punkt''', quiet=True) def ...
268
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, log...
268
1
import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from transformers.util...
361
def __snake_case ( _UpperCAmelCase = 1000000 ): __a = limit + 1 __a = [0] * limit for first_term in range(1 , _UpperCAmelCase ): for n in range(_UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): __a = first...
131
0
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_MAPPING fro...
306
# 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/LICENSE-2.0 # # Unless...
306
1
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, ) if is_onnx_available(): import onnxruntime as ort ...
355
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvail...
18
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __A : List[str] = { '''configuration_mobilenet_v2''': [ '''MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP'...
33
'''simple docstring''' from __future__ import annotations class A__ : def __init__( self , UpperCamelCase__=None ) -> Any: '''simple docstring''' A_ = data A_ = None def __repr__( self ) -> List[str]:...
162
0
import gc import importlib.metadata import tempfile import unittest from packaging import version from transformers import ( AutoModel, AutoModelForCausalLM, AutoModelForSeqaSeqLM, AutoModelForSequenceClassification, AutoTokenizer, BitsAndBytesConfig, pipeline, ...
292
from abc import ABC, abstractmethod from argparse import ArgumentParser class _lowerCAmelCase( UpperCAmelCase_ ): """simple docstring""" @staticmethod @abstractmethod def _a ( _lowerCamelCase ): raise NotImplemen...
292
1
"""simple docstring""" from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class _snake_case : snake_case__ = 42 snake_case__ = 42 class _snake_case : def __init__( ...
135
import os def a ( ) -> Any: """simple docstring""" with open(os.path.dirname(A__ ) + '/p022_names.txt' ) as file: _lowercase =str(file.readlines()[0] ) _lowercase =names.replace('"' , '' ).split(',' ...
205
0
from argparse import ArgumentParser from .env import EnvironmentCommand def a ( ): """simple docstring""" UpperCamelCase : Any = ArgumentParser('''Diffusers CLI tool''' , usage='''diffusers-cli <command> [<args>]''' ) ...
315
def a ( SCREAMING_SNAKE_CASE_ : list[list[float]] ): """simple docstring""" UpperCamelCase : list[list[float]] = [] for data in source_data: for i, el in enumerate(SCREAMING_SNAKE_CASE_ ): i...
315
1
"""simple docstring""" import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup __A : Tuple = { '''User-Agent''': '''Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36''' ''' (KHTML, like Gecko) Chrome...
33
"""simple docstring""" import argparse import os import re import packaging.version __A : List[str] = '''examples/''' __A : int = { '''examples''': (re.compile(R'''^check_min_version\("[^"]+"\)\s*$''', re.MULTILINE), '''check_min_version("VERSION")\n'''), ...
33
1
import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __magic_name__ = ...
152
import logging import os import sys from pathlib import Path from unittest.mock import patch from parameterized import parameterized from run_eval import run_generate from run_eval_search import run_search from transformers.testing_utils import CaptureStdout, TestCasePlus, slow from utils import RO...
152
1
import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debug.metrics as met class __lowerC...
228
import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() __UpperCamelCase : List[str...
228
1
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 snake_case_ ( __lowercase ): def __init__( ...
368
from datetime import datetime import requests def _SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE :str ) -> bytes: __lowerCAmelCase : List[Any] = """https://downloadgram.net/wp-json/wppress/video-downloader/video?url=""" __lowerCAmelCase : Dict = requests.get(b...
232
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _A = logging.get_logger(__name__) _A = {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"} class _lowerCAmelCase ( __a ): _lowercase ='''openai-gpt''' _lowercase ={ ...
231
import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_t...
231
1
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformer...
360
"""simple docstring""" import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ...test_mod...
254
0
import logging import os from dataclasses import dataclass from typing import List, Optional, Union import tqdm from filelock import FileLock from transformers import ( BartTokenizer, BartTokenizerFast, DataProcessor, PreTrainedTokenizer, RobertaTokenizer, RobertaTo...
29
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 lowerCamelCase = collections.namedtuple('''_Datasets''', ['''trai...
131
0
from .configuration_bert_masked import MaskedBertConfig from .modeling_bert_masked import ( MaskedBertForMultipleChoice, MaskedBertForQuestionAnswering, MaskedBertForSequenceClassification, MaskedBertForTokenClassification, MaskedBertModel, ) from .modules import *
329
from maths.prime_factors import prime_factors def __snake_case ( __UpperCamelCase : int ): """simple docstring""" if not isinstance(__UpperCamelCase ,__UpperCamelCase ): A_ = f'''Input value of [number={number}] must be an integer''' ...
329
1
'''simple docstring''' import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def lowerCamelCase (_SCREAMING_SNAKE_CASE : Dict , _SCREAMING_SNAKE_CASE : Any=None ): __a : Tu...
27
from collections import defaultdict def _snake_case ( lowerCAmelCase : int ): """simple docstring""" SCREAMING_SNAKE_CASE_ : Any = 1 SCREAMING_SNAKE_CASE_ : Tuple = True for v in tree[start]: if v not in visited: ret += dfs(lowerCAmelCase ) if r...
18
0
"""simple docstring""" from collections import defaultdict def _snake_case ( lowerCamelCase__ : Any ) -> int: lowerCamelCase_ : Tuple =1 lowerCamelCase_ : List[Any] =True for v in tree[start]: if v not in visited: ...
359
"""simple docstring""" import torch def _snake_case ( ) -> Union[str, Any]: if torch.cuda.is_available(): lowerCamelCase_ : int =torch.cuda.device_count() else: lowerCamelCase_ : List[str] =0 print(F"""Successfully ...
209
0
"""simple docstring""" import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrateg...
292
"""simple docstring""" import random import unittest import numpy as np from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionImgaImgPipeline, PNDMScheduler, ) from diffusers.utils import flo...
292
1
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( __snake_case ): lowercase__ = ['''image_processor''', '''tokenizer'''] lowercase__ = '''CLIPImageProcessor...
352
"""simple docstring""" from __future__ import annotations SCREAMING_SNAKE_CASE = "#" class UpperCAmelCase_ : def __init__( self : Dict ) -> None: '''simple docstring''' A__ = {} def __magic_name__ ( self : Optional[Any] ,...
230
0
import os from math import logaa def _a ( UpperCamelCase_ : str = "base_exp.txt" ) -> int: """simple docstring""" lowerCAmelCase__ = 0 lowerCAmelCase__ = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(UpperCamelCa...
340
import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() a_ = logging.get_logger(__name__) a_ = {name: getattr(transformers, name + '''Fast''') for name in SLOW_TO_FAST_CONVERTERS} de...
340
1
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ : Any = logging.get_logger(__name__) UpperCamelCase__ : List[Any] = { 'microsoft/unispeech-large-1500h-...
367
'''simple docstring''' UpperCamelCase__ : Optional[Any] = [ 999, 800, 799, 600, 599, 500, 400, 399, 377, 355, 333, 311, 288, 266, 244, 222, 200, 199, 177, 155, 133, 111, 88,...
164
0
'''simple docstring''' def _a( UpperCamelCase__ : int, UpperCamelCase__ : int, UpperCamelCase__ : int ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Union[str, Any] =(num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * commo...
152
'''simple docstring''' from PIL import Image def _a( UpperCamelCase__ : Image, UpperCamelCase__ : float ): '''simple docstring''' def brightness(UpperCamelCase__ : int ) -> float: return 1_2_8 + level + (c - 1_2_8) ...
152
1
'''simple docstring''' from __future__ import annotations def __lowerCamelCase ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ) -> int | float: if len(lowerCAmelCase_ ) == 0: raise ValueError('find_max() arg is an empty sequence' ) if ( left >= len...
369
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassificationWithTeach...
107
0
def lowerCAmelCase_ ( __lowerCamelCase = 1_0_0_0_0_0_0 ): __snake_case : Optional[int] = 1 __snake_case : Optional[int] = 1 __snake_case : Tuple = {1: 1} for inputa in range(2 , _lowerCamelCase ): __snake_case : str ...
123
from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configurat...
232
0
"""simple docstring""" import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTRACTOR_MAPPING, AutoConfig, AutoFeatureExtractor, WavaVecaConfig, WavaVecaFeatureExt...
351
"""simple docstring""" from __future__ import annotations def _A ( lowercase , lowercase , lowercase , ): """simple docstring""" if (electron_conc, hole_conc, intrinsic_conc).count(0 ) != 1: raise ValueError('''You cannot supply more or less than 2...
215
0
"""simple docstring""" def __lowerCAmelCase (_UpperCamelCase , _UpperCamelCase ): # Check if the input is valid if not len(_UpperCamelCase ) == len(_UpperCamelCase ) == 3: raise ValueError('Please enter a valid equation.' ) if equationa[0] == equationa[1] == equationa[0] == equationa[1] ...
86
'''simple docstring''' import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_in...
254
0
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_flax import ( Co...
284
from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, id...
284
1
'''simple docstring''' from __future__ import annotations import time import numpy as np _A : str = [8, 5, 9, 7] _A : Optional[int] = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] _A : int = [...
229
'''simple docstring''' import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class _lowercase : '''simple docstring''' def __init__( self : Optional[int] , SCREAMING_SNAKE_CASE...
229
1
from maths.prime_factors import prime_factors def a__ ( _SCREAMING_SNAKE_CASE ): """simple docstring""" if not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): UpperCamelCase = F"Input value of [number={number}] must be an integer" raise TypeError(_SCREAMING_...
360
"""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 lowerCAmelCase__ = logging.get_logger(_...
244
0
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def A ( _SCREAMING_SNAKE_CASE ) -> bool: lowerCamelCase : int = int(number**0.5 ) return number == sq * sq def A ( _SCREAMING_SNAKE_CASE ,_SC...
48
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, W...
209
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 __UpperCamelCase = logging.get_logger(__name__) __Up...
352
"""simple docstring""" from ....configuration_utils import PretrainedConfig from ....utils import logging __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = { '''CarlCochet/trajectory-transformer-halfcheetah-medium-v2''': ( '''https://huggingface.co/CarlCochet/...
312
0