code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
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 : Any = logging.get_logger(__name__) __lowerCamelCase : Union[str, A...
216
"""simple docstring""" def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float ) -> float: '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(F"""{price_plus_tax(100, 0.25) = }""") print(F"""{price_plus_tax(1_25.50, 0.05) =...
646
0
'''simple docstring''' class UpperCAmelCase : '''simple docstring''' def __init__( self , __lowerCAmelCase ) -> Optional[int]: # we need a list not a string, so do something to change the type lowercase__ : Optional[Any] = arr.split(...
152
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_ima...
646
0
"""simple docstring""" from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def SCREAMING_SNAKE_CASE__ ( ) -> Union[str, Any]: lowercase__: List[str] = HfArgumentParser(_lowerCamelCase ) lowercase__: Tuple = parser.parse_args_into_dataclasses()...
586
"""simple docstring""" 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...
646
0
'''simple docstring''' import json import os import unittest from typing import Tuple from transformers import WavaVecaPhonemeCTCTokenizer from transformers.models.wavaveca.tokenization_wavaveca import VOCAB_FILES_NAMES from transformers.models.wavaveca_phoneme.tokenization_wavaveca_phoneme import ...
430
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''naver-clova-ix/donut-base''': '''https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json''', # See all Donut models at https://h...
646
0
def UpperCAmelCase_ ( UpperCAmelCase__ = 1_0_0 ): lowercase_ = 0 lowercase_ = 0 for i in range(1 , n + 1 ): sum_of_squares += i**2 sum_of_ints += i return sum_of_ints**2 - sum_of_squares if __name__ == "__main__": print(F'''{solutio...
412
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''SenseTime/deformable-detr''': '''https://huggingface.co/sensetime/deformable-detr/resolve/main/config.j...
646
0
'''simple docstring''' import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from pathlib ...
566
"""simple docstring""" import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowercase_ ( _lowerCamelCase: Any , _lowerCamelCase: int , _lowerCamelCase: Union[str, Any] ) ...
646
0
import argparse import os import re import zipfile import torch from transformers import AutoTokenizer, GPTaConfig def lowerCamelCase__ ( _lowercase , _lowercase , _lowercase=0 ): '''simple docstring''' if name is None: UpperCAmelCase_ : Dict = None e...
30
"""simple docstring""" import math from collections.abc import Iterator from itertools import takewhile def lowercase_ ( _lowerCamelCase: int ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or n...
646
0
"""simple docstring""" import copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, Ty...
19
"""simple docstring""" from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge __A = [ '''Prosecutor: "No videos were used in the crash investigation" German papers say they saw a cell phone video of t...
646
0
import math from collections.abc import Iterator from itertools import takewhile def _SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE ): 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 mu...
590
"""simple docstring""" from manim import * class _snake_case ( a__ ): def lowerCamelCase__ ( self : str ): __lowerCamelCase : Tuple = Rectangle(height=0.5 , width=0.5 ) __lowerCamelCase : Dict = Rectangle(height=...
646
0
A_ = {str(digit): digit**5 for digit in range(10)} def __UpperCAmelCase ( UpperCAmelCase )-> int: """simple docstring""" return sum(DIGITS_FIFTH_POWER[digit] for digit in str(_lowerCamelCase ) ) def __UpperCAmel...
604
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
646
0
def lowerCamelCase( a__ ,a__): return price * (1 + tax_rate) if __name__ == "__main__": print(f"""{price_plus_tax(1_00, 0.25) = }""") print(f"""{price_plus_tax(1_25.50, 0.05) = }""")
691
"""simple docstring""" import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 __A = 0b101100111110110010010000011110111011000110011110 # bin(x)...
646
0
import random from .binary_exp_mod import bin_exp_mod def _snake_case ( lowerCAmelCase : Tuple , lowerCAmelCase : str=1_0_0_0 ): """simple docstring""" if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd SCREAMING_SNAKE_CASE_ : Optio...
216
"""simple docstring""" # Imports import numpy as np class _snake_case : def __init__( self : Union[str, Any] , UpperCAmelCase : Dict=None , UpperCAmelCase : Any=None , UpperCAmelCase : Optional[int]=None , UpperCAmelCase : ...
646
0
'''simple docstring''' from decimal import Decimal, getcontext from math import ceil, factorial def __UpperCamelCase ( UpperCAmelCase ): if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError('''Undefined for non-integers''' ) elif precision < 1: raise ValueError('''Undefined for no...
152
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...te...
646
0
"""simple docstring""" import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( '''files''' , [ ['''full:README.md''', '''dataset_infos.json'''], ['''empty:README.md...
586
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backbo...
646
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase : int = { "configuration_nezha": ["NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP", "NezhaConfig"], } ...
430
"""simple docstring""" import math def lowercase_ ( _lowerCamelCase: int ) -> list[int]: '''simple docstring''' __lowerCamelCase : Optional[int] = [] __lowerCamelCase : Tuple = 2 __lowerCamelCase : str = int(math.sqrt(_lowerCamelCase ) ...
646
0
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class UpperCamelCase__ ( unittest.TestCase ): def UpperCAmelCase__ ( self : Dict ): '''simple docstring''' ...
412
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers i...
646
0
'''simple docstring''' import copy import tempfile import unittest from huggingface_hub import HfFolder, delete_repo from parameterized import parameterized from requests.exceptions import HTTPError from transformers import AutoConfig, GenerationConfig from transformers.testing_utils import TOKEN, USER, is_stagin...
566
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer __A = log...
646
0
from typing import TYPE_CHECKING from ....utils import _LazyModule __a = {'tokenization_tapex': ['TapexTokenizer']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys __a = _LazyModule(__name__, globals()['__file__'], _import_struc...
30
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __A = logging.get_logger(__name__) class _snake_case ( a__ ): def __init__( self : Optional[Any] , *UpperCAmelCase : int , **...
646
0
"""simple docstring""" from __future__ import annotations from random import random from typing import Generic, TypeVar _a = TypeVar("""KT""") _a = TypeVar("""VT""") class _UpperCAmelCase( Generic[KT, VT] ): def __init__( self ...
19
"""simple docstring""" import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp...
646
0
from math import ceil, sqrt def _SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE = 1_000_000 ): A_ : Dict = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: A_ : Tuple = max(ceil(sqrt(outer_width**2 - limit ) ) , ...
590
"""simple docstring""" from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("repo_id" , ["canonical_dataset_name", "org-name/dataset-name"] ) @pytest.mark.parametrize("path" , ["filename.csv", "filename with blanks.csv"] ) @pytest.mark.parame...
646
0
import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __UpperCAm...
604
"""simple docstring""" import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class _snake_case ( ctypes.Structure ): # _fields is a specific attr expected by ctypes snake_case__ = [("...
646
0
from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge snake_case_ : List[Any] = [ '''Prosecutor: "No videos were used in the crash investigation" German papers say they saw a cell phone v...
691
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTe...
646
0
def _snake_case ( lowerCAmelCase : int ): """simple docstring""" if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise ValueError("multiplicative_persistence() only accepts integral values" ) if num < 0: raise ValueError("multiplicative_persistence() does not a...
216
"""simple docstring""" def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float ) -> float: '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(F"""{price_plus_tax(100, 0.25) = }""") print(F"""{price_plus_tax(1_25.50, 0.05) =...
646
0
'''simple docstring''' import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class UpperCAmelCase ( a__ ): '''simple...
152
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_ima...
646
0
"""simple docstring""" import argparse import logging import os import re import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, DataCollatorForLanguageModeling, PushToHubCallback, TFAutoModelForMaskedLM, create_optimizer, ) __A = logging.getLogger(__na...
586
"""simple docstring""" 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...
646
0
'''simple docstring''' from typing import Union import fire import torch from tqdm import tqdm def __lowerCamelCase ( A__ , A__ = "cpu" , A__ = None ) -> None: """simple docstring""" UpperCamelCase = torch.load(...
430
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''naver-clova-ix/donut-base''': '''https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json''', # See all Donut models at https://h...
646
0
from __future__ import annotations def UpperCAmelCase_ ( UpperCAmelCase__ , UpperCAmelCase__ ): if len(_lowerCamelCase ) < k or k < 0: raise ValueError("""Invalid Input""" ) lowercase_ = sum(array[:k] ) for i in range(len(_lowerCamelCase ) - k ): lower...
412
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''SenseTime/deformable-detr''': '''https://huggingface.co/sensetime/deformable-detr/resolve/main/config.j...
646
0
'''simple docstring''' import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate snake_case : List[str] = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow('', ...
566
"""simple docstring""" import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowercase_ ( _lowerCamelCase: Any , _lowerCamelCase: int , _lowerCamelCase: Union[str, Any] ) ...
646
0
import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils import cached_property from ...test_...
30
"""simple docstring""" import math from collections.abc import Iterator from itertools import takewhile def lowercase_ ( _lowerCamelCase: int ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or n...
646
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { """EleutherAI/gpt-neox-20b""": """https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/config.json""", # See all...
19
"""simple docstring""" from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge __A = [ '''Prosecutor: "No videos were used in the crash investigation" German papers say they saw a cell phone video of t...
646
0
import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterMixin from ...tes...
590
"""simple docstring""" from manim import * class _snake_case ( a__ ): def lowerCamelCase__ ( self : str ): __lowerCamelCase : Tuple = Rectangle(height=0.5 , width=0.5 ) __lowerCamelCase : Dict = Rectangle(height=...
646
0
from json import JSONDecodeError # Workaround for requests.exceptions.JSONDecodeError import requests def __UpperCAmelCase ( UpperCAmelCase = "isbn/0140328726" )-> dict: """simple docstring""" lowercase = olid.strip().strip('''/''' ...
604
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
646
0
import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowerCamelCase( a__ ,a__ ,a__): _SCREAMING_SNAKE_CASE =AlbertConfig.from_json_file(_lowerCamelCase) print(f"Bui...
691
"""simple docstring""" import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 __A = 0b101100111110110010010000011110111011000110011110 # bin(x)...
646
0
from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import floats_tensor, ids_tensor, rando...
216
"""simple docstring""" # Imports import numpy as np class _snake_case : def __init__( self : Union[str, Any] , UpperCAmelCase : Dict=None , UpperCAmelCase : Any=None , UpperCAmelCase : Optional[int]=None , UpperCAmelCase : ...
646
0
'''simple docstring''' import logging import os from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union from filelock import FileLock from transformers import PreTrainedTokenizer, is_tf_available, is_torch_available __a: Any = logging.getLogger(__name__) @datacl...
152
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...te...
646
0
"""simple docstring""" from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def SCREAMING_SNAKE_CASE__ ( __UpperCAmelCase ) -> bool: lowercase__: int = int(number**0.5 ) return number == sq * sq def SCREAMING_SNAKE_CASE__ ( __UpperCAm...
586
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backbo...
646
0
'''simple docstring''' from ..models.whisper import WhisperForConditionalGeneration, WhisperProcessor from .base import PipelineTool class SCREAMING_SNAKE_CASE ( a__ ): """simple docstring""" _SCREAMING_SNAKE_CASE = """openai/whisper-base""" ...
430
"""simple docstring""" import math def lowercase_ ( _lowerCamelCase: int ) -> list[int]: '''simple docstring''' __lowerCamelCase : Optional[int] = [] __lowerCamelCase : Tuple = 2 __lowerCamelCase : str = int(math.sqrt(_lowerCamelCase ) ...
646
0
import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Acc...
412
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers i...
646
0
'''simple docstring''' import json import os import shutil import warnings from argparse import ArgumentParser, Namespace from pathlib import Path from typing import List from ..utils import logging from . import BaseTransformersCLICommand try: from cookiecutter.main import cookiecutter snake_case : Tu...
566
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer __A = log...
646
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __a = logging.get_logger(__name__) __a = { 'kssteven/ibert-roberta-base': 'https://huggingface.co/ksst...
30
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __A = logging.get_logger(__name__) class _snake_case ( a__ ): def __init__( self : Optional[Any] , *UpperCAmelCase : int , **...
646
0
"""simple docstring""" def lowerCamelCase__ ( __snake_case ) -> Tuple: """simple docstring""" if not head: return True # split the list to two parts _UpperCamelCase = head.next, head while fast and fast.next: ...
19
"""simple docstring""" import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp...
646
0
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def _SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE ): A_ : Tuple = prime_factors(_lowerCamelCase ) if is_square_free(_lowerCamelCase ): return -1 if len(_lowerCamelCase ) % 2 else ...
590
"""simple docstring""" from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("repo_id" , ["canonical_dataset_name", "org-name/dataset-name"] ) @pytest.mark.parametrize("path" , ["filename.csv", "filename with blanks.csv"] ) @pytest.mark.parame...
646
0
def __UpperCAmelCase ( UpperCAmelCase )-> bool: """simple docstring""" return number & 1 == 0 if __name__ == "__main__": import doctest doctest.testmod()
604
"""simple docstring""" import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class _snake_case ( ctypes.Structure ): # _fields is a specific attr expected by ctypes snake_case__ = [("...
646
0
snake_case_ : Any = {} def lowerCamelCase( a__ ,a__ ,a__): if late == 3 or absent == 2: return 0 # if we have no days left, and have not failed any other rules, # we have a prize string if days == 0: return 1 # No easy solution, so now we ...
691
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTe...
646
0
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase : Union[str, Any] = logging.get_logger(__name__) __lowerCamelCase : Optional[int] = { '''huggingface/time-series-transformer-tourism-mont...
216
"""simple docstring""" def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float ) -> float: '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(F"""{price_plus_tax(100, 0.25) = }""") print(F"""{price_plus_tax(1_25.50, 0.05) =...
646
0
'''simple docstring''' import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ( Bit...
152
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_ima...
646
0
"""simple docstring""" import datasets from .evaluate import evaluate __A = "\\n@article{hendrycks2021cuad,\n title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review},\n author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball},\n journal={arXiv preprint arX...
586
"""simple docstring""" 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...
646
0
'''simple docstring''' from __future__ import annotations from collections.abc import Callable def __lowerCamelCase ( A__ , A__ , A__ , A__ = 100 , ) -> float: """simple docstring""" UpperCamelCase = x_sta...
430
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''naver-clova-ix/donut-base''': '''https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json''', # See all Donut models at https://h...
646
0
from ...configuration_utils import PretrainedConfig from ...utils import logging a = logging.get_logger(__name__) a = {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/config.json'} class UpperCamelCase__ ( a__ ): __SCREAMING_SNAKE_CASE : Optional[int] ...
412
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''SenseTime/deformable-detr''': '''https://huggingface.co/sensetime/deformable-detr/resolve/main/config.j...
646
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case : List[Any] = { 'configuration_git': ['GIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GitConfig', 'GitVisionConfig'], 'processing_git': ['GitProcessor'], ...
566
"""simple docstring""" import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowercase_ ( _lowerCamelCase: Any , _lowerCamelCase: int , _lowerCamelCase: Union[str, Any] ) ...
646
0
import operator as op __a = 'scaler.pt' __a = 'pytorch_model' __a = 'random_states' __a = 'optimizer' __a = 'scheduler' __a = 'pytorch_model.bin' __a = 'pytorch_model.bin.index.json' __a = 'mod...
30
"""simple docstring""" import math from collections.abc import Iterator from itertools import takewhile def lowercase_ ( _lowerCamelCase: int ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or n...
646
0
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { """microsoft/unispeech-sat-base-100h-libri-ft""": ( """https://huggingface.co/...
19
"""simple docstring""" from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge __A = [ '''Prosecutor: "No videos were used in the crash investigation" German papers say they saw a cell phone video of t...
646
0
import unittest from transformers import MPNetConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from ...test_pipeline_mixin...
590
"""simple docstring""" from manim import * class _snake_case ( a__ ): def lowerCamelCase__ ( self : str ): __lowerCamelCase : Tuple = Rectangle(height=0.5 , width=0.5 ) __lowerCamelCase : Dict = Rectangle(height=...
646
0
from __future__ import annotations import math def __UpperCAmelCase ( UpperCAmelCase )-> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: ...
604
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
646
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case_ : Optional[int] = { '''configuration_upernet''': ['''UperNetConfig'''], } try: if not is_torch_available(): raise OptionalDependencyNotAvail...
691
"""simple docstring""" import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 __A = 0b101100111110110010010000011110111011000110011110 # bin(x)...
646
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCamelCase : str = logging.get_logger(__name__) __lowerCamelCase : Dict = { '''facebook/xmod-ba...
216
"""simple docstring""" # Imports import numpy as np class _snake_case : def __init__( self : Union[str, Any] , UpperCAmelCase : Dict=None , UpperCAmelCase : Any=None , UpperCAmelCase : Optional[int]=None , UpperCAmelCase : ...
646
0
'''simple docstring''' import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, require_tf,...
152
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...te...
646
0
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = {"vocab_file...
586
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backbo...
646
0
'''simple docstring''' from queue import PriorityQueue from typing import Any import numpy as np def __lowerCamelCase ( A__ , A__ , A__ , A__ , A__ , A__ , A__ , A__ , A__ , ) -> float | int: ...
430
"""simple docstring""" import math def lowercase_ ( _lowerCamelCase: int ) -> list[int]: '''simple docstring''' __lowerCamelCase : Optional[int] = [] __lowerCamelCase : Tuple = 2 __lowerCamelCase : str = int(math.sqrt(_lowerCamelCase ) ...
646
0
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaControlnetImgaImgPipeline, KandinskyVaaPriorEmbaEmbPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, l...
412
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers i...
646
0
'''simple docstring''' snake_case : int = { 'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', 'U': '..-',...
566
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer __A = log...
646
0
from typing import Any class __a: """simple docstring""" def __init__( self ,_SCREAMING_SNAKE_CASE ) -> Dict: UpperCAmelCase_ : Tuple = data UpperCAmelCase_ : List[Any] = None def __repr__( self ) -> Any: r...
30
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __A = logging.get_logger(__name__) class _snake_case ( a__ ): def __init__( self : Optional[Any] , *UpperCAmelCase : int , **...
646
0
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _a = logging.get_logger(__name__) _a = { """microsoft/git-base""": """https://huggingface.co/microsoft/git-base/r...
19
"""simple docstring""" import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp...
646
0
from typing import Dict, Optional import numpy as np import datasets UpperCamelCase = """ IoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union between the predicted segmentation and the ground truth. For binary (two classes) or multi-cl...
590
"""simple docstring""" from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("repo_id" , ["canonical_dataset_name", "org-name/dataset-name"] ) @pytest.mark.parametrize("path" , ["filename.csv", "filename with blanks.csv"] ) @pytest.mark.parame...
646
0
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...
604
"""simple docstring""" import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class _snake_case ( ctypes.Structure ): # _fields is a specific attr expected by ctypes snake_case__ = [("...
646
0
class A__ : def __init__( self : int , _a : list[int] ) -> Any: """simple docstring""" _SCREAMING_SNAKE_CASE =len(_a ) _SCREAMING_SNAKE_CASE =[0] * len_array if len_array > 0: _SCREAMING_SNAKE...
691
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTe...
646
0
import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae_attention_paths, renew_v...
216
"""simple docstring""" def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float ) -> float: '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(F"""{price_plus_tax(100, 0.25) = }""") print(F"""{price_plus_tax(1_25.50, 0.05) =...
646
0
'''simple docstring''' from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize('''repo_id''' , ['''canonical_dataset_name''', '''org-name/dataset-name'''] ) @pytest.mark.parametrize('''path''' , ['''filename.csv''', '''filename with blanks.csv'''] ) @...
152
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_ima...
646
0
"""simple docstring""" import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class UpperCAmelCase : """simple docstring""" _UpperCAmelCase :str = None _UpperCAmelCase :List[Any] = False...
586
"""simple docstring""" 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...
646
0
'''simple docstring''' import requests from bsa import BeautifulSoup def __lowerCamelCase ( A__ , A__ ) -> str: """simple docstring""" UpperCamelCase = BeautifulSoup(requests.get(_lowerCamelCase , params=_lowerCamel...
430
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''naver-clova-ix/donut-base''': '''https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json''', # See all Donut models at https://h...
646
0
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 = logging.get_logger(__name__) def UpperCAmelCase_ ( UpperCAmelCase__ , UpperCAmelCase__ ): lowercase_ ...
412
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''SenseTime/deformable-detr''': '''https://huggingface.co/sensetime/deformable-detr/resolve/main/config.j...
646
0
'''simple docstring''' import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() snake_case : str = logging.get_logger('transformers.models.speecht5') def lowercase__ ( __UpperCamelCase : ...
566
"""simple docstring""" import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowercase_ ( _lowerCamelCase: Any , _lowerCamelCase: int , _lowerCamelCase: Union[str, Any] ) ...
646
0
import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @require_sentencepiece @require_...
30
"""simple docstring""" import math from collections.abc import Iterator from itertools import takewhile def lowercase_ ( _lowerCamelCase: int ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or n...
646
0
"""simple docstring""" import numpy as np class _UpperCAmelCase: def __init__( self , __a=None , __a=None , __a=None , __a=None , __a=None) -> List[str]: '''simple docstring''' self.set_mat...
19
"""simple docstring""" from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge __A = [ '''Prosecutor: "No videos were used in the crash investigation" German papers say they saw a cell phone video of t...
646
0
def _SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE ): 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] A_ : Optional[Any] = ...
590
"""simple docstring""" from manim import * class _snake_case ( a__ ): def lowerCamelCase__ ( self : str ): __lowerCamelCase : Tuple = Rectangle(height=0.5 , width=0.5 ) __lowerCamelCase : Dict = Rectangle(height=...
646
0
from math import factorial def __UpperCAmelCase ( UpperCAmelCase = 20 )-> int: """simple docstring""" lowercase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... lowercase = n // 2 ...
604
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
646
0
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_image, load_numpy, slow, tor...
691
"""simple docstring""" import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 __A = 0b101100111110110010010000011110111011000110011110 # bin(x)...
646
0
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class a__ ( a__ ): def __init__( self : Union[str, Any],_A : Callable,_A : Optional[Features] = None,_A : str = Non...
216
"""simple docstring""" # Imports import numpy as np class _snake_case : def __init__( self : Union[str, Any] , UpperCAmelCase : Dict=None , UpperCAmelCase : Any=None , UpperCAmelCase : Optional[int]=None , UpperCAmelCase : ...
646
0
'''simple docstring''' from __future__ import annotations def __UpperCamelCase ( UpperCAmelCase , UpperCAmelCase ): lowercase__ : list[list[int]] = [] lowercase__ : list[int] = [] lowercase__ : str = 0 lowercase__ : Optio...
152
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...te...
646
0
"""simple docstring""" from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from ....
586
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backbo...
646
0
import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCallback, TrainingArgumen...
647
import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_ful...
647
1
def lowerCAmelCase__ ( lowerCamelCase_ : str = "The quick brown fox jumps over the lazy dog" ,): '''simple docstring''' lowerCAmelCase__ : Any = set() # Replace all the whitespace in our sentence lowerCAmelCase__ : Tuple = input_str.replace(''' '...
647
from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.rob...
647
1
from __future__ import annotations class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase ,__lowerCamelCase ) -> Any: """simple docstring""" lowerCAmelCase__ , lowerCAmelCase__ : int = text, pattern lowerCAme...
647
__snake_case : str ='\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' __snake_case : ...
647
1
from scipy.stats import pearsonr import datasets __snake_case : List[str] ='\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...
647
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) de...
647
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : List[str] =logging.get_logger(__name__) __snake_case : List[Any] ={ 'uw-madison/mra-base-512-4': 'https://huggingface.co/uw-madison/mra-base-512-4/resolve/main/config.json', } cl...
647
import requests __snake_case : Optional[int] ='YOUR API KEY' def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : str = giphy_api_key): '''simple docstring''' lowerCAmelCase__ : Tuple = '''+'''.join(query.split()) lo...
647
1
import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_backbone_common import Bac...
647
from collections.abc import Callable class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase = None ) -> None: """simple docstring""" lowerCAmelCase__ : list = [] # Stores indexes of each item for supporting updates and ...
647
1
def lowerCAmelCase__ ( ): '''simple docstring''' return 1 def lowerCAmelCase__ ( lowerCamelCase_ : int): '''simple docstring''' return 0 if x < 0 else two_pence(x - 2) + one_pence() def lowerCAmelCase__ ( lowerCamel...
647
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoToke...
647
1
def lowerCAmelCase__ ( lowerCamelCase_ : int = 10**9): '''simple docstring''' lowerCAmelCase__ : Tuple = 1 lowerCAmelCase__ : Tuple = 2 lowerCAmelCase__ : List[Any] = 0 lowerCAmelCase__ : List[str] = 0 lowerCAmelCase__ : ...
647
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ =(KDPMaDiscreteScheduler,) snake_case_ =10 def...
647
1
import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor __snake_case : Dict =logging.get_logger(__name__) class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' def __init__(self ,*__lowerCamelCase ,**__l...
647
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class lowerCamelCase__ ( unittest.TestCase): '''simple docstring''' def lowerCAmelCase__ (self ) -> str: """simple docstring""" ...
647
1
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class lowerCamelCase__ ( unittest.TestCase): '''simple docstring''' def lowerCAmelCase__ (self ) -> str: """simple docstring""" ...
647
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin __snake_case : List[Any] =get_tests_dir('fixtures/test_sent...
647
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __snake_case : List[Any] =logging.get_logger(__name__) __snake_case : str ={ 'roberta-base': 'https:/...
647
import math import unittest def lowerCAmelCase__ ( lowerCamelCase_ : int): '''simple docstring''' assert isinstance(lowerCamelCase_ ,lowerCamelCase_) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 a...
647
1
import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class lowerCamelCase__ ( unittest.TestCase): '''simple docstrin...
647
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging import get_logg...
647
1
def lowerCAmelCase__ ( lowerCamelCase_ : list[list]): '''simple docstring''' lowerCAmelCase__ : Union[str, Any] = current_set.copy() for row_index, row in enumerate(lowerCamelCase_): lowerCAmelCase__ : List[Any] = row[0] for column_index...
647
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs if is_torch_available(): import ...
647
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __snake_case : int ={ 'configuration_mobilenet_v2': [ 'MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileNetV2Config', 'MobileNe...
647
def lowerCAmelCase__ ( lowerCamelCase_ : Dict): '''simple docstring''' lowerCAmelCase__ : Optional[Any] = len(lowerCamelCase_) while cur > 1: # Find the maximum number in arr lowerCAmelCase__ : Tuple = arr.index(max(arr[0:cur])) ...
647
1
from math import asin, atan, cos, radians, sin, sqrt, tan __snake_case : str =6378137.0 __snake_case : Optional[int] =6356752.314245 __snake_case : List[str] =6_3_7_8_1_3_7 def lowerCAmelCase__ ( lowerCamelCase_ : float ,lowerCamelC...
647
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner import Split, To...
647
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 appli...
647
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __snake_case : int ={ 'configuration_gpt_bigcode': ['GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTBigCodeConfig'], } try: if not is_torch_available...
647
1
import argparse import re from flax.traverse_util import flatten_dict, unflatten_dict from tax import checkpoints from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration from transformers.modeling_flax_pytorch_utils import load_flax_weights_in_pytorch_model from transformers....
647
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class lowerCamelCase__ : '''simple docstring''' snake_case_ =None snake_case_ =False snake_case_ =False snake_case_ =False snake_case_ =Non...
647
1
import inspect import unittest from transformers import SegformerConfig, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_comm...
647
def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int]): '''simple docstring''' lowerCAmelCase__ : int = (boundary[1] - boundary[0]) / steps lowerCAmelCase__ : Optional[int] = boundary[0] lowerCAmelCase__ : ...
647
1
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner import Split, To...
647
from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFMode...
647
1
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_numpy, slow,...
647
import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_con...
647
1