code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" from typing import Any class __A : """simple docstring""" def __init__( self , __A ) -> Union[str, Any]: a =data a =None class __A : """simple docstring""" ...
81
from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature from ....file_utils import Pa...
300
0
def _UpperCAmelCase ( snake_case , snake_case ): """simple docstring""" _lowerCAmelCase = [1] for i in range(2 , snake_case ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" _lowerCAmelCase ...
82
from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class __magic_n...
300
0
'''simple docstring''' import csv from collections import defaultdict from dataclasses import dataclass, field from typing import List, Optional import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import ScalarFormatter from transformers import HfArgumentParser def A__ ( UpperCA...
83
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor _lowerCAmelCase : Tuple = logging.get_logger(__name__) class __magic_name__ ( lowerCamelCase__ ): """simple docstring""" def __init__( self :Unio...
300
0
"""simple docstring""" import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available(): ...
84
from __future__ import annotations def __snake_case ( _lowerCAmelCase : list[float] ) -> bool: if len(_lowerCAmelCase ) < 2: raise ValueError("Monogons and Digons are not polygons in the Euclidean space" ) if any(i <= 0 for i in nums ): raise ValueError("All values...
300
0
'''simple docstring''' import math def UpperCamelCase_( snake_case : int = 1_0_0 ): '''simple docstring''' snake_case_ = sum(i * i for i in range(1 , n + 1 ) ) snake_case_ = int(math.pow(sum(range(1 , n + 1 ) ...
85
import inspect from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion import Stabl...
300
0
"""simple docstring""" import enum import warnings from .. import MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING from ..utils import add_end_docstrings, is_tf_available from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf class A__ ( enum...
86
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging _lowerCAmelCase : List[str] = logging.get_logger(__name__) def __snake_case ( _lowerCAmelCase : int , _lowerCAmelCase : Any ) ...
300
0
import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": UpperCamelCase = pd.read_csv('''sample_data.csv''', header=None) UpperCamelCas...
87
import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from transformers.utils imp...
300
0
import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test_mode...
88
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor fr...
300
0
'''simple docstring''' 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_...
89
from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def __snake_case ( _lowerCAmelCase : str , _lowerCAmelCase : float | Decimal , _lowerCAmelCase : float = 10**-10 ) -> float: A_ : Dict ...
300
0
from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
90
import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowerCAmelCase : List[Any] = '''\ @inproceedings{snover-etal-2006-study, title = "A Study of Translation Edit Rate with Targeted Human Annotation", author = "Snover, Matthew and Dorr,...
300
0
"""simple docstring""" from __future__ import annotations import math def _A (__a , __a , __a , __a , __a ) -> int: """simple docstring""" if depth < 0: raise ValueError('''Depth cannot be less than 0''' ) if not scores: ...
91
def __snake_case ( _lowerCAmelCase : List[str] , _lowerCAmelCase : int ) -> str: return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def __snake_case ( _lowerCAmelCase : int , _lowerCAmelCase : Union[str, Any]=0 ) -> ...
300
0
# 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 appl...
92
import inspect import unittest from transformers import ViTMSNConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test...
300
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...
93
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class __magic_name__ ( lowerCamelCase__ ): """simple docstring""" __UpperCamelCase = (DDPMScheduler,) def SCREAMING_SNAKE_CASE ( self :Union[s...
300
0
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Optional[int] = logging.get_logger(__name__) snake_case : Optional[int] = { '''abeja/gpt-neox-japanese-2.7b''': '''https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/m...
94
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, W...
300
0
from importlib import import_module from .logging import get_logger UpperCAmelCase : int = get_logger(__name__) class __lowerCAmelCase : def __init__( self , lowerCAmelCase__ , lowerCAmelCase__=None ) -> Tuple: ...
95
from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, ra...
300
0
"""simple docstring""" import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def _snake_case ( l...
96
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
300
0
'''simple docstring''' from ... import PretrainedConfig __snake_case = { '''sijunhe/nezha-cn-base''': '''https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json''', } class lowercase ( A__ ): """simple docstring""" _a = NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP...
97
def __snake_case ( _lowerCAmelCase : list ) -> list: if len(_lowerCAmelCase ) <= 1: return [tuple(_lowerCAmelCase )] A_ : Tuple = [] def generate(_lowerCAmelCase : int , _lowerCAmelCase : list ): A_ : List[str] = [0]...
300
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kand...
98
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta import RobertaTokenizer ...
300
0
import random class A__ : """simple docstring""" @staticmethod def __lowercase ( lowercase) -> tuple[list[int], list[int]]: '''simple docstring''' a__ : Union[str, Any] = [ord(lowercase) for i in text] a__ : int = []...
99
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo _lowerCAmelCase : int = '''\ @misc{wu2016googles, title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation}, author=...
300
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __magic_name__ = {"configuration_opt": ["OPT_PRETRAINED_CONFIG_ARCHIVE_M...
100
import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size from ..utils import assert_arrow_...
300
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowercase__ :Union[str, Any] = {"configuration_unispeech": ["UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP", "UniSpeechConfig"]} try: ...
101
import json import unittest import numpy as np from huggingface_hub import hf_hub_download 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, prep...
300
0
"""simple docstring""" from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_c...
102
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 : List[str] = logging.get_logger(__name__) _lowerCAmelCase : O...
300
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A__ : str = {'''configuration_deit''': ['''DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''DeiTConfig''', '''DeiTOnnxConfig''...
103
from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature from ....file_utils import Pa...
300
0
'''simple docstring''' import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unord...
104
from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class __magic_n...
300
0
"""simple docstring""" from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from...
105
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor _lowerCAmelCase : Tuple = logging.get_logger(__name__) class __magic_name__ ( lowerCamelCase__ ): """simple docstring""" def __init__( self :Unio...
300
0
"""simple docstring""" import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def __SCREAMING_SNAKE_CASE ( A_ ): lowerCAmelCase__ : Union[str, Any] = FileLock(str(tmpdir / '''foo.lock''' ) ) lowerCAmelCase__ : Dict = FileLock(str(tmpdir / '''foo...
106
from __future__ import annotations def __snake_case ( _lowerCAmelCase : list[float] ) -> bool: if len(_lowerCAmelCase ) < 2: raise ValueError("Monogons and Digons are not polygons in the Euclidean space" ) if any(i <= 0 for i in nums ): raise ValueError("All values...
300
0
from typing import Dict, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import flip_channel_order, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ( ChannelDimension, ImageInput...
107
import inspect from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion import Stabl...
300
0
"""simple docstring""" import unittest import torch from torch import nn from diffusers.models.activations import get_activation class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): """simple docstring""" def lowercase__ ( self ): """simple...
108
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging _lowerCAmelCase : List[str] = logging.get_logger(__name__) def __snake_case ( _lowerCAmelCase : int , _lowerCAmelCase : Any ) ...
300
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A: int = {"configuration_deit": ["DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "DeiTConfig", "DeiTOnnxConfi...
109
import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from transformers.utils imp...
300
0
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py _UpperCamelCase = '''\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, title ...
254
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor fr...
300
0
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def UpperCamelCase (lowercase_: List[str] , lowercase_: Optional[Any]=None ) -> List[Any]: A__ : str = None if token is not ...
192
from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def __snake_case ( _lowerCAmelCase : str , _lowerCAmelCase : float | Decimal , _lowerCAmelCase : float = 10**-10 ) -> float: A_ : Dict ...
300
0
"""simple docstring""" import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import six ...
335
import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowerCAmelCase : List[Any] = '''\ @inproceedings{snover-etal-2006-study, title = "A Study of Translation Edit Rate with Targeted Human Annotation", author = "Snover, Matthew and Dorr,...
300
0
'''simple docstring''' from __future__ import annotations from math import pi # Define the Reduced Planck Constant ℏ (H bar), speed of light C, value of # Pi and the function _lowerCAmelCase = 1.054571817e-34 # unit of ℏ : J * s _lowerCAmelCase = 3e8 # unit of c : m * s^-1 def _SC...
37
def __snake_case ( _lowerCAmelCase : List[str] , _lowerCAmelCase : int ) -> str: return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def __snake_case ( _lowerCAmelCase : int , _lowerCAmelCase : Union[str, Any]=0 ) -> ...
300
0
import io import itertools import json from dataclasses import dataclass from typing import Optional import pyarrow as pa import pyarrow.json as paj import datasets from datasets.table import table_cast from datasets.utils.file_utils import readline a__ : List[str] = datasets.utils.logging.get_logge...
313
import inspect import unittest from transformers import ViTMSNConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test...
300
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 ...test_...
15
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class __magic_name__ ( lowerCamelCase__ ): """simple docstring""" __UpperCamelCase = (DDPMScheduler,) def SCREAMING_SNAKE_CASE ( self :Union[s...
300
0
import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def _a ( SCREAMING_SNAKE_CASE ): # picklable for multiprocessing """simp...
110
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, W...
300
0
"""simple docstring""" import cmath import math def lowercase_ ( _snake_case ,_snake_case ,_snake_case ,_snake_case ): SCREAMING_SNAKE_CASE__ : str = math.radians(_lowerCAmelCase ) SCREAMING_SNAKE_CASE__ : int = math.radians...
25
from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, ra...
300
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 transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils ...
290
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
300
0
"""simple docstring""" import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings __Upper...
113
def __snake_case ( _lowerCAmelCase : list ) -> list: if len(_lowerCAmelCase ) <= 1: return [tuple(_lowerCAmelCase )] A_ : Tuple = [] def generate(_lowerCAmelCase : int , _lowerCAmelCase : list ): A_ : List[str] = [0]...
300
0
import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weights from .datacla...
322
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta import RobertaTokenizer ...
300
0
'''simple docstring''' import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStruct...
254
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo _lowerCAmelCase : int = '''\ @misc{wu2016googles, title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation}, author=...
300
0
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class _a (lowerCamelCase__ ): '''simple docstring''' UpperCAmelCase__: List[Any] = (DDPMScheduler,) def __A ( self , **A__ ): A__ :...
192
import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size from ..utils import assert_arrow_...
300
0
"""simple docstring""" 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...
335
import json import unittest import numpy as np from huggingface_hub import hf_hub_download 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, prep...
300
0
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
37
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 : List[str] = logging.get_logger(__name__) _lowerCAmelCase : O...
300
0
from ....utils import logging a__ : str = logging.get_logger(__name__) class a_ ( lowerCamelCase__ ): """simple docstring""" def __init__( self , _lowerCamelCase , _lowerCamelCase=None , _lowerCamelCase=2048 ) ->Dict: ...
313
from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature from ....file_utils import Pa...
300
0
def UpperCAmelCase ( a_ ) -> None: """simple docstring""" __A = generate_pascal_triangle(_lowerCAmelCase ) for row_idx in range(_lowerCAmelCase ): # Print left spaces for _ in range(num_rows - row_idx - 1 ): print(end=" " ) ...
15
from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class __magic_n...
300
0
import sys import turtle def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_S...
110
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor _lowerCAmelCase : Tuple = logging.get_logger(__name__) class __magic_name__ ( lowerCamelCase__ ): """simple docstring""" def __init__( self :Unio...
300
0
"""simple docstring""" from __future__ import annotations def lowercase_ ( _snake_case ,_snake_case ,_snake_case ,_snake_case ): if (direction == 1 and array[indexa] > array[indexa]) or ( direction == 0 and array[indexa] < array[indexa] ): SCREAMING...
25
from __future__ import annotations def __snake_case ( _lowerCAmelCase : list[float] ) -> bool: if len(_lowerCAmelCase ) < 2: raise ValueError("Monogons and Digons are not polygons in the Euclidean space" ) if any(i <= 0 for i in nums ): raise ValueError("All values...
300
0
"""simple docstring""" import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from tax import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffusers.pipelines.spectrogr...
290
import inspect from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion import Stabl...
300
0
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase ( lowerCamelCase__ ): '''simple docstring''' @staticmethod @abstractmethod def __A ( lowerCAmelCase__ ) -> Optional[...
113
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging _lowerCAmelCase : List[str] = logging.get_logger(__name__) def __snake_case ( _lowerCAmelCase : int , _lowerCAmelCase : Any ) ...
300
0
import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( '''The `inpainting.py` script is outdated. Please use directly `from diffusers import''' ''' StableDiffusionInpaintPipeline` instead.''' )
322
import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from transformers.utils imp...
300
0
'''simple docstring''' 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 requ...
254
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor fr...
300
0
import secrets from random import shuffle from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation def UpperCamelCase (lowercase_: int = 8 ) -> str: A__ : List[str] = ascii_letters + digits + punctuation return "".join(secrets.choice(_lowerCAme...
192
from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def __snake_case ( _lowerCAmelCase : str , _lowerCAmelCase : float | Decimal , _lowerCAmelCase : float = 10**-10 ) -> float: A_ : Dict ...
300
0
"""simple docstring""" import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE_ : List[Any] = logging.get_logger(__name__) class a ( lowerCamelCa...
335
import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowerCAmelCase : List[Any] = '''\ @inproceedings{snover-etal-2006-study, title = "A Study of Translation Edit Rate with Targeted Human Annotation", author = "Snover, Matthew and Dorr,...
300
0
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAva...
37
def __snake_case ( _lowerCAmelCase : List[str] , _lowerCAmelCase : int ) -> str: return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def __snake_case ( _lowerCAmelCase : int , _lowerCAmelCase : Union[str, Any]=0 ) -> ...
300
0
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta import RobertaTokenizer a__ ...
313
import inspect import unittest from transformers import ViTMSNConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test...
300
0
import copy import random from transformers import CLIPTokenizer class UpperCAmelCase ( lowerCamelCase__ ): '''simple docstring''' def __init__( self : Optional[Any] ,*A : str ,**A : Optional[int] ): super().__init__(*A ,**A ) __A = {} ...
15
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class __magic_name__ ( lowerCamelCase__ ): """simple docstring""" __UpperCamelCase = (DDPMScheduler,) def SCREAMING_SNAKE_CASE ( self :Union[s...
300
0
from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature from ....file_utils im...
110
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, W...
300
0
"""simple docstring""" from __future__ import annotations import math import numpy as np from numpy.linalg import norm def lowercase_ ( _snake_case ,_snake_case ): return math.sqrt(sum(pow(a - b ,2 ) for a, b in zip(_lowerCAmelCase ,_lowerCAmelCase ) ) ) ...
25
from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, ra...
300
0
"""simple docstring""" # Lint as: python3 import itertools import os import re lowercase__ = re.compile(r'([A-Z]+)([A-Z][a-z])') lowercase__ = re.compile(r'([a-z\d])([A-Z])') lowercase__ = re.compile(r'(?<!_)_(?!_)') lowercase__ = re.compile(r'(_{2,})') lowercase__ ...
290
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
300
0
"""simple docstring""" 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...
113
def __snake_case ( _lowerCAmelCase : list ) -> list: if len(_lowerCAmelCase ) <= 1: return [tuple(_lowerCAmelCase )] A_ : Tuple = [] def generate(_lowerCAmelCase : int , _lowerCAmelCase : list ): A_ : List[str] = [0]...
300
0
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp ...
322
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta import RobertaTokenizer ...
300
0
'''simple docstring''' from functools import lru_cache def lowercase_ ( lowerCAmelCase__ : int ): """simple docstring""" __UpperCAmelCase : str = 2 __UpperCAmelCase : Tuple = set() while i * i <= n: if n % i: i +=...
254
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo _lowerCAmelCase : int = '''\ @misc{wu2016googles, title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation}, author=...
300
0
from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline A_ : Dict = logging.get_logger(__name__) @add_en...
192
import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size from ..utils import assert_arrow_...
300
0
"""simple docstring""" import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def _snake_case ( UpperCAmelCase_ : int = 3 ): if isinstance(_lowerCAmelCase , _lowerCAmelCase ): ...
335
import json import unittest import numpy as np from huggingface_hub import hf_hub_download 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, prep...
300
0
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor ...
37
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 : List[str] = logging.get_logger(__name__) _lowerCAmelCase : O...
300
0
from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging a__ : int = logging.get_logger(__name__) def UpperCAmelCase_( a__ ): """simple docstring""" if isinstance(_lowerCAmelCase , np.ndarray ): ...
313
from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature from ....file_utils import Pa...
300
0
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu_available(check_device=False)...
15
from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class __magic_n...
300
0
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTimestepE...
110
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor _lowerCAmelCase : Tuple = logging.get_logger(__name__) class __magic_name__ ( lowerCamelCase__ ): """simple docstring""" def __init__( self :Unio...
300
0
"""simple docstring""" from .testing import ( are_the_same_tensors, execute_subprocess_async, require_bnb, require_cpu, require_cuda, require_huggingface_suite, require_mps, require_multi_gpu, require_multi_xpu, require_safetensors, require_single_gpu, ...
25
from __future__ import annotations def __snake_case ( _lowerCAmelCase : list[float] ) -> bool: if len(_lowerCAmelCase ) < 2: raise ValueError("Monogons and Digons are not polygons in the Euclidean space" ) if any(i <= 0 for i in nums ): raise ValueError("All values...
300
0
"""simple docstring""" def __a ( _SCREAMING_SNAKE_CASE ) ->int: assert column_title.isupper() a__: Tuple = 0 a__: Optional[Any] = len(_lowerCAmelCase ) - 1 a__: List[str] = 0 while index >= 0: a__: int = (ord(column_title[index] ) - 64) * ...
290
import inspect from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion import Stabl...
300
0
"""simple docstring""" def lowercase (SCREAMING_SNAKE_CASE_ : float , SCREAMING_SNAKE_CASE_ : int ) -> float: if digit_amount > 0: return round(number - int(_lowerCAmelCase ) , _lowerCAmelCase ) return number - int(_lowerCAmelCase ) if __name__...
113
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging _lowerCAmelCase : List[str] = logging.get_logger(__name__) def __snake_case ( _lowerCAmelCase : int , _lowerCAmelCase : Any ) ...
300
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _a = { '''configuration_rembert''': ['''REMBERT_PRETRAINED_CONFIG_ARC...
322
import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from transformers.utils imp...
300
0
'''simple docstring''' from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def lowercase_ ( lowerCAmelCase__ : str = "laptop" ): """simple docstring""" __UpperCAmelCase : str = f'https://ww...
254
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor fr...
300
0
import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY if is_vision_availa...
192
from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def __snake_case ( _lowerCAmelCase : str , _lowerCAmelCase : float | Decimal , _lowerCAmelCase : float = 10**-10 ) -> float: A_ : Dict ...
300
0
"""simple docstring""" import re from filelock import FileLock try: import nltk SCREAMING_SNAKE_CASE_ : int = True except (ImportError, ModuleNotFoundError): SCREAMING_SNAKE_CASE_ : Any = False if NLTK_AVAILABLE: with FileLock('.lock') as lock: nltk.do...
335
import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowerCAmelCase : List[Any] = '''\ @inproceedings{snover-etal-2006-study, title = "A Study of Translation Edit Rate with Targeted Human Annotation", author = "Snover, Matthew and Dorr,...
300
0
'''simple docstring''' import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, Aut...
37
def __snake_case ( _lowerCAmelCase : List[str] , _lowerCAmelCase : int ) -> str: return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def __snake_case ( _lowerCAmelCase : int , _lowerCAmelCase : Union[str, Any]=0 ) -> ...
300
0
def UpperCAmelCase_( a__ , a__ ): """simple docstring""" if density <= 0: raise ValueError('''Impossible fluid density''' ) if bulk_modulus <= 0: raise ValueError('''Impossible bulk modulus''' ) return (bulk_modulus / density) ** 0.5 if __name__ == "__...
313
import inspect import unittest from transformers import ViTMSNConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test...
300
0
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, slow from ...
15
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class __magic_name__ ( lowerCamelCase__ ): """simple docstring""" __UpperCamelCase = (DDPMScheduler,) def SCREAMING_SNAKE_CASE ( self :Union[s...
300
0
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_di...
110
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, W...
300
0
"""simple docstring""" import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester f...
25
from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, ra...
300
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 ( BitC...
290
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
300
0
"""simple docstring""" 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 lowerCAmelCase ( lowerCamelCase__ ): '''...
113
def __snake_case ( _lowerCAmelCase : list ) -> list: if len(_lowerCAmelCase ) <= 1: return [tuple(_lowerCAmelCase )] A_ : Tuple = [] def generate(_lowerCAmelCase : int , _lowerCAmelCase : list ): A_ : List[str] = [0]...
300
0
from __future__ import annotations def _a ( SCREAMING_SNAKE_CASE : list[float] ) -> bool: """simple docstring""" if len(_lowerCAmelCase ) < 2: raise ValueError('Monogons and Digons are not polygons in the Euclidean space' ) if any(i <= 0 for i in nums ): r...
322
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta import RobertaTokenizer ...
300
0
'''simple docstring''' from collections import defaultdict class _A : def __init__( self , __UpperCAmelCase , __UpperCAmelCase ) -> List[str]: '''simple docstring''' __UpperCAmelCase : Optional[int] = total # total no of tasks (N) ...
254
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo _lowerCAmelCase : int = '''\ @misc{wu2016googles, title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation}, author=...
300
0
import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets A_ : List[Any] = '''\ @inproceedings{snover-etal-2006-study, title = "A Study of Translation Edit Rate with Targeted Human Annotation", author = "Snover, Matthew and Dorr, Bonnie and ...
192
import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size from ..utils import assert_arrow_...
300
0
"""simple docstring""" from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse('3.8'): import importlib_metadata else: import importlib.metadata as importlib_metada...
335
import json import unittest import numpy as np from huggingface_hub import hf_hub_download 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, prep...
300
0
'''simple docstring''' import requests from bsa import BeautifulSoup def _SCREAMING_SNAKE_CASE ( UpperCamelCase , UpperCamelCase ): """simple docstring""" lowerCAmelCase__ : Tuple = BeautifulSoup(requests.get(_lowerCAmelCase , params=_lowerCAmelCas...
37
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 : List[str] = logging.get_logger(__name__) _lowerCAmelCase : O...
300
0
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : str = logging.get_logger(__name__) class a_ ( lowerCamelCase__ ): """simple docstring""" __SCREAMING_SNAKE_CASE : Union[str, Any] = 'timm_backbone' def __init_...
313
from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature from ....file_utils import Pa...
300
0
import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor SCREAMING_SNAKE_CASE :str = logging.get_logger(__name__) class UpperCAmelCase ( lowerCamelCase__ ): '''simple docstring''' def __init__( self : Optional[...
15
from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class __magic_n...
300
0
from PIL import Image def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = image.size lowercase__ = 0 lowercase__ = image.load() for i in range(_lowerCAmelCase ): for j in range(_lowerCAmelCase ):...
110
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor _lowerCAmelCase : Tuple = logging.get_logger(__name__) class __magic_name__ ( lowerCamelCase__ ): """simple docstring""" def __init__( self :Unio...
300
0
"""simple docstring""" class lowerCAmelCase_ : """simple docstring""" def __init__(self , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__=None , SCREAMING_SNAKE_CASE__=None ) -> str: """simple docstring""" SCREAMI...
25
from __future__ import annotations def __snake_case ( _lowerCAmelCase : list[float] ) -> bool: if len(_lowerCAmelCase ) < 2: raise ValueError("Monogons and Digons are not polygons in the Euclidean space" ) if any(i <= 0 for i in nums ): raise ValueError("All values...
300
0
"""simple docstring""" import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin from .feature_extraction_wavaveca import WavaVecaFeatureExtractor from .tokenization_wavaveca import WavaVecaCTCTokenizer class __snake_case ( lowerCamelCase__ ): a__ ...
290
import inspect from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion import Stabl...
300
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __UpperCamelCase = { '''configuration_robert...
113
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging _lowerCAmelCase : List[str] = logging.get_logger(__name__) def __snake_case ( _lowerCAmelCase : int , _lowerCAmelCase : Any ) ...
300
0
from __future__ import annotations _a = { '''A''': ['''B''', '''C''', '''E'''], '''B''': ['''A''', '''D''', '''E'''], '''C''': ['''A''', '''F''', '''G'''], '''D''': ['''B'''], '''E''': ['''A''', '''B''', '''D'''], '''F''': ['''C'''], '''G''': ['''C'''], } ...
322
import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from transformers.utils imp...
300
0
'''simple docstring''' from collections.abc import Callable import numpy as np def lowercase_ ( lowerCAmelCase__ : Callable , lowerCAmelCase__ : float , lowerCAmelCase__ : float , lowerCAmelCase__ : float , lowerCAmelCase__ : float ): ...
254
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor fr...
300
0
from typing import Any, Dict, List, Optional, Tuple, Union import torch from torch import nn from torch.utils.data import DistributedSampler, RandomSampler from transformers import PreTrainedModel, Trainer, logging from transformers.integrations import is_fairscale_available from transformers.models.fsmt.configurat...
192
from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def __snake_case ( _lowerCAmelCase : str , _lowerCAmelCase : float | Decimal , _lowerCAmelCase : float = 10**-10 ) -> float: A_ : Dict ...
300
0
"""simple docstring""" import argparse 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 ...
335
import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _lowerCAmelCase : List[Any] = '''\ @inproceedings{snover-etal-2006-study, title = "A Study of Translation Edit Rate with Targeted Human Annotation", author = "Snover, Matthew and Dorr,...
300
0
'''simple docstring''' from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelT...
37
def __snake_case ( _lowerCAmelCase : List[str] , _lowerCAmelCase : int ) -> str: return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def __snake_case ( _lowerCAmelCase : int , _lowerCAmelCase : Union[str, Any]=0 ) -> ...
300
0
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingfac...
313
import inspect import unittest from transformers import ViTMSNConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test...
300
0