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
"""simple docstring""" import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHEC...
356
"""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""" from decimal import Decimal, getcontext from math import ceil, factorial def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> str: if not isinstance(snake_case , snake_case ): raise TypeError('Undefined for non-integers' ) elif precision...
357
"""simple docstring""" import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": A_ : List[Any] =argparse.ArgumentParser() parser.add_argument( """--checkpoi...
80
0
"""simple docstring""" 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 Tokeni...
358
"""simple docstring""" from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionProcessor, ...
80
0
def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> "list[int]": if upper_limit < 0: raise ValueError('Limit for the Catalan sequence must be ≥ 0' ) _lowerCamelCase = [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 _lowerCamelCase = 1 ...
359
"""simple docstring""" from math import factorial, pi def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : int = 30 )-> float: if not isinstance(snake_case , (int, float) ): raise ValueError('maclaurin_sin() requires either an int or float for...
80
0
"""simple docstring""" import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPip...
360
"""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, Pipeline if is_vision_available(): from ..image_utils import load_image if is_torch_availa...
80
0
"""simple docstring""" import argparse from ...utils.dataclasses import ( ComputeEnvironment, DistributedType, DynamoBackend, PrecisionType, SageMakerDistributedType, ) from ..menu import BulletMenu A_ : Tuple =[ """EAGER""", """AOT_EAGER""", """INDUCTOR""", ...
361
"""simple docstring""" from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def SCREAMING_SNAKE_CASE_ ( )-> Any: import os as original_os from os import path as original_path from os import rename as original_rename from os....
80
0
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : int )-> int: return x if y == 0 else greatest_common_divisor(snake_case , x % y ) def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : in...
362
"""simple docstring""" import numpy as np def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return 1 / (1 + np.exp(-vector )) def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return vector * sigmoid(snake_case ) if __na...
80
0
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : int , snake_case : int )-> int: if exponent == 1: return base if exponent % 2 == 0: _lowerCamelCase = _modexpt(snake_case , exponent //...
363
"""simple docstring""" from collections import defaultdict from math import gcd def SCREAMING_SNAKE_CASE_ ( snake_case : int = 1_500_000 )-> int: _lowerCamelCase = defaultdict(snake_case ) _lowerCamelCase = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: ...
80
0
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def SCREAMING_SNAKE_CASE_ ( snake_case : Optional[Any] )-> Optional[int]: _lowerCam...
364
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer import RoF...
80
0
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : int , snake_case : Tuple=False )-> List[Any]: if isinstance(snake_case , snake_case ) and isinstance(snake_case , snake_case ): _lowerCamelCase = le...
365
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING A_ : int =logging.get_logger(__name__) A_ : Tuple ={ """ut/deta""": """https://huggingface.co/ut/deta/resolve/main/con...
80
0
"""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...
366
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.nu...
80
0
"""simple docstring""" import unittest import numpy as np import requests 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 ...
367
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : list )-> list: def merge(snake_case : list , snake_case : list ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0...
80
0
"""simple docstring""" from math import log from scipy.constants import Boltzmann, physical_constants A_ : Tuple =3_0_0 # TEMPERATURE (unit = K) def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : float , snake_case : float , )-> flo...
368
"""simple docstring""" import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor A_ : Union[str, Any] =logging.get_logger(__name__) class __a ( lowerCAmelCase__ ): def __init__( self , *a__ , **a__ ): ...
80
0
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_dev...
369
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): fro...
80
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : Union[str, Any] ={ """configuration_time_series_transformer""": [ """TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", ...
370
"""simple docstring""" import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHEC...
80
0
"""simple docstring""" import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, BertTokenizer, ...
371
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : Any ={ """configuration_table_transformer""": [ """TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TableTransformerCon...
80
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) A_ : List[str] ={"""configuration_beit""": ["""BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP""",...
350
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trus...
80
0
from string import ascii_uppercase A_ : Union[str, Any] ={char: i for i, char in enumerate(ascii_uppercase)} A_ : List[Any] =dict(enumerate(ascii_uppercase)) def SCREAMING_SNAKE_CASE_ ( snake_case : str , snake_case : str )-> str: _lowerCa...
351
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available A_ : List[str] ={"""configuration_speech_encoder_decoder""": ["""SpeechEncoderDecoderConfig"""]} try: if not is_torch_availa...
80
0
"""simple docstring""" import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging A_ : Any =logging.get_logger(__name__) A_ : Dict ={"""vocab_file"...
352
"""simple docstring""" from math import factorial def SCREAMING_SNAKE_CASE_ ( snake_case : int = 20 )-> int: _lowerCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... _lowerCamelCase = n // 2 return i...
80
0
"""simple docstring""" from __future__ import annotations from fractions import Fraction def SCREAMING_SNAKE_CASE_ ( snake_case : int , snake_case : int )-> bool: return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) ...
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 copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING A_ : int =logging.get_logger(__name__) A_ : Tuple ={ """ut/deta""": """https://huggingface.co/ut/deta/resolve/main/con...
354
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> list[int]: if num <= 0: raise ValueError('Input must be a positive integer' ) _lowerCamelCase = [True] * (num + 1) _lowerCamelCase = 2 while p * p <= num: ...
80
0
"""simple docstring""" import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class __a ( lowerCAmelCase_...
355
"""simple docstring""" from __future__ import annotations A_ : List[Any] =list[tuple[int, int]] A_ : Tuple =[ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, ...
80
0
"""simple docstring""" 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_tens...
356
"""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""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A_ : List[Any] ={ """configuration_convnext""": ["""CONVNEXT_PRETRAINED_CONFIG_ARCH...
357
"""simple docstring""" import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": A_ : List[Any] =argparse.ArgumentParser() parser.add_argument( """--checkpoi...
80
0
"""simple docstring""" import tempfile import unittest from make_student import create_student_by_copying_alternating_layers from transformers import AutoConfig from transformers.file_utils import cached_property from transformers.testing_utils import require_torch A_ : Dict ="""sshleifer/...
358
"""simple docstring""" from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionProcessor, ...
80
0
import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def SCREAMING_SNAKE_CASE_ ( snake_case : List[Any] , snake_case : List[str] , snake_case : Union[str, Any] , snake_case : Union[str, Any] )-> str: ...
359
"""simple docstring""" from math import factorial, pi def SCREAMING_SNAKE_CASE_ ( snake_case : float , snake_case : int = 30 )-> float: if not isinstance(snake_case , (int, float) ): raise ValueError('maclaurin_sin() requires either an int or float for...
80
0
"""simple docstring""" import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging A_ : Optional[Any] =logging.get_logger(__name__) def SCREAMING_SNAKE_CASE_ ( snake_...
360
"""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, Pipeline if is_vision_available(): from ..image_utils import load_image if is_torch_availa...
80
0
"""simple docstring""" import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets A_ : Dict ="""\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns and Saurav K...
361
"""simple docstring""" from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def SCREAMING_SNAKE_CASE_ ( )-> Any: import os as original_os from os import path as original_path from os import rename as original_rename from os....
80
0
"""simple docstring""" 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 PreTrainedTokenizer from ...utils import logging A_ : Any ...
362
"""simple docstring""" import numpy as np def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return 1 / (1 + np.exp(-vector )) def SCREAMING_SNAKE_CASE_ ( snake_case : np.ndarray )-> np.ndarray: return vector * sigmoid(snake_case ) if __na...
80
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : Any ={ """configuration_table_transformer""": [ """TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TableTransformerCon...
363
"""simple docstring""" from collections import defaultdict from math import gcd def SCREAMING_SNAKE_CASE_ ( snake_case : int = 1_500_000 )-> int: _lowerCamelCase = defaultdict(snake_case ) _lowerCamelCase = 2 while 2 * euclid_m * (euclid_m + 1) <= limit: ...
80
0
"""simple docstring""" import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __a ( lowerCAmelCase__ ): SCREAMING_SNAKE_CASE__ : List[str] = (KDPMaDiscreteScheduler,) SC...
364
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer import RoF...
80
0
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : str )-> str: _lowerCamelCase = '' 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 SCREAMING_SNAKE_CASE...
365
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING A_ : int =logging.get_logger(__name__) A_ : Tuple ={ """ut/deta""": """https://huggingface.co/ut/deta/resolve/main/con...
80
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Optional[int] =logging.get_logger(__name__) class __a ( lowerCAmelCase__ ): SCREAMING_SNAKE_CASE__ : str = "timm_backbone" def __init__( s...
366
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.nu...
80
0
"""simple docstring""" from __future__ import annotations from typing import Any def SCREAMING_SNAKE_CASE_ ( snake_case : list[Any] )-> None: create_state_space_tree(snake_case , [] , 0 ) def SCREAMING_SNAKE_CASE_ ( snake_case : list[Any] , snake_case ...
367
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : list )-> list: def merge(snake_case : list , snake_case : list ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0...
80
0
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> int: _lowerCamelCase = 0 while num > 0: digit_sum += num % 10 num //= 10 return digit_sum def SCREAMING_SNAKE_CASE_ ( snake_case : int = 100 )-> int: ...
368
"""simple docstring""" import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor A_ : Union[str, Any] =logging.get_logger(__name__) class __a ( lowerCAmelCase__ ): def __init__( self , *a__ , **a__ ): ...
80
0
"""simple docstring""" import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class __a ( unittest.TestCase ): def snake_case_ ( self ): debug_launcher(test_script.main ...
369
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): fro...
80
0
"""simple docstring""" from ....utils import logging A_ : List[str] =logging.get_logger(__name__) class __a ( lowerCAmelCase__ ): def __init__( self , a__ , a__=None , a__=20_48 ): _lowerCamelCase = config.__dict__ _...
370
"""simple docstring""" import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHEC...
80
0
"""simple docstring""" from __future__ import annotations from collections import deque class __a : def __init__( self , a__ ): _lowerCamelCase = [] self.adlist.append( {'value': '', 'next_states': [], 'fail_state': 0, 'output':...
371
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : Any ={ """configuration_table_transformer""": [ """TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TableTransformerCon...
80
0
from __future__ import annotations class a : """simple docstring""" def __init__( self , lowerCAmelCase_ ) -> None: _A = data _A = None _A = None def snake_case ( snake_case__ :...
81
import requests from bsa import BeautifulSoup def snake_case ( snake_case__ :str = "AAPL") -> str: _A = F'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}''' _A = BeautifulSoup(requests.get(snake_case__).text , """html.parser"""...
81
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 Spl...
81
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class a ( __lowerCAmelCase ): """simple docstring""" lowerCamelCase :int = (UnCLIPScheduler,) def UpperCAmelCase ( self , **lo...
81
1
def snake_case ( snake_case__ :int) -> list: _A = int(snake_case__) if n_element < 1: _A = ValueError("""a should be a positive number""") raise my_error _A = [1] _A , _A , _A ...
81
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def snake_case ( ) -> List[Any]: _A = ArgumentParser( description=( """PyTorch TPU...
81
1
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def snake_case ( snake_case__ :Optional[Any] , snake_case__ :Union[str, Any]=() , snake_ca...
81
import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate _SCREAMING_SNAKE_CASE = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow('', '|', '|...
81
1
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor...
81
import cva import numpy as np class a : """simple docstring""" def __init__( self , lowerCAmelCase_ , lowerCAmelCase_ ) -> Any: if k in (0.04, 0.06): _A = k _A = window_size else: ...
81
1
def snake_case ( snake_case__ :int , snake_case__ :int) -> int: while second != 0: _A = first & second first ^= second _A = c << 1 return first if __name__ == "__main__": import doctest ...
81
def snake_case ( snake_case__ :str) -> int: _A = hex_num.strip() if not hex_num: raise ValueError("""No value was passed to the function""") _A = hex_num[0] == """-""" if is_negative: _A = hex_num[1:]...
81
1
from collections import defaultdict class a : """simple docstring""" def __init__( self , lowerCAmelCase_ , lowerCAmelCase_ ) -> Optional[Any]: _A = total # total no of tasks (N) # DP table will have a dimension of (2^M)*N ...
81
# 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 # # Unless required...
81
1
import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore _SCREAMING_SNAKE_CASE = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" _SCREAMING_SNAKE_CASE = [...
81
import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup _SCREAMING_SNAKE_CASE = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' ' (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.195...
81
1
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 ...
81
from math import isqrt def snake_case ( snake_case__ :int) -> list[int]: _A = [True] * max_number for i in range(2 , isqrt(max_number - 1) + 1): if is_prime[i]: for j in range(i**2 , snake_case__ ...
81
1
def snake_case ( snake_case__ :str) -> int: _A = hex_num.strip() if not hex_num: raise ValueError("""No value was passed to the function""") _A = hex_num[0] == """-""" if is_negative: _A = hex_num[1:]...
81
import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import CLIPModel, CLIPTokenizerF...
81
1
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class a ( __lowerCAmelCase ): """simple docstring""" ...
81
def snake_case ( snake_case__ :str , snake_case__ :str) -> list: _A = len(snake_case__) _A = [] for i in range(len(snake_case__) - pat_len + 1): _A = True for j in range(snake_case__): ...
81
1
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_to...
81
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class a ( __lowerCAmelCase ): """simple docstring""" def __init__( self , *lowerCAmelC...
81
1
from scipy.stats import pearsonr import datasets _SCREAMING_SNAKE_CASE = '\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assumptio...
81
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import HeunDiscreteScheduler...
81
1
from math import factorial def snake_case ( snake_case__ :int = 100) -> int: return sum(int(snake_case__) for x in str(factorial(snake_case__))) if __name__ == "__main__": print(solution(int(input('Enter the Number: ').strip())))
81
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = {'configuration_vit_msn': ['VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMSNConfig']} try: if not is_torch_available(): raise OptionalDep...
81
1
from ..utils import DummyObject, requires_backends class a ( metaclass=__lowerCAmelCase ): """simple docstring""" lowerCamelCase :Dict = ['''torch''', '''torchsde'''] def __init__( self , *lowerCAmelCase_ , **lowerCAmelCase_ ) -> An...
81
from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fastapi.routing impor...
81
1
import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import CLIPModel, CLIPTokenizerF...
81
import colorsys from PIL import Image # type: ignore def snake_case ( snake_case__ :float , snake_case__ :float , snake_case__ :int) -> float: _A = x _A = y for step in range(snake_case__): # noqa: B007 ...
81
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) ...
81
def snake_case ( snake_case__ :int , snake_case__ :int) -> str: return "\n".join( F'''{number} * {i} = {number * i}''' for i in range(1 , number_of_terms + 1)) if __name__ == "__main__": print(multiplication_table(number=5, number_of_terms=10)) ...
81
1
import functools import logging import os import sys import threading from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional import huggingface_hub.u...
81
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() _SCREAMING_SNAKE_CASE = [ 'word_embeddi...
81
1
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() _SCREAMING_SNAKE_CASE = [ 'word_embeddi...
81
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE = {'configuration_fnet': ['FNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FNetCo...
81
1
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'asapp/sew-d-tiny-100k': 'https://huggingface.co/asapp/sew-d-tiny-100k/reso...
81
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor...
81
1
_SCREAMING_SNAKE_CASE = '\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' _SCREAMING_SNAKE_CASE ...
81
from collections.abc import Sequence def snake_case ( snake_case__ :Sequence[float] , snake_case__ :bool = False) -> float: if not arr: return 0 _A = 0 if allow_empty_subarrays else float("""-inf""") _A = 0....
81
1
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'microsoft/unispeech-large-1500h-cv': ( 'https://huggingface.co/mi...
81
def snake_case ( ) -> Any: for n in range(1 , 1_000_000): yield n * (n + 1) // 2 def snake_case ( snake_case__ :Dict) -> Optional[Any]: _A = 1 _A = 2 while i * i <= n: _A ...
81
1
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 AutoImageProcessor, SwinvaConfig, SwinvaForImageClassification def snake_case ( snake_case__ :str) ...
81
import requests from bsa import BeautifulSoup def snake_case ( snake_case__ :str = "AAPL") -> str: _A = F'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}''' _A = BeautifulSoup(requests.get(snake_case__).text , """html.parser"""...
81
1
import os import sys import unittest _SCREAMING_SNAKE_CASE = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_objec...
81
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class a ( __lowerCAmelCase ): """simple docstring""" lowerCamelCase :int = (UnCLIPScheduler,) def UpperCAmelCase ( self , **lo...
81
1
from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fastapi.routing impor...
81
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def snake_case ( ) -> List[Any]: _A = ArgumentParser( description=( """PyTorch TPU...
81
1
# This code is adapted from OpenAI's release # https://github.com/openai/human-eval/blob/master/human_eval/execution.py import contextlib import faulthandler import io import multiprocessing import os import platform import signal import tempfile def snake_case ( snake_case__ :Dict ...
81
import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate _SCREAMING_SNAKE_CASE = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow('', '|', '|...
81
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'abeja/gpt-neox-japanese-2.7b': 'https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/main/config.json', ...
81
import cva import numpy as np class a : """simple docstring""" def __init__( self , lowerCAmelCase_ , lowerCAmelCase_ ) -> Any: if k in (0.04, 0.06): _A = k _A = window_size else: ...
81
1
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_forma...
81
def snake_case ( snake_case__ :str) -> int: _A = hex_num.strip() if not hex_num: raise ValueError("""No value was passed to the function""") _A = hex_num[0] == """-""" if is_negative: _A = hex_num[1:]...
81
1
import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": _SCREAMING_SNAKE_CASE = argparse.ArgumentParser() parser.add_argument('--dump_path', default=No...
81
# 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 # # Unless required...
81
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'xlm-roberta-...
81
import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup _SCREAMING_SNAKE_CASE = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' ' (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.195...
81
1
# # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 torch-distributed-g...
81
from math import isqrt def snake_case ( snake_case__ :int) -> list[int]: _A = [True] * max_number for i in range(2 , isqrt(max_number - 1) + 1): if is_prime[i]: for j in range(i**2 , snake_case__ ...
81
1
from typing import Dict, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import flip_channel_order, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ( ChannelDimension, ImageIn...
81
import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import CLIPModel, CLIPTokenizerF...
81
1
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 _SCREAMING_SNAKE_CASE = 'src/diffusers' # Matches is_xxx_available() _SCREAMING_SNAKE_CASE = re.com...
81
def snake_case ( snake_case__ :str , snake_case__ :str) -> list: _A = len(snake_case__) _A = [] for i in range(len(snake_case__) - pat_len + 1): _A = True for j in range(snake_case__): ...
81
1
from __future__ import annotations _SCREAMING_SNAKE_CASE = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] _SCREAMING_SNAKE_CASE = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def snake_case ( snake_case__ :list[float]) -> ...
81
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class a ( __lowerCAmelCase ): """simple docstring""" def __init__( self , *lowerCAmelC...
81
1
import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device _SCREAMING_SNAKE_CASE = False class a ( unittest...
81
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import HeunDiscreteScheduler...
81
1
from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class a ( __lowerCAmelCase ): """simple docstring""" lowerCamelCase :Any = '''EncodecFeatureExtractor''' lowerCamelC...
81
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = {'configuration_vit_msn': ['VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMSNConfig']} try: if not is_torch_available(): raise OptionalDep...
81
1
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class a ( __lowerCAmelCase ): """simple docstring""" def __init__( self , *lowerCAmelC...
81
from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fastapi.routing impor...
81
1
from __future__ import annotations from collections.abc import MutableSequence class a : """simple docstring""" def __init__( self , lowerCAmelCase_ , lowerCAmelCase_ ) -> None: if len(lowerCAmelCase_ ) != degree + 1: raise ...
81
import colorsys from PIL import Image # type: ignore def snake_case ( snake_case__ :float , snake_case__ :float , snake_case__ :int) -> float: _A = x _A = y for step in range(snake_case__): # noqa: B007 ...
81
1
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast from ...utils import logging _SCREAMING_SNAKE_CASE = l...
81
def snake_case ( snake_case__ :int , snake_case__ :int) -> str: return "\n".join( F'''{number} * {i} = {number * i}''' for i in range(1 , number_of_terms + 1)) if __name__ == "__main__": print(multiplication_table(number=5, number_of_terms=10)) ...
81
1
import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax...
81
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() _SCREAMING_SNAKE_CASE = [ 'word_embeddi...
81
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() ...
81
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE = {'configuration_fnet': ['FNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FNetCo...
81
1
from math import isqrt def snake_case ( snake_case__ :int) -> list[int]: _A = [True] * max_number for i in range(2 , isqrt(max_number - 1) + 1): if is_prime[i]: for j in range(i**2 , snake_case__ ...
81
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor...
81
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { 'configuration_instructblip': [ 'INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'InstructBlipConfig', 'InstructBlipQForme...
81
from collections.abc import Sequence def snake_case ( snake_case__ :Sequence[float] , snake_case__ :bool = False) -> float: if not arr: return 0 _A = 0 if allow_empty_subarrays else float("""-inf""") _A = 0....
81
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _SCREAMING_SNAKE_CASE = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Mobil...
81
def snake_case ( ) -> Any: for n in range(1 , 1_000_000): yield n * (n + 1) // 2 def snake_case ( snake_case__ :Dict) -> Optional[Any]: _A = 1 _A = 2 while i * i <= n: _A ...
81
1
import sys _SCREAMING_SNAKE_CASE = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '6689664895044524452316173...
81
import requests from bsa import BeautifulSoup def snake_case ( snake_case__ :str = "AAPL") -> str: _A = F'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}''' _A = BeautifulSoup(requests.get(snake_case__).text , """html.parser"""...
81
1
import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMInverseScheduler, DDIMScheduler, DPMSolverMultistepInverseSchedul...
81
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class a ( __lowerCAmelCase ): """simple docstring""" lowerCamelCase :int = (UnCLIPScheduler,) def UpperCAmelCase ( self , **lo...
81
1
from __future__ import annotations import math from collections.abc import Callable def snake_case ( snake_case__ :Callable[[int | float], int | float] , snake_case__ :int | float , snake_case__ :int | float , snake_case__ :int = 100 , ) ...
81
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def snake_case ( ) -> List[Any]: _A = ArgumentParser( description=( """PyTorch TPU...
81
1
import math def snake_case ( snake_case__ :int) -> 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 numbers, all multiples of 3 are ...
81
import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate _SCREAMING_SNAKE_CASE = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow('', '|', '|...
81
1
import math import random def snake_case ( snake_case__ :float , snake_case__ :bool = False) -> float: if deriv: return value * (1 - value) return 1 / (1 + math.exp(-value)) # Initial Value _SCREAMING_SNAKE_CASE = 0.0...
81
import cva import numpy as np class a : """simple docstring""" def __init__( self , lowerCAmelCase_ , lowerCAmelCase_ ) -> Any: if k in (0.04, 0.06): _A = k _A = window_size else: ...
81
1
from collections import deque from math import floor from random import random from time import time class a : """simple docstring""" def __init__( self ) -> Any: _A = {} def UpperCAmelCase ( self , lowerCAmelCase_ , ...
81
def snake_case ( snake_case__ :str) -> int: _A = hex_num.strip() if not hex_num: raise ValueError("""No value was passed to the function""") _A = hex_num[0] == """-""" if is_negative: _A = hex_num[1:]...
81
1
import colorsys from PIL import Image # type: ignore def snake_case ( snake_case__ :float , snake_case__ :float , snake_case__ :int) -> float: _A = x _A = y for step in range(snake_case__): # noqa: B007 ...
81
# 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 # # Unless required...
81
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'facebook/xglm-564M': 'https://huggingface.co/facebook/xglm-564M/resolve/main/config.json', # See all XGLM ...
81
import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup _SCREAMING_SNAKE_CASE = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' ' (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.195...
81
1
def snake_case ( snake_case__ :Optional[Any]) -> List[Any]: if not head: return True # split the list to two parts _A , _A = head.next, head while fast and fast.next: _A = fast.next.next _A ...
81
from math import isqrt def snake_case ( snake_case__ :int) -> list[int]: _A = [True] * max_number for i in range(2 , isqrt(max_number - 1) + 1): if is_prime[i]: for j in range(i**2 , snake_case__ ...
81
1
from abc import ABC, abstractmethod from argparse import ArgumentParser class a ( __lowerCAmelCase ): """simple docstring""" @staticmethod @abstractmethod def UpperCAmelCase ( lowerCAmelCase_ ) -> int: raise NotImplementedError() ...
81
import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import CLIPModel, CLIPTokenizerF...
81
1
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 import FlaxAutoModel ...
81
def snake_case ( snake_case__ :str , snake_case__ :str) -> list: _A = len(snake_case__) _A = [] for i in range(len(snake_case__) - pat_len + 1): _A = True for j in range(snake_case__): ...
81
1
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.util...
81
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class a ( __lowerCAmelCase ): """simple docstring""" def __init__( self , *lowerCAmelC...
81
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE = {'configuration_fnet': ['FNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FNetCo...
81
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import HeunDiscreteScheduler...
81
1
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation _SCREAMING_SNAKE_C...
81
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = {'configuration_vit_msn': ['VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMSNConfig']} try: if not is_torch_available(): raise OptionalDep...
81
1
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def snake_case ( snake_case__ :int) -> bool: _A = int(number**0.5) return number == sq * sq def snake_case ( snake_case__ :int , s...
81
from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fastapi.routing impor...
81
1
_SCREAMING_SNAKE_CASE = '0.18.2' from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_available, is_k_diffusion_version, is_libro...
81
import colorsys from PIL import Image # type: ignore def snake_case ( snake_case__ :float , snake_case__ :float , snake_case__ :int) -> float: _A = x _A = y for step in range(snake_case__): # noqa: B007 ...
81
1
_SCREAMING_SNAKE_CASE = [ (1_000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I'), ] def snake_case ( snake_case__ :str)...
81
def snake_case ( snake_case__ :int , snake_case__ :int) -> str: return "\n".join( F'''{number} * {i} = {number * i}''' for i in range(1 , number_of_terms + 1)) if __name__ == "__main__": print(multiplication_table(number=5, number_of_terms=10)) ...
81
1
def snake_case ( snake_case__ :int) -> bool: return sum(i for i in range(1 , number // 2 + 1) if number % i == 0) == number if __name__ == "__main__": print('Program to check whether a number is a Perfect number or not...') _SCREAMING_SNAKE_CASE = in...
81
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() _SCREAMING_SNAKE_CASE = [ 'word_embeddi...
81
1