code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
import operator def A__ ( lowerCamelCase , lowerCamelCase = False , lowerCamelCase = None ) -> list: UpperCamelCase_: Union[str, Any] = operator.lt if reverse else operator.gt UpperCamelCase_: List[Any] = solution or [] if not arr: r...
670
class _UpperCamelCase : '''simple docstring''' def __init__( self : List[str] , snake_case_ : int , snake_case_ : Optional[Any]=None , snake_case_ : List[str]=None ): UpperCamelCase_: List[Any] = data UpperCamelCase_: ...
670
1
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching between checkouts...
670
# 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 required by applicab...
670
1
import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _UpperCamelCase ( unittest.TestCase ): '''simp...
670
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class ...
670
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) lowerCamelCase_ : Optional[int] = { """configuration_clip""": [ ...
670
def A__ ( lowerCamelCase = 50 ) -> int: UpperCamelCase_: List[Any] = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length + 1 ...
670
1
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_ : str = logging.get_logger(__name__...
670
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase ) -> Union[str, Any]: # Initialise PyTorc...
670
1
import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging lowerCamelCase_ : str = logging.get_logger(_...
670
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : str = { """configuration_roformer""": ["""ROFORMER_PRETRAINED_CONFIG_ARC...
670
1
import unittest import torch from diffusers import VQModel from diffusers.utils import floats_tensor, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNetTesterMixin enable_full_determinism() class _UpperCamelCase ( ...
670
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = "x" , lowerCamelCase = 10**-10 , lowerCamelCase = 1 , ) -> complex: UpperCamelCase_: Optional[Any] = ...
670
1
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ViltForMaskedLM, ViltForQ...
670
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : Optional[Any] = { """configuration_distilbert""": [ """DISTILBER...
670
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCamelCase_ : List[Any] = { """configuration_efficientformer""": [ """EFFICIENTFORMER_PRETRAINED_CONFIG_A...
670
from manim import * class _UpperCamelCase ( _A ): '''simple docstring''' def lowerCAmelCase__ ( self : int ): UpperCamelCase_: Dict = Rectangle(height=0.5 , width=0.5 ) UpperCamelCase_: Dict = Rectangle(height=0.46 ,...
670
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available lowerCamelCase_ : List[Any] = {"""tokenization_herbert""": ["""HerbertTokenizer"""]} try: if not is_tokenizers_available(): raise OptionalDependencyNotAvaila...
670
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchaudio @require_sente...
670
1
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 _UpperCamelCase ( _A , _A ): '''sim...
670
import warnings from ..trainer import Trainer from ..utils import logging lowerCamelCase_ : Dict = logging.get_logger(__name__) class _UpperCamelCase ( _A ): '''simple docstring''' def __init__( self : List[str] , snake_case_ : Tuple=None , **sn...
670
1
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES lowerCamelCase_ : List[Any] = logging.get_logger(__name__) lowerCamelCase_ : str = Or...
670
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() lowerCamelCase_ : Optional[int] = logging.get_logger("""transformers.models.speecht5""") def A__ ( lowerCamelCase , lower...
670
1
import random def A__ ( lowerCamelCase , lowerCamelCase ) -> tuple: UpperCamelCase_, UpperCamelCase_, UpperCamelCase_: Tuple = [], [], [] for element in data: if element < pivot: less.append(lowerCamelCase ) elif element > pivo...
670
lowerCamelCase_ : Optional[Any] = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ lowerCamelCase_ ...
670
1
import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def A__ ( lowerCamelCase , lowerC...
670
import cva import numpy as np class _UpperCamelCase : '''simple docstring''' def __init__( self : Dict , snake_case_ : float , snake_case_ : int ): if k in (0.04, 0.06): UpperCamelCase_: Union[str, Any] = k UpperCam...
670
1
import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home lowerCamelCase_ : Optional[int] = HUGGINGFACE_HUB_CACHE lowerCamelCase_ : List[str] = """config.json""" lowerCamelCase_ : Any = """diffusion_pytorch_model.bin""" lowerCamelCase_ : Un...
670
import random def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = False ) -> dict: UpperCamelCase_: dict = {i: [] for i in range(lowerCamelCase )} # if probability is greater or equal than 1, then generate a complete graph if probability ...
670
1
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils import ...
670
import os import unittest from huggingface_hub.utils import are_progress_bars_disabled import transformers.models.bart.tokenization_bart from transformers import logging from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context from transformers.utils.logging import disable_progress_bar, enable_...
670
1
import numpy class _UpperCamelCase : '''simple docstring''' def __init__( self : str , snake_case_ : numpy.ndarray , snake_case_ : numpy.ndarray ): UpperCamelCase_: str = input_array # Random initial weights are assigned where fir...
670
import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home lowerCamelCase_ : Optional[int] = HUGGINGFACE_HUB_CACHE lowerCamelCase_ : List[str] = """config.json""" lowerCamelCase_ : Any = """diffusion_pytorch_model.bin""" lowerCamelCase_ : Un...
670
1
import numpy as np class _UpperCamelCase : '''simple docstring''' def __init__( self : Union[str, Any] ): UpperCamelCase_: Optional[Any] = (0, 0) UpperCamelCase_: str = None UpperCamelCase_: Tuple = 0 UpperCamelCase_:...
670
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class _UpperCamelCase ( unittest.TestCase ): '''simple docstring''' def lowerCAmelCase__ ( self : Optional[int] ): Up...
670
1
def A__ ( ) -> Optional[int]: UpperCamelCase_: Tuple = 0 for i in range(1 , 10_01 ): total += i**i return str(lowerCamelCase )[-10:] if __name__ == "__main__": print(solution())
670
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepiece @slow # see ht...
670
1
import warnings from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dimension...
670
def A__ ( lowerCamelCase , lowerCamelCase ) -> int: while second != 0: UpperCamelCase_: Optional[Any] = first & second first ^= second UpperCamelCase_: Any = c << 1 return first if __name__ == "__main__": import doctest ...
670
1
def A__ ( lowerCamelCase ) -> bool: UpperCamelCase_: List[str] = n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(27)) print(perfect_cube(4))
670
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice, ...
670
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Tuple = logging.get_logger(__name__) lowerCamelCase_ : Union[str, Any] = { """uclanlp/visualbert-vqa""": """https://huggingface.co/uclanlp/visualbert-vqa/resolve/main/config.json""", ...
670
import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_torch_multi_gpu, ) logging....
670
1
from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class _UpperCamelCase ( _A ): '''simple docstring''' def __init__( self : ...
670
class _UpperCamelCase : '''simple docstring''' def __init__( self : List[str] , snake_case_ : int , snake_case_ : Optional[Any]=None , snake_case_ : List[str]=None ): UpperCamelCase_: List[Any] = data UpperCamelCase_: ...
670
1
lowerCamelCase_ : List[Any] = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase , lowerCamelCase ...
670
# 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 required by applicab...
670
1
from manim import * class _UpperCamelCase ( _A ): '''simple docstring''' def lowerCAmelCase__ ( self : int ): UpperCamelCase_: Dict = Rectangle(height=0.5 , width=0.5 ) UpperCamelCase_: Dict = Rectangle(height=0.46 ,...
670
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class ...
670
1
import math def A__ ( lowerCamelCase , lowerCamelCase ) -> float: return math.pow(lowerCamelCase , 2 ) - a def A__ ( lowerCamelCase ) -> float: return 2 * x def A__ ( lowerCamelCase ) -> float: UpperCa...
670
def A__ ( lowerCamelCase = 50 ) -> int: UpperCamelCase_: List[Any] = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length + 1 ...
670
1
import torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class _UpperCamelCase ( _A ): '''simple docstring''' __UpperCamelCase : List[str] = """M-CLIP""" def __init__( self : Optional[Any] , snake_case_ : Union[...
670
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase ) -> Union[str, Any]: # Initialise PyTorc...
670
1
# 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 # # Unless required by applicab...
670
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : str = { """configuration_roformer""": ["""ROFORMER_PRETRAINED_CONFIG_ARC...
670
1
import re def A__ ( lowerCamelCase ) -> bool: UpperCamelCase_: Tuple = re.compile(r"""^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$""" ) if match := re.search(lowerCamelCase , lowerCamelCase ): return match.string == phone return False if __name__ ==...
670
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = "x" , lowerCamelCase = 10**-10 , lowerCamelCase = 1 , ) -> complex: UpperCamelCase_: Optional[Any] = ...
670
1
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchaudio @require_sente...
670
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : Optional[Any] = { """configuration_distilbert""": [ """DISTILBER...
670
1
from __future__ import annotations from typing import TypedDict class _UpperCamelCase ( _A ): '''simple docstring''' __UpperCamelCase : str __UpperCamelCase : int def A__ ( lowerCamelCase ) -> list[str]: if not isinstance(lowerCamelC...
670
from manim import * class _UpperCamelCase ( _A ): '''simple docstring''' def lowerCAmelCase__ ( self : int ): UpperCamelCase_: Dict = Rectangle(height=0.5 , width=0.5 ) UpperCamelCase_: Dict = Rectangle(height=0.46 ,...
670
1
def A__ ( lowerCamelCase ) -> list: UpperCamelCase_: str = len(lowerCamelCase ) for _ in range(lowerCamelCase ): for i in range(_ % 2 , arr_size - 1 , 2 ): if arr[i + 1] < arr[i]: UpperCamelCase_, UpperCamelCase...
670
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchaudio @require_sente...
670
1
import cva import numpy as np class _UpperCamelCase : '''simple docstring''' def __init__( self : Dict , snake_case_ : float , snake_case_ : int ): if k in (0.04, 0.06): UpperCamelCase_: Union[str, Any] = k UpperCam...
670
import warnings from ..trainer import Trainer from ..utils import logging lowerCamelCase_ : Dict = logging.get_logger(__name__) class _UpperCamelCase ( _A ): '''simple docstring''' def __init__( self : List[str] , snake_case_ : Tuple=None , **sn...
670
1
import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingStrategy, logging from .tokeniz...
670
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() lowerCamelCase_ : Optional[int] = logging.get_logger("""transformers.models.speecht5""") def A__ ( lowerCamelCase , lower...
670
1
from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer lowerCamelCase_ : Union[str, Any] = logging.get_logger(__name_...
670
lowerCamelCase_ : Optional[Any] = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ lowerCamelCase_ ...
670
1
from ....configuration_utils import PretrainedConfig from ....utils import logging lowerCamelCase_ : Tuple = logging.get_logger(__name__) lowerCamelCase_ : Dict = { """speechbrain/m-ctc-t-large""": """https://huggingface.co/speechbrain/m-ctc-t-large/resolve/main/config.json""", #...
670
import cva import numpy as np class _UpperCamelCase : '''simple docstring''' def __init__( self : Dict , snake_case_ : float , snake_case_ : int ): if k in (0.04, 0.06): UpperCamelCase_: Union[str, Any] = k UpperCam...
670
1
from ...processing_utils import ProcessorMixin class _UpperCamelCase ( _A ): '''simple docstring''' __UpperCamelCase : Dict = ["""image_processor""", """feature_extractor"""] __UpperCamelCase : Optional[int] = """TvltImageProcessor""" __UpperCa...
670
import random def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = False ) -> dict: UpperCamelCase_: dict = {i: [] for i in range(lowerCamelCase )} # if probability is greater or equal than 1, then generate a complete graph if probability ...
670
1
from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseModelOutputWithNoAttention, TFBaseModelOutputWith...
670
import os import unittest from huggingface_hub.utils import are_progress_bars_disabled import transformers.models.bart.tokenization_bart from transformers import logging from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context from transformers.utils.logging import disable_progress_bar, enable_...
670
1
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils import ...
670
import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home lowerCamelCase_ : Optional[int] = HUGGINGFACE_HUB_CACHE lowerCamelCase_ : List[str] = """config.json""" lowerCamelCase_ : Any = """diffusion_pytorch_model.bin""" lowerCamelCase_ : Un...
670
1
import string import numpy def A__ ( lowerCamelCase , lowerCamelCase ) -> int: return b if a == 0 else greatest_common_divisor(b % a , lowerCamelCase ) class _UpperCamelCase : '''simple docstring''' __UpperCamelCase : List[str] ...
670
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class _UpperCamelCase ( unittest.TestCase ): '''simple docstring''' def lowerCAmelCase__ ( self : Optional[int] ): Up...
670
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ : str = logging.get_logger(__name__) lowerCamelCase_ : Optional[int] ...
670
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepiece @slow # see ht...
670
1
lowerCamelCase_ : str = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_00_00)] def A__ ( lowerCamelCase ) -> int: UpperCamelCase_: List[Any] = 0 while number: # Increased Speed Slightly by checking every 5 digits together. sum_...
670
def A__ ( lowerCamelCase , lowerCamelCase ) -> int: while second != 0: UpperCamelCase_: Optional[Any] = first & second first ^= second UpperCamelCase_: Any = c << 1 return first if __name__ == "__main__": import doctest ...
670
1
from __future__ import annotations import typing from collections.abc import Iterable import numpy as np lowerCamelCase_ : Optional[Any] = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 lowerCamelCase_ : Tuple = typing.Union[np.floataa, int, float] # noqa: UP007...
670
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice, ...
670
1
def A__ ( lowerCamelCase ) -> int: if not isinstance(lowerCamelCase , lowerCamelCase ): UpperCamelCase_: Optional[int] = F'''Input value of [number={number}] must be an integer''' raise TypeError(lowerCamelCase ) if number < 1: UpperCa...
670
import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_torch_multi_gpu, ) logging....
670
1
from __future__ import annotations from typing import Any class _UpperCamelCase ( _A ): '''simple docstring''' pass class _UpperCamelCase : '''simple docstring''' def __init__( self : List[str] , snake_case_ : Any ): UpperCamel...
670
class _UpperCamelCase : '''simple docstring''' def __init__( self : List[str] , snake_case_ : int , snake_case_ : Optional[Any]=None , snake_case_ : List[str]=None ): UpperCamelCase_: List[Any] = data UpperCamelCase_: ...
670
1
def A__ ( lowerCamelCase ) -> bool: UpperCamelCase_: Tuple = 0 for ch in input_str: UpperCamelCase_: Optional[Any] = ord(lowerCamelCase ) UpperCamelCase_: Any = pow(2 , lowerCamelCase ) # If we already turned on bi...
670
# 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 required by applicab...
670
1
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class ...
670
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class ...
670
1
import os import unittest from huggingface_hub.utils import are_progress_bars_disabled import transformers.models.bart.tokenization_bart from transformers import logging from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context from transformers.utils.logging import disable_progress_bar, enable_...
670
def A__ ( lowerCamelCase = 50 ) -> int: UpperCamelCase_: List[Any] = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length + 1 ...
670
1
import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def A__ ( *lowerCamelCase ) -> List[Any]: if not isinstance(lowerCamelCase , lowerCamelCase ): UpperCamelCase_: Dict = list(lowerCamelCase ...
670
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase ) -> Union[str, Any]: # Initialise PyTorc...
670
1
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = "x" , lowerCamelCase = 10**-10 , lowerCamelCase = 1 , ) -> complex: UpperCamelCase_: Optional[Any] = ...
670
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : str = { """configuration_roformer""": ["""ROFORMER_PRETRAINED_CONFIG_ARC...
670
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, PILImageResamplin...
670
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = "x" , lowerCamelCase = 10**-10 , lowerCamelCase = 1 , ) -> complex: UpperCamelCase_: Optional[Any] = ...
670
1
# 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 required by applicab...
670
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : Optional[Any] = { """configuration_distilbert""": [ """DISTILBER...
670
1
from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. lowerCamelCase_ : Union[str, Any] = 2_00 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst of that genera...
670
from manim import * class _UpperCamelCase ( _A ): '''simple docstring''' def lowerCAmelCase__ ( self : int ): UpperCamelCase_: Dict = Rectangle(height=0.5 , width=0.5 ) UpperCamelCase_: Dict = Rectangle(height=0.46 ,...
670
1
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class _UpperCamelCase ( unittest.TestCase ): '''simple docstring''' def lowerCAmelCase__ ( self : Optional[int] ): Up...
670
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchaudio @require_sente...
670
1
import secrets from random import shuffle from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation def A__ ( lowerCamelCase = 8 ) -> str: UpperCamelCase_: int = ascii_letters + digits + punctuation return "".join(secrets.choice(lowerCamelCa...
670
import warnings from ..trainer import Trainer from ..utils import logging lowerCamelCase_ : Dict = logging.get_logger(__name__) class _UpperCamelCase ( _A ): '''simple docstring''' def __init__( self : List[str] , snake_case_ : Tuple=None , **sn...
670
1
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _UpperCamelCase ( _A ): '''simple docstring''' __UpperCamelCase : Optional[int] = ["""image_processor""", """tokenizer"""] __UpperCamelCase ...
670
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() lowerCamelCase_ : Optional[int] = logging.get_logger("""transformers.models.speecht5""") def A__ ( lowerCamelCase , lower...
670
1
import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase_ : Optional[Any] = logging.get_logger(__name__) lowerCamelCase_ : Opti...
670
lowerCamelCase_ : Optional[Any] = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ lowerCamelCase_ ...
670
1
def A__ ( lowerCamelCase ) -> list: UpperCamelCase_: Dict = [0] * len(lowerCamelCase ) for i in range(1 , len(lowerCamelCase ) ): # use last results for better performance - dynamic programming UpperCamelCase_: Union[str, Any] = ...
670
import cva import numpy as np class _UpperCamelCase : '''simple docstring''' def __init__( self : Dict , snake_case_ : float , snake_case_ : int ): if k in (0.04, 0.06): UpperCamelCase_: Union[str, Any] = k UpperCam...
670
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCamelCase_ : Optional[int] = { """configuration_roberta_prelayernorm""": [ """ROBERTA_PRELAYERNORM_PRETRAI...
670
import random def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = False ) -> dict: UpperCamelCase_: dict = {i: [] for i in range(lowerCamelCase )} # if probability is greater or equal than 1, then generate a complete graph if probability ...
670
1
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 import GradientAccumulator, ...
670
import os import unittest from huggingface_hub.utils import are_progress_bars_disabled import transformers.models.bart.tokenization_bart from transformers import logging from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context from transformers.utils.logging import disable_progress_bar, enable_...
670
1
def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase , lowerCamelCase , lowerCamelCase ) -> int: if index == number_of_items: return 0 UpperCamelCase_: Union[str, Any] = 0 UpperCamelCase_: Optional[int] = 0 UpperCamel...
670
import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home lowerCamelCase_ : Optional[int] = HUGGINGFACE_HUB_CACHE lowerCamelCase_ : List[str] = """config.json""" lowerCamelCase_ : Any = """diffusion_pytorch_model.bin""" lowerCamelCase_ : Un...
670
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Tuple = logging.get_logger(__name__) lowerCamelCase_ : str = { """vinvino02/glpn-kitti""": """https://huggingface.co/vinvino02/glpn-kitti/resolve/main/config.json""", # See all GLPN...
670
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class _UpperCamelCase ( unittest.TestCase ): '''simple docstring''' def lowerCAmelCase__ ( self : Optional[int] ): Up...
670
1
import math import unittest def A__ ( lowerCamelCase ) -> bool: assert isinstance(lowerCamelCase , lowerCamelCase ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes return True elif nu...
670
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepiece @slow # see ht...
670
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.utils import logging ...
670
def A__ ( lowerCamelCase , lowerCamelCase ) -> int: while second != 0: UpperCamelCase_: Optional[Any] = first & second first ^= second UpperCamelCase_: Any = c << 1 return first if __name__ == "__main__": import doctest ...
670
1
import torch from transformers import AutoModel class _UpperCamelCase ( torch.nn.Module ): '''simple docstring''' def __init__( self : Optional[Any] , snake_case_ : int="sayef/fsner-bert-base-uncased" ): super(snake_case_ , self ).__init__() ...
670
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice, ...
670
1
from __future__ import annotations import unittest from transformers import LEDConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor from ...test_pipeline_mixin impor...
670
import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_torch_multi_gpu, ) logging....
670
1
import tensorflow as tf from ...tf_utils import shape_list class _UpperCamelCase ( tf.keras.layers.Layer ): '''simple docstring''' def __init__( self : Any , snake_case_ : int , snake_case_ : Any , snake_case_ : Dict , snake_case_ : ...
670
class _UpperCamelCase : '''simple docstring''' def __init__( self : List[str] , snake_case_ : int , snake_case_ : Optional[Any]=None , snake_case_ : List[str]=None ): UpperCamelCase_: List[Any] = data UpperCamelCase_: ...
670
1
import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.import_utils ...
670
# 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 required by applicab...
670
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCamelCase_ : List[str] = { """configuration_mobilenet_v2""": [ """MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MobileNetV2Config""", ...
670
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class ...
670
1
def A__ ( lowerCamelCase ) -> Optional[Any]: UpperCamelCase_: Optional[int] = len(lowerCamelCase ) UpperCamelCase_: Tuple = sum(lowerCamelCase ) UpperCamelCase_: str = [[False for x in range(s + 1 )] for y in range(n + 1 )] fo...
670
def A__ ( lowerCamelCase = 50 ) -> int: UpperCamelCase_: List[Any] = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length + 1 ...
670
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCamelCase_ : Any = { """configuration_bloom""": ["""BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BloomConfig""", """BloomOnnxConfig"""], } try: i...
670
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase ) -> Union[str, Any]: # Initialise PyTorc...
670
1
from __future__ import annotations import math def A__ ( lowerCamelCase ) -> 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 not pr...
670
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : str = { """configuration_roformer""": ["""ROFORMER_PRETRAINED_CONFIG_ARC...
670
1
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 lowerCamelCase_ : Union[str, Any] = logging.get_...
670
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = "x" , lowerCamelCase = 10**-10 , lowerCamelCase = 1 , ) -> complex: UpperCamelCase_: Optional[Any] = ...
670
1
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( DiffusionPipeline, UnCLIPImageV...
670
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : Optional[Any] = { """configuration_distilbert""": [ """DISTILBER...
670
1
import requests def A__ ( lowerCamelCase , lowerCamelCase ) -> None: UpperCamelCase_: Union[str, Any] = {"""Content-Type""": """application/json"""} UpperCamelCase_: List[Any] = requests.post(lowerCamelCase , json={"""text""": message_body} ,...
670
from manim import * class _UpperCamelCase ( _A ): '''simple docstring''' def lowerCAmelCase__ ( self : int ): UpperCamelCase_: Dict = Rectangle(height=0.5 , width=0.5 ) UpperCamelCase_: Dict = Rectangle(height=0.46 ,...
670
1
def A__ ( lowerCamelCase ) -> int: if not grid or not grid[0]: raise TypeError("""The grid does not contain the appropriate information""" ) for cell_n in range(1 , len(grid[0] ) ): grid[0][cell_n] += grid[0][cell_n - 1] UpperCamelCase_: O...
670
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchaudio @require_sente...
670
1
from graphs.minimum_spanning_tree_kruskal import kruskal def A__ ( ) -> Dict: UpperCamelCase_: Optional[Any] = 9 UpperCamelCase_: Dict = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, 8, 7], [7, 6, 1], [2, 8, 2], [8, ...
670
import warnings from ..trainer import Trainer from ..utils import logging lowerCamelCase_ : Dict = logging.get_logger(__name__) class _UpperCamelCase ( _A ): '''simple docstring''' def __init__( self : List[str] , snake_case_ : Tuple=None , **sn...
670
1
from typing import Any class _UpperCamelCase : '''simple docstring''' def __init__( self : str , snake_case_ : Any ): UpperCamelCase_: Optional[Any] = data UpperCamelCase_: List[Any] = None class _UpperCamelCase : ...
670
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() lowerCamelCase_ : Optional[int] = logging.get_logger("""transformers.models.speecht5""") def A__ ( lowerCamelCase , lower...
670
1
import numpy as np def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = 1E-1_2 , lowerCamelCase = 1_00 , ) -> tuple[float, np.ndarray]: assert np.shape(lowerCamelCase )[0] == np.shape(lowerCamelCase )[1] # Ensure proper dimensionality. a...
670
lowerCamelCase_ : Optional[Any] = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ lowerCamelCase_ ...
670
1
def A__ ( lowerCamelCase , lowerCamelCase ) -> int: return int((input_a, input_a).count(1 ) != 0 ) def A__ ( ) -> None: assert or_gate(0 , 0 ) == 0 assert or_gate(0 , 1 ) == 1 assert or_gate(1 , 0 ) == 1 ...
670
import cva import numpy as np class _UpperCamelCase : '''simple docstring''' def __init__( self : Dict , snake_case_ : float , snake_case_ : int ): if k in (0.04, 0.06): UpperCamelCase_: Union[str, Any] = k UpperCam...
670
1
import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller lowerCamelCase_ : str = 3 def A__ ( lowerCamelCase ) -> int: print("""Generating primitive root of p""" ) while True: UpperCamelCase_: Any ...
670
import random def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = False ) -> dict: UpperCamelCase_: dict = {i: [] for i in range(lowerCamelCase )} # if probability is greater or equal than 1, then generate a complete graph if probability ...
670
1
def A__ ( lowerCamelCase = 50 ) -> int: UpperCamelCase_: Union[str, Any] = [1] * (length + 1) for row_length in range(3 , length + 1 ): for block_length in range(3 , row_length + 1 ): for block_start in range(row_length - block_lengt...
670
import os import unittest from huggingface_hub.utils import are_progress_bars_disabled import transformers.models.bart.tokenization_bart from transformers import logging from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context from transformers.utils.logging import disable_progress_bar, enable_...
670
1
import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.models.bert.configuration_bert import BertConfig from tran...
670
import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home lowerCamelCase_ : Optional[int] = HUGGINGFACE_HUB_CACHE lowerCamelCase_ : List[str] = """config.json""" lowerCamelCase_ : Any = """diffusion_pytorch_model.bin""" lowerCamelCase_ : Un...
670
1
from __future__ import annotations def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase ) -> dict[str, float]: if (voltage, current, resistance).count(0 ) != 1: raise ValueError("""One and only one argument must be 0""" ) if resistance < 0: ...
670
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class _UpperCamelCase ( unittest.TestCase ): '''simple docstring''' def lowerCAmelCase__ ( self : Optional[int] ): Up...
670
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : Any = {"""configuration_plbart""": ["""PLBART_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PLBar...
670
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepiece @slow # see ht...
670
1
def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = 0 , lowerCamelCase = 0 ) -> int: UpperCamelCase_: List[str] = right or len(lowerCamelCase ) - 1 if left > right: return -1 elif list_data[left] == key: return left eli...
670
def A__ ( lowerCamelCase , lowerCamelCase ) -> int: while second != 0: UpperCamelCase_: Optional[Any] = first & second first ^= second UpperCamelCase_: Any = c << 1 return first if __name__ == "__main__": import doctest ...
670
1
from __future__ import annotations from decimal import Decimal from numpy import array def A__ ( lowerCamelCase ) -> list[list[float]]: UpperCamelCase_: Optional[int] = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implementation onl...
670
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice, ...
670
1
def A__ ( lowerCamelCase ) -> bool: return str(lowerCamelCase ) == str(lowerCamelCase )[::-1] def A__ ( lowerCamelCase ) -> int: return int(lowerCamelCase ) + int(str(lowerCamelCase )[::-1] ) def A__ ( lowerCamel...
670
import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_torch_multi_gpu, ) logging....
670
1
def A__ ( lowerCamelCase , lowerCamelCase ) -> int: while second != 0: UpperCamelCase_: Optional[Any] = first & second first ^= second UpperCamelCase_: Any = c << 1 return first if __name__ == "__main__": import doctest ...
670
class _UpperCamelCase : '''simple docstring''' def __init__( self : List[str] , snake_case_ : int , snake_case_ : Optional[Any]=None , snake_case_ : List[str]=None ): UpperCamelCase_: List[Any] = data UpperCamelCase_: ...
670
1
import argparse import collections import os import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_table.py lowerCamelCase_ : Union[str, Any] = """src/transforme...
670
# 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 required by applicab...
670
1
import json import os import torch from diffusers import UNetaDModel os.makedirs("""hub/hopper-medium-v2/unet/hor32""", exist_ok=True) os.makedirs("""hub/hopper-medium-v2/unet/hor128""", exist_ok=True) os.makedirs("""hub/hopper-medium-v2/value_function""", exist_ok=True) def A__ ( lowerCame...
670
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class ...
670
1
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_...
670
def A__ ( lowerCamelCase = 50 ) -> int: UpperCamelCase_: List[Any] = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length + 1 ...
670
1
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_utils import FrozenDict fro...
670
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase ) -> Union[str, Any]: # Initialise PyTorc...
670
1
def A__ ( lowerCamelCase ) -> int: UpperCamelCase_: Optional[Any] = 1 for i in range(1 , num + 1 ): fact *= i return fact def A__ ( lowerCamelCase ) -> int: UpperCamelCase_: Optional[Any] = 0 while number >...
670
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : str = { """configuration_roformer""": ["""ROFORMER_PRETRAINED_CONFIG_ARC...
670
1
import itertools import string from collections.abc import Generator, Iterable def A__ ( lowerCamelCase , lowerCamelCase ) -> Generator[tuple[str, ...], None, None]: UpperCamelCase_: Tuple = iter(lowerCamelCase ) while True: UpperCamelCase_: Opt...
670
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = "x" , lowerCamelCase = 10**-10 , lowerCamelCase = 1 , ) -> complex: UpperCamelCase_: Optional[Any] = ...
670
1
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 _UpperCamelCase ( _A ): '''simple docstring''' ...
670
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : Optional[Any] = { """configuration_distilbert""": [ """DISTILBER...
670
1
lowerCamelCase_ : Optional[Any] = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ lowerCamelCase_ ...
670
from manim import * class _UpperCamelCase ( _A ): '''simple docstring''' def lowerCAmelCase__ ( self : int ): UpperCamelCase_: Dict = Rectangle(height=0.5 , width=0.5 ) UpperCamelCase_: Dict = Rectangle(height=0.46 ,...
670
1
import warnings from ..trainer import Trainer from ..utils import logging lowerCamelCase_ : Dict = logging.get_logger(__name__) class _UpperCamelCase ( _A ): '''simple docstring''' def __init__( self : List[str] , snake_case_ : Tuple=None , **sn...
670
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchaudio @require_sente...
670
1
import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class _UpperCamelCase ( _A , unittest.TestCase ): '''simple docstring''' __UpperCamelCase : Op...
670
import warnings from ..trainer import Trainer from ..utils import logging lowerCamelCase_ : Dict = logging.get_logger(__name__) class _UpperCamelCase ( _A ): '''simple docstring''' def __init__( self : List[str] , snake_case_ : Tuple=None , **sn...
670
1
from collections import defaultdict def A__ ( lowerCamelCase ) -> int: UpperCamelCase_: List[str] = 1 UpperCamelCase_: Optional[Any] = True for v in tree[start]: if v not in visited: ret += dfs(lowerCamelCase ) if ret % 2 == 0:...
670
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() lowerCamelCase_ : Optional[int] = logging.get_logger("""transformers.models.speecht5""") def A__ ( lowerCamelCase , lower...
670
1