code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> int: """simple docstring""" if n == 1 or not isinstance(__UpperCamelCase , __UpperCamelCase ): return 0 elif n == 2: return 1 else: A__ : Any = [0, 1] ...
55
import logging import torch from accelerate import Accelerator from arguments import EvaluationArguments from datasets import load_dataset from torch.utils.data import IterableDataset from torch.utils.data.dataloader import DataLoader from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParser, se...
55
1
from numpy import exp, pi, sqrt def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Dict , __UpperCamelCase : float = 0.0 , __UpperCamelCase : float = 1.0 ) -> int: """simple docstring""" return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu)...
55
def SCREAMING_SNAKE_CASE ( ) -> Optional[int]: """simple docstring""" A__ : Optional[Any] = 0 for i in range(1 , 10_01 ): total += i**i return str(__UpperCamelCase )[-10:] if __name__ == "__main__": print(solution())
55
1
def SCREAMING_SNAKE_CASE ( ) -> list[list[int]]: """simple docstring""" return [list(range(10_00 - i , -10_00 - i , -1 ) ) for i in range(10_00 )] _SCREAMING_SNAKE_CASE : Tuple = generate_large_matrix() _SCREAMING_SNAKE_CAS...
55
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils import patch_environme...
55
1
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class UpperCamelCase__ ( SCREAMING_SNAKE_CASE_ ): ''...
55
from numpy import exp, pi, sqrt def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Dict , __UpperCamelCase : float = 0.0 , __UpperCamelCase : float = 1.0 ) -> int: """simple docstring""" return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu)...
55
1
import itertools import math def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> 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: # Negatives, 0, 1, all e...
55
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : int = { 'configuration_bert...
55
1
import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from transformers.utils import WEIGHT...
55
import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXT...
55
1
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int , __UpperCamelCase : int ) -> int: """simple docstring""" return int((input_a, input_a).count(1 ) != 0 ) def SCREAMING_SNAKE_CASE ( ) -> None: """simple docstring""" ...
55
from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCamelCase__ ( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' @staticmethod @abstractmethod def __snake_case ( UpperCamelCase__ ): raise NotImplementedError() @abstractmethod def __sna...
55
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch...
55
import inspect import unittest from transformers import YolosConfig 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_model...
55
1
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import List import timm import torch import torch.nn as nn from huggingface_hub import hf_hub_download from torch import Tensor from transformers import AutoImageProcessor, ResNetCo...
55
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> int: """simple docstring""" if n == 1 or not isinstance(__UpperCamelCase , __UpperCamelCase ): return 0 elif n == 2: return 1 else: A__ : Any = [0, 1] ...
55
1
import os import sys import unittest _SCREAMING_SNAKE_CASE : Union[str, Any] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create...
55
_SCREAMING_SNAKE_CASE : List[str] = range(2, 2_0 + 1) _SCREAMING_SNAKE_CASE : Optional[Any] = [1_0**k for k in range(ks[-1] + 1)] _SCREAMING_SNAKE_CASE : dict[int, dict[int, list[list[int]]]] = {} def SCREAMING_SNAKE_CASE ( __UpperCamelCase : ...
55
1
import inspect import unittest from transformers import YolosConfig 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_model...
55
import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..state import AcceleratorState, PartialState from...
55
1
import copy from collections import OrderedDict from typing import Dict, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING _SCREAMING_SNAKE_CASE : Tuple = logging...
55
import numpy as np _SCREAMING_SNAKE_CASE : Any = [ ['a', 'b', 'c', 'd', 'e'], ['f', 'g', 'h', 'i', 'k'], ['l', 'm', 'n', 'o', 'p'], ['q', 'r', 's', 't', 'u'], ['v', 'w', 'x', 'y', 'z'], ] class UpperCamelCase__ : '''simple docstring''' def __init__( self...
55
1
import qiskit def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int , __UpperCamelCase : int ) -> qiskit.result.counts.Counts: """simple docstring""" A__ : str = qiskit.Aer.get_backend('''aer_simulator''' ) # Create a Quantum Circuit ...
55
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 OptionalDependencyNotAvailable: from ....
55
1
from bisect import bisect from itertools import accumulate def SCREAMING_SNAKE_CASE ( __UpperCamelCase : str , __UpperCamelCase : Optional[Any] , __UpperCamelCase : int , __UpperCamelCase : Optional[Any] ) -> Union[str, Any]: """simple...
55
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 from accelerate import Accelerator, Dist...
55
1
from __future__ import annotations import math import random from typing import Any class UpperCamelCase__ : '''simple docstring''' def __init__( self ): A__ : list[Any] = [] A__ : int = 0 A__ : int = 0 def __snake_case (...
55
# 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 by app...
55
1
import logging import torch from accelerate import Accelerator from arguments import EvaluationArguments from datasets import load_dataset from torch.utils.data import IterableDataset from torch.utils.data.dataloader import DataLoader from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParser, se...
55
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation _SCREAMING_SNAKE_CASE : ...
55
1
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=SCREAMING_SNAKE_CASE_ ) class UpperCamelCase__ ( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' # `task` is not a Class...
55
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _SCREAMING_SNAKE_CASE : Union[str, Any] = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : int = { 'SenseTime/deformable-detr': 'https://huggi...
55
1
import json import os import tempfile from unittest.mock import patch import torch from torch.utils.data import DataLoader, TensorDataset from accelerate import DistributedType, infer_auto_device_map, init_empty_weights from accelerate.accelerator import Accelerator from accelerate.state import GradientState, Partia...
55
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> List[Any]: """simple docstring""" A__ : Optional[Any] = 0 A__ : Optional[Any] = len(__UpperCamelCase ) for i in range(n - 1 ): for j in range(i + 1 , ...
55
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _SCREAMING_SNAKE_CASE : int = { 'configuration_nezha': ['NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'NezhaConfig'], } try: if not is_torch_available(...
55
from PIL import Image def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Image , __UpperCamelCase : float ) -> Image: """simple docstring""" def brightness(__UpperCamelCase : int ) -> float: return 1_28 + level + (c - 1_28) if not -2_5_5...
55
1
import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils import logging if version.parse(fairseq.__vers...
55
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class UpperCamelCase__ : '''simple docstring''' _lowerCAmelCase = None def __snake_case ( self ): A__ : Dict = self.feature_extraction_cla...
55
1
import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, requir...
55
import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _SCREAMING_SNAKE_CASE : Union[str, Any] = '\\n@inproceedings{snover-etal-2006-study,\n title = "A Study of Translation Edit Rate with Targeted Human Annotation",\n author = "Snover, Matthew and\...
55
1
import random def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Dict , __UpperCamelCase : str , __UpperCamelCase : str ) -> List[Any]: """simple docstring""" A__ : Optional[Any] = a[left_index] A__ : Any = left...
55
from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : Dict = logging.get_logger(__name__) # TODO Update this _SCREAMING_SNAKE_CASE : Optional[int] = { '...
55
1
import asyncio import os import re import sys import tempfile import unittest from contextlib import contextmanager from copy import deepcopy from distutils.util import strtobool from enum import Enum from importlib.util import find_spec from pathlib import Path from unittest.mock import patch import pyarrow as pa im...
55
import logging import torch from accelerate import Accelerator from arguments import EvaluationArguments from datasets import load_dataset from torch.utils.data import IterableDataset from torch.utils.data.dataloader import DataLoader from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParser, se...
55
1
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : str , __UpperCamelCase : str ) -> Any: """simple docstring""" assert x is not None assert y is not None A__ : int = len(__UpperCamelCase ) A__ : Union[str, Any] = ...
55
def SCREAMING_SNAKE_CASE ( ) -> Optional[int]: """simple docstring""" A__ : Optional[Any] = 0 for i in range(1 , 10_01 ): total += i**i return str(__UpperCamelCase )[-10:] if __name__ == "__main__": print(solution())
55
1
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int = 10 , __UpperCamelCase : int = 10_00 , __UpperCamelCase : bool = True ) -> int: """simple docstring""" assert ( isinstance(__UpperCamelCase , __UpperCamelCase ) ...
55
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils import patch_environme...
55
1
from sklearn.metrics import fa_score import datasets _SCREAMING_SNAKE_CASE : List[str] = '\nThe F1 score is the harmonic mean of the precision and recall. It can be computed with the equation:\nF1 = 2 * (precision * recall) / (precision + recall)\n' _SCREAMING_SNAKE_CASE : Any ...
55
from numpy import exp, pi, sqrt def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Dict , __UpperCamelCase : float = 0.0 , __UpperCamelCase : float = 1.0 ) -> int: """simple docstring""" return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu)...
55
1
import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available, is_vision_available from ....
55
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : int = { 'configuration_bert...
55
1
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) _SCREAMING_SNAKE_CASE : Optional[Any] = pytest.mark.integration @pytest.mark.parametrize('''pa...
55
import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXT...
55
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _SCREAMING_SNAKE_CASE : Optional[int] = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE ...
55
from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCamelCase__ ( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' @staticmethod @abstractmethod def __snake_case ( UpperCamelCase__ ): raise NotImplementedError() @abstractmethod def __sna...
55
1
import pandas as pd from matplotlib import pyplot as plt from sklearn.linear_model import LinearRegression # Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split # Fitting Polynomial Regression to the dataset from sklearn.preprocessing import PolynomialFeature...
55
import inspect import unittest from transformers import YolosConfig 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_model...
55
1
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class UpperCamelCase__ : '''simple docstring''' _lowerCAmelCase = None def __snake_case ( self ): A__ : Dict = self.feature_extraction_cla...
55
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> int: """simple docstring""" if n == 1 or not isinstance(__UpperCamelCase , __UpperCamelCase ): return 0 elif n == 2: return 1 else: A__ : Any = [0, 1] ...
55
1
import math def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> bool: """simple docstring""" return math.sqrt(__UpperCamelCase ) * math.sqrt(__UpperCamelCase ) == num def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> bool...
55
_SCREAMING_SNAKE_CASE : List[str] = range(2, 2_0 + 1) _SCREAMING_SNAKE_CASE : Optional[Any] = [1_0**k for k in range(ks[-1] + 1)] _SCREAMING_SNAKE_CASE : dict[int, dict[int, list[list[int]]]] = {} def SCREAMING_SNAKE_CASE ( __UpperCamelCase : ...
55
1
import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCamelCase__ ( SCREAMING_SNAKE_CASE_, unittest.TestCase ): '''simple docstring''' _lowerCA...
55
import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..state import AcceleratorState, PartialState from...
55
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : int = { 'configuration_bert...
55
import numpy as np _SCREAMING_SNAKE_CASE : Any = [ ['a', 'b', 'c', 'd', 'e'], ['f', 'g', 'h', 'i', 'k'], ['l', 'm', 'n', 'o', 'p'], ['q', 'r', 's', 't', 'u'], ['v', 'w', 'x', 'y', 'z'], ] class UpperCamelCase__ : '''simple docstring''' def __init__( self...
55
1
import os def SCREAMING_SNAKE_CASE ( ) -> Optional[Any]: """simple docstring""" A__ : List[Any] = os.path.dirname(os.path.realpath(__UpperCamelCase ) ) A__ : int = os.path.join(__UpperCamelCase , '''triangle.txt''' ) ...
55
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 OptionalDependencyNotAvailable: from ....
55
1
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation _SCREAMING_SNAKE_CASE : ...
55
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 from accelerate import Accelerator, Dist...
55
1
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from ...test_pipe...
55
# 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 by app...
55
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _SCREAMING_SNAKE_CASE : Tuple = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : List[Any] = { ...
55
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation _SCREAMING_SNAKE_CASE : ...
55
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _SCREAMING_SNAKE_CASE : Any = '▁' _SCREAMING_SNAKE_CASE : Any = {'vocab_fil...
55
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _SCREAMING_SNAKE_CASE : Union[str, Any] = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : int = { 'SenseTime/deformable-detr': 'https://huggi...
55
1
import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def SCREAMING_SNAKE_CASE ( __UpperCamelCase : str , __UpperCamelCase : str , **__UpperCamelCase : Optional[int] ) -> int: """simple docstring""" A__ : i...
55
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> List[Any]: """simple docstring""" A__ : Optional[Any] = 0 A__ : Optional[Any] = len(__UpperCamelCase ) for i in range(n - 1 ): for j in range(i + 1 , ...
55
1
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 TFModelTe...
55
from PIL import Image def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Image , __UpperCamelCase : float ) -> Image: """simple docstring""" def brightness(__UpperCamelCase : int ) -> float: return 1_28 + level + (c - 1_28) if not -2_5_5...
55
1
import argparse import json from collections import OrderedDict import torch from huggingface_hub import cached_download, hf_hub_url from transformers import AutoImageProcessor, CvtConfig, CvtForImageClassification def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Union[str, Any] ) -> Dict...
55
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class UpperCamelCase__ : '''simple docstring''' _lowerCAmelCase = None def __snake_case ( self ): A__ : Dict = self.feature_extraction_cla...
55
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch...
55
import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _SCREAMING_SNAKE_CASE : Union[str, Any] = '\\n@inproceedings{snover-etal-2006-study,\n title = "A Study of Translation Edit Rate with Targeted Human Annotation",\n author = "Snover, Matthew and\...
55
1
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _SCREAMING_SNAKE_CASE : Union[str, Any] = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : int = { 'SenseTime/deformable-detr': 'https://huggi...
55
from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : Dict = logging.get_logger(__name__) # TODO Update this _SCREAMING_SNAKE_CASE : Optional[int] = { '...
55
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : str = { # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert } class UpperCamel...
55
import logging import torch from accelerate import Accelerator from arguments import EvaluationArguments from datasets import load_dataset from torch.utils.data import IterableDataset from torch.utils.data.dataloader import DataLoader from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParser, se...
55
1
from PIL import Image def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Image , __UpperCamelCase : float ) -> Image: """simple docstring""" def brightness(__UpperCamelCase : int ) -> float: return 1_28 + level + (c - 1_28) if not -2_5_5...
55
def SCREAMING_SNAKE_CASE ( ) -> Optional[int]: """simple docstring""" A__ : Optional[Any] = 0 for i in range(1 , 10_01 ): total += i**i return str(__UpperCamelCase )[-10:] if __name__ == "__main__": print(solution())
55
1
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BlipaProcessor, BlipImageProcess...
55
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils import patch_environme...
55
1
_SCREAMING_SNAKE_CASE : Union[str, Any] = {str(digit): digit**5 for digit in range(1_0)} def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> int: """simple docstring""" return sum(DIGITS_FIFTH_POWER[digit] for digit in str(__UpperCamelCase ) ...
55
from numpy import exp, pi, sqrt def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Dict , __UpperCamelCase : float = 0.0 , __UpperCamelCase : float = 1.0 ) -> int: """simple docstring""" return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu)...
55
1
from collections import deque from math import floor from random import random from time import time class UpperCamelCase__ : '''simple docstring''' def __init__( self ): A__ : int = {} def __snake_case ( self , UpperCamelCase__ , UpperCamelC...
55
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : int = { 'configuration_bert...
55
1
from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : Dict = { 'nielsr/canine-s': 2_0_4_8, } # Unicode defi...
55
import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXT...
55
1
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class UpperCamelCase__ ( SCR...
55
from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCamelCase__ ( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' @staticmethod @abstractmethod def __snake_case ( UpperCamelCase__ ): raise NotImplementedError() @abstractmethod def __sna...
55
1
import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..state import AcceleratorState, PartialState from...
55
import inspect import unittest from transformers import YolosConfig 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_model...
55
1
from __future__ import annotations import bisect def SCREAMING_SNAKE_CASE ( __UpperCamelCase : list[int] , __UpperCamelCase : int , __UpperCamelCase : int = 0 , __UpperCamelCase : int = -1 ) -> int: """simple docstring""" i...
55
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> int: """simple docstring""" if n == 1 or not isinstance(__UpperCamelCase , __UpperCamelCase ): return 0 elif n == 2: return 1 else: A__ : Any = [0, 1] ...
55
1
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : dict ) -> bool: """simple docstring""" A__ : set[int] = set() # To detect a back edge, keep track of vertices currently in the recursion stack A__ : set[int] = set() return any( ...
55
_SCREAMING_SNAKE_CASE : List[str] = range(2, 2_0 + 1) _SCREAMING_SNAKE_CASE : Optional[Any] = [1_0**k for k in range(ks[-1] + 1)] _SCREAMING_SNAKE_CASE : dict[int, dict[int, list[list[int]]]] = {} def SCREAMING_SNAKE_CASE ( __UpperCamelCase : ...
55
1
import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import Tenso...
55
import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..state import AcceleratorState, PartialState from...
55
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE : Tuple = { 'configuration_swinv2': ['SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Swinv2Config'], } try: if not is_torch_available(): raise ...
55
import numpy as np _SCREAMING_SNAKE_CASE : Any = [ ['a', 'b', 'c', 'd', 'e'], ['f', 'g', 'h', 'i', 'k'], ['l', 'm', 'n', 'o', 'p'], ['q', 'r', 's', 't', 'u'], ['v', 'w', 'x', 'y', 'z'], ] class UpperCamelCase__ : '''simple docstring''' def __init__( self...
55
1
import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class UpperCamelCase__ ( pl.LightningModule ): '''simple docstring''' def __init__( self , UpperCamelCase__ ): super()...
55
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 OptionalDependencyNotAvailable: from ....
55
1
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf _SCREAMING_SNAKE_CASE : Optional[Any] = logg...
55
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 from accelerate import Accelerator, Dist...
55
1
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : str = "The quick brown fox jumps over the lazy dog" , ) -> bool: """simple docstring""" A__ : List[Any] = set() # Replace all the whitespace in our sentence A__ : Optional[int] = inpu...
55
# 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 by app...
55
1
import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteSche...
55
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation _SCREAMING_SNAKE_CASE : ...
55
1
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_utils import PILImageResampling f...
55
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _SCREAMING_SNAKE_CASE : Union[str, Any] = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : int = { 'SenseTime/deformable-detr': 'https://huggi...
55
1
import unittest from transformers import AutoConfig, AutoTokenizer, BertConfig, TensorType, is_flax_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, slow if is_flax_available(): import jax from transformers.models.auto.modeling_flax_auto import FlaxAutoModel f...
55
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> List[Any]: """simple docstring""" A__ : Optional[Any] = 0 A__ : Optional[Any] = len(__UpperCamelCase ) for i in range(n - 1 ): for j in range(i + 1 , ...
55
1
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> List[Any]: """simple docstring""" A__ : Optional[Any] = 0 A__ : Optional[Any] = len(__UpperCamelCase ) for i in range(n - 1 ): for j in range(i + 1 , ...
55
from PIL import Image def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Image , __UpperCamelCase : float ) -> Image: """simple docstring""" def brightness(__UpperCamelCase : int ) -> float: return 1_28 + level + (c - 1_28) if not -2_5_5...
55
1
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int = 10_00 ) -> int: """simple docstring""" A__ , A__ : List[str] = 1, 1 A__ : List[Any] = [] for i in range(1 , n + 1 ): A__ : List[str] = ...
55
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class UpperCamelCase__ : '''simple docstring''' _lowerCAmelCase = None def __snake_case ( self ): A__ : Dict = self.feature_extraction_cla...
55
1
_SCREAMING_SNAKE_CASE : str = [0, 2, 4, 6, 8] _SCREAMING_SNAKE_CASE : int = [1, 3, 5, 7, 9] def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int , __UpperCamelCase : int , __UpperCamelCase : list[int] , __UpperCamelCase : ...
55
import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _SCREAMING_SNAKE_CASE : Union[str, Any] = '\\n@inproceedings{snover-etal-2006-study,\n title = "A Study of Translation Edit Rate with Targeted Human Annotation",\n author = "Snover, Matthew and\...
55
1
import argparse import json from typing import List from ltp import LTP from transformers.models.bert.tokenization_bert import BertTokenizer def SCREAMING_SNAKE_CASE ( __UpperCamelCase : List[str] ) -> int: """simple docstring""" if ( (cp >= 0X4e00 and cp <= 0X9...
55
from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : Dict = logging.get_logger(__name__) # TODO Update this _SCREAMING_SNAKE_CASE : Optional[int] = { '...
55
1
from collections import namedtuple import requests from lxml import html # type: ignore _SCREAMING_SNAKE_CASE : Union[str, Any] = namedtuple('covid_data', 'cases deaths recovered') def SCREAMING_SNAKE_CASE ( __UpperCamelCase : str = "https://www.worldometers.info/coronavirus/" ...
55
import logging import torch from accelerate import Accelerator from arguments import EvaluationArguments from datasets import load_dataset from torch.utils.data import IterableDataset from torch.utils.data.dataloader import DataLoader from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParser, se...
55
1
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Namespace ) -> List[str]: """simple docstring""" return ConvertCommand( args.model_type , ...
55
def SCREAMING_SNAKE_CASE ( ) -> Optional[int]: """simple docstring""" A__ : Optional[Any] = 0 for i in range(1 , 10_01 ): total += i**i return str(__UpperCamelCase )[-10:] if __name__ == "__main__": print(solution())
55
1
import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformers.utils import logging lo...
55
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils import patch_environme...
55
1
import os import unittest from transformers import LayoutLMTokenizer, LayoutLMTokenizerFast from transformers.models.layoutlm.tokenization_layoutlm import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizer...
55
from numpy import exp, pi, sqrt def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Dict , __UpperCamelCase : float = 0.0 , __UpperCamelCase : float = 1.0 ) -> int: """simple docstring""" return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu)...
55
1
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torchaudio_available from ...test_configur...
55
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : int = { 'configuration_bert...
55
1
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 _SCR...
55
import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXT...
55
1
import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _SCREAMING_SNAKE_CASE : Union[str, Any] = logging.get_logger(__name__) _SCREAMING_SNA...
55
from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCamelCase__ ( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' @staticmethod @abstractmethod def __snake_case ( UpperCamelCase__ ): raise NotImplementedError() @abstractmethod def __sna...
55
1
import unittest from typing import Tuple import torch from diffusers.utils import floats_tensor, randn_tensor, torch_all_close, torch_device from diffusers.utils.testing_utils import require_torch @require_torch class UpperCamelCase__ : '''simple docstring''' @property def __snake_case (...
55
import inspect import unittest from transformers import YolosConfig 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_model...
55
1
import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels _SCREAMING_SNAKE_CASE : Union[str, Any] = object() # For specifying empty leaf dict `{}` _SCREAMING_SNAKE_CASE : Opti...
55
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> int: """simple docstring""" if n == 1 or not isinstance(__UpperCamelCase , __UpperCamelCase ): return 0 elif n == 2: return 1 else: A__ : Any = [0, 1] ...
55
1
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class UpperCamelCase__ : '''simple docstring''' def __init__( self , UpperCamelCase__ = None ): if components is None: A__ : Optional[int] ...
55
_SCREAMING_SNAKE_CASE : List[str] = range(2, 2_0 + 1) _SCREAMING_SNAKE_CASE : Optional[Any] = [1_0**k for k in range(ks[-1] + 1)] _SCREAMING_SNAKE_CASE : dict[int, dict[int, list[list[int]]]] = {} def SCREAMING_SNAKE_CASE ( __UpperCamelCase : ...
55
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE : Optional[Any] = {'configuration_sew': ['SEW_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SEWConfig']} try: if not is_torch_available(): raise OptionalD...
55
import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..state import AcceleratorState, PartialState from...
55
1
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( AutoProcessor, BertTokenize...
55
import numpy as np _SCREAMING_SNAKE_CASE : Any = [ ['a', 'b', 'c', 'd', 'e'], ['f', 'g', 'h', 'i', 'k'], ['l', 'm', 'n', 'o', 'p'], ['q', 'r', 's', 't', 'u'], ['v', 'w', 'x', 'y', 'z'], ] class UpperCamelCase__ : '''simple docstring''' def __init__( self...
55
1
import json import os import unittest from transformers.models.roc_bert.tokenization_roc_bert import ( VOCAB_FILES_NAMES, RoCBertBasicTokenizer, RoCBertTokenizer, RoCBertWordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils import require_token...
55
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 OptionalDependencyNotAvailable: from ....
55
1
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_funnel import FunnelTokenizer _SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) _SCREAM...
55
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 from accelerate import Accelerator, Dist...
55
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import load_numpy, slow ...
55
# 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 by app...
55
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : int = { 'configuration_lxmert': ['LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LxmertConf...
55
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation _SCREAMING_SNAKE_CASE : ...
55
1
from queue import PriorityQueue from typing import Any import numpy as np def SCREAMING_SNAKE_CASE ( __UpperCamelCase : dict , __UpperCamelCase : str , __UpperCamelCase : set , __UpperCamelCase : set , __UpperCamelCase : dict , ...
55
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _SCREAMING_SNAKE_CASE : Union[str, Any] = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : int = { 'SenseTime/deformable-detr': 'https://huggi...
55
1
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 from ...test_modeling_common import ModelTes...
55
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> List[Any]: """simple docstring""" A__ : Optional[Any] = 0 A__ : Optional[Any] = len(__UpperCamelCase ) for i in range(n - 1 ): for j in range(i + 1 , ...
55
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : Union[str, Any] = { 'tiiuae/falcon-40b': 'https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json', ...
55
from PIL import Image def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Image , __UpperCamelCase : float ) -> Image: """simple docstring""" def brightness(__UpperCamelCase : int ) -> float: return 1_28 + level + (c - 1_28) if not -2_5_5...
55
1
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def SCREAMING_SNAKE_CASE ( __UpperCamelCase : BertModel , __UpperCamelCase : str , __UpperCamelCase : str ) -> Optional[int]: """sim...
55
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class UpperCamelCase__ : '''simple docstring''' _lowerCAmelCase = None def __snake_case ( self ): A__ : Dict = self.feature_extraction_cla...
55
1
import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ...
55
import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _SCREAMING_SNAKE_CASE : Union[str, Any] = '\\n@inproceedings{snover-etal-2006-study,\n title = "A Study of Translation Edit Rate with Targeted Human Annotation",\n author = "Snover, Matthew and\...
55
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE : Optional[Any] = { 'configuration_pegasus_x': ['PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PegasusXConfig'], } try: if not is_torch_available(): ...
55
from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : Dict = logging.get_logger(__name__) # TODO Update this _SCREAMING_SNAKE_CASE : Optional[int] = { '...
55
1
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class UpperCamelCase__ ( SCREAMING_SNAKE_CASE_ ): '''simple docstr...
55
import logging import torch from accelerate import Accelerator from arguments import EvaluationArguments from datasets import load_dataset from torch.utils.data import IterableDataset from torch.utils.data.dataloader import DataLoader from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParser, se...
55
1
import copy import os import cva import numpy as np from matplotlib import pyplot as plt class UpperCamelCase__ : '''simple docstring''' def __init__( self ): A__ : List[str] = '''''' A__ : int = '''''' A__ : Any = [] A__ : An...
55
def SCREAMING_SNAKE_CASE ( ) -> Optional[int]: """simple docstring""" A__ : Optional[Any] = 0 for i in range(1 , 10_01 ): total += i**i return str(__UpperCamelCase )[-10:] if __name__ == "__main__": print(solution())
55
1
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging loggi...
55
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils import patch_environme...
55
1
import collections import importlib.util import os import re from pathlib import Path _SCREAMING_SNAKE_CASE : List[str] = 'src/transformers' # Matches is_xxx_available() _SCREAMING_SNAKE_CASE : Union[str, Any] = re.compile(r'is\_([a-z_]*)_available()') # Catches a one-line _im...
55
from numpy import exp, pi, sqrt def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Dict , __UpperCamelCase : float = 0.0 , __UpperCamelCase : float = 1.0 ) -> int: """simple docstring""" return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu)...
55
1
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_modeling_comm...
55
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : int = { 'configuration_bert...
55
1
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : str , __UpperCamelCase : str ) -> int: """simple docstring""" if len(__UpperCamelCase ) != len(__UpperCamelCase ): raise ValueError('''String lengths must match!''' ) A__ : Any ...
55
import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXT...
55
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : Dict = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : int = { 'caidas/swin2sr-classicalsr-x2-64': ( 'https://huggingface.co/caidas/swin2sr-classicalsr-x2-6...
55
from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCamelCase__ ( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' @staticmethod @abstractmethod def __snake_case ( UpperCamelCase__ ): raise NotImplementedError() @abstractmethod def __sna...
55
1
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Tuple ) -> ...
55
import inspect import unittest from transformers import YolosConfig 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_model...
55
1
from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils import stable_softmax if is_tor...
55
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> int: """simple docstring""" if n == 1 or not isinstance(__UpperCamelCase , __UpperCamelCase ): return 0 elif n == 2: return 1 else: A__ : Any = [0, 1] ...
55
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : Optional[int] = { 'configuration_deberta': ['DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP',...
55
_SCREAMING_SNAKE_CASE : List[str] = range(2, 2_0 + 1) _SCREAMING_SNAKE_CASE : Optional[Any] = [1_0**k for k in range(ks[-1] + 1)] _SCREAMING_SNAKE_CASE : dict[int, dict[int, list[list[int]]]] = {} def SCREAMING_SNAKE_CASE ( __UpperCamelCase : ...
55
1
import os import zipfile import pytest from datasets.utils.extract import ( BzipaExtractor, Extractor, GzipExtractor, LzaExtractor, SevenZipExtractor, TarExtractor, XzExtractor, ZipExtractor, ZstdExtractor, ) from .utils import require_lza, require_pyazr, require_zstandard @pyte...
55
import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..state import AcceleratorState, PartialState from...
55
1
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int = 4_00_00_00 ) -> int: """simple docstring""" A__ : Any = [0, 1] A__ : Optional[int] = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: ...
55
import numpy as np _SCREAMING_SNAKE_CASE : Any = [ ['a', 'b', 'c', 'd', 'e'], ['f', 'g', 'h', 'i', 'k'], ['l', 'm', 'n', 'o', 'p'], ['q', 'r', 's', 't', 'u'], ['v', 'w', 'x', 'y', 'z'], ] class UpperCamelCase__ : '''simple docstring''' def __init__( self...
55
1