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 : str ) -> list: """simple docstring""" return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(__UpperCamelCase ) ) if txt[a].isalpha() ] if __name__ == "__main__": __im...
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
# 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
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 Counter from timeit import timeit def SCREAMING_SNAKE_CASE ( __UpperCamelCase : str = "" , ) -> bool: """simple docstring""" return sum(c % 2 for c in Counter(input_str.replace(''' ''' , '''''' ).lower() ).values() ...
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 TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : Any = { 'configuration_xlm_ro...
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 contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, require_tf, require_torch from tra...
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 numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging _SCREAMING_SNAKE_CASE : Union[str, Any] = logging.get_logger(__name__) class UpperCamelCase__ ( SCREAMING_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
_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
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 itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast _SCREAMING_SNAKE_CASE : Optional[Any] = datasets.utils.logging.get_logger(__name__) @dataclass class...
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 itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def SCREAMING_SNAKE_CASE ( __UpperCamelCase : str = "laptop" ) -> DataFrame: """simple docstring""" A__ : List[Any] = F"https://www.amazon.in/lapto...
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_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : Union[str, Any] = { 'configuration_whisper': ['WHISPER_PRETRA...
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 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
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
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int = 10_00 ) -> int: """simple docstring""" return sum(e for e in range(3 , __UpperCamelCase ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(f"""{solution() = }""")
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 random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_available, is_tf_available, logging from .benchmark...
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 json import os import shutil import tempfile import unittest from multiprocessing import get_context from pathlib import Path import datasets import numpy as np from datasets import load_dataset from parameterized import parameterized from transformers import AutoProcessor from transformers.models.wavaveca im...
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 math import factorial _SCREAMING_SNAKE_CASE : dict[str, int] = {str(digit): factorial(digit) for digit in range(1_0)} def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> int: """simple docstring""" if not isinstance(__UpperCamelCase , ...
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
from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 _SCREAMING_SNAKE_CASE : Union[str, Any] = { # 1536-bit 5: { 'prime...
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 ..utils import DummyObject, requires_backends class UpperCamelCase__ ( metaclass=SCREAMING_SNAKE_CASE_ ): '''simple docstring''' _lowerCAmelCase = ["speech"] def __init__( self , *UpperCamelCase__ , **UpperCamelCase__ ): requires_backends(self...
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
from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
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
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE : Union[str, Any] = { 'configuration_autoformer': [ 'AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Aut...
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 __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar _SCREAMING_SNAKE_CASE : Any = TypeVar('T') _SCREAMING_SNAKE_CASE : Optional[int] = TypeVar('U') class UpperCamelCase__ ( Generic[T, U] ): '''simple d...
700
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
0
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch if is_tf_available(): ...
701
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
0
import json import os import re import unittest from transformers import CodeGenTokenizer, CodeGenTokenizerFast from transformers.models.codegen.tokenization_codegen import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin ...
702
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
0
from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class UpperCamelCase__ ( _SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__(...
703
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
0
import os # Precomputes a list of the 100 first triangular numbers _SCREAMING_SNAKE_CASE : List[Any] = [int(0.5 * n * (n + 1)) for n in range(1, 1_0_1)] def SCREAMING_SNAKE_CASE ( ) -> Optional[Any]: """simple docstring""" A__ : Dict = os.path.dirn...
704
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
0
import gc import unittest from transformers import CTRLConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMi...
705
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
0
import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import FlaxGenerationTeste...
706
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
0
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : str , __UpperCamelCase : str ) -> int: """simple docstring""" if len(__UpperCamelCase ) != len(__UpperCamelCase ): raise ValueError('''String lengths must match!''' ) A__ : Dict ...
707
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
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : int = { 'configuration_rembert': ['REMBERT_PRETRAINE...
708
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
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 FlaxTimestepEmbedding, FlaxT...
709
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
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE : Optional[Any] = {"configuration_focalnet": ["FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "FocalNetConfig"]} try: i...
710
_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
0
import math _SCREAMING_SNAKE_CASE : Any = 1_0 _SCREAMING_SNAKE_CASE : List[str] = 7 _SCREAMING_SNAKE_CASE : int = BALLS_PER_COLOUR * NUM_COLOURS def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int = 20 ) -> Optional[Any]: """si...
711
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
0
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Union[str, Any] ) -> list: """simple docstring""" for i in range(len(__lowerCAmelCase ) - 1 , 0 , -1 ): A__ : str = False for j in range(__lowerCAmel...
712
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
0
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : List[str] = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : Dict = { 'huggingface/time-series-transformer-tourism-monthly'...
713
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
0
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Optional[int] ) -> Tuple: """simple docstring""" if n_term == "": return [] A__ : List[str] = [] for temp in range(int(lowerCAmelCase__ ) ): series.append(F"1/{temp + 1}" if se...
714
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
0
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE : str = { "configuration_trajectory_transformer": [ "TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TrajectoryTransformerCo...
715
# 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
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : str = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : Any = { 'EleutherAI/gpt-neox-20b': 'https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/config.json', ...
716
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
0
import importlib import torch import yaml from omegaconf import OmegaConf from taming.models.vqgan import VQModel def SCREAMING_SNAKE_CASE ( __UpperCamelCase : List[Any] , __UpperCamelCase : List[str]=False ): """simple docstring""" A__ : Union[str, Any] ...
717
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
0
import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, Value, load_dataset from transformers import DPRContext...
718
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
0
from typing import Dict, List, Optional, Type from .. import config from ..utils import logging from .formatting import ( ArrowFormatter, CustomFormatter, Formatter, PandasFormatter, PythonFormatter, TensorFormatter, format_table, query_table, ) from .np_formatter import NumpyFormatter...
719
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
0
from collections import Counter from timeit import timeit def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Dict = "" , ) -> bool: """simple docstring""" return sum(c % 2 for c in Counter(input_str.replace(''' ''' , '''''' ).lower() ).values() ...
720
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
0
'''simple docstring''' from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record _SCREAMING_SNAKE_CASE : List[str] = '''\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose Languag...
721
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
0
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int = 10**9 ) -> Union[str, Any]: """simple docstring""" A__ : Union[str, Any] = 1 A__ : Optional[int] = 2 A__ : Union[str, Any] = 0 A__ : Any = 0 A__...
700
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
0
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Dict = 10 , __UpperCamelCase : Optional[int] = 22 ) -> int: """simple docstring""" A__ : Dict = range(1 , __SCREAMING_SNAKE_CASE ) A__ : Union[str, Any] = range...
701
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
0
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_torch_a...
702
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
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE : Optional[int] = { """configuration_clap""": [ """CLAP_PRETRAINED_MODEL_ARCHIVE_LIST""", """ClapAudioConfig""", """ClapConfig"""...
703
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
0
import operator as op def SCREAMING_SNAKE_CASE ( __UpperCamelCase : List[str] ) -> int: """simple docstring""" A__ : Union[str, Any] = [] A__ : Optional[Any] = lambda __UpperCamelCase , __UpperCamelCase : int(x / y ...
704
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
0
import unittest from transformers import SqueezeBertConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, ra...
705
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
0
import inspect import unittest class UpperCamelCase__ ( unittest.TestCase ): '''simple docstring''' def __snake_case ( self ): try: import diffusers # noqa: F401 except ImportError: assert False def __snake...
706
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
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : str = {'configuration_plbart': ['PLBART_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PLBa...
707
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
0
import itertools import os from collections import Counter, defaultdict from concurrent.futures import ThreadPoolExecutor, as_completed import numpy as np import datasets from .execute import check_correctness _SCREAMING_SNAKE_CASE : Dict = "\\n@misc{chen2021evaluating,\n title={Evaluating...
708
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
0
import fire from utils import calculate_rouge, save_json def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Tuple , __UpperCamelCase : List[str] , __UpperCamelCase : Tuple=None , **__UpperCamelCase : Optional[Any] ) -> List[Any]: """simple...
709
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
0
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepiece @slow # ...
710
_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
0
import numpy as np def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Tuple , __UpperCamelCase : Optional[int] ) -> Tuple: """simple docstring""" return np.where(vector > 0 , _snake_case , (alpha * (np.exp(_snake_case ) - 1)) )...
711
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
0
import argparse import logging import os import sys import numpy as np import onnxruntime import torch from bart_onnx.generation_onnx import BARTBeamSearchGenerator from bart_onnx.reduce_onnx_size import remove_dup_initializers import transformers from transformers import BartForConditionalGeneration, BartTokenizer ...
712
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
0
import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def SCREAMING_SNAKE_CASE ( __UpperCamelCase : str ) -> float: """simple docstring""" return np.dot(__UpperCamelCase , __UpperCamelCase ) clas...
713
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
0
import requests from bsa import BeautifulSoup def SCREAMING_SNAKE_CASE ( __UpperCamelCase : List[str] = "AAPL" ) -> Optional[Any]: """simple docstring""" A__ : List[str] = F"https://in.finance.yahoo.com/quote/{symbol}?s={symbol}" A__ : Union[str, Any] ...
714
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
0
from ....utils import logging _SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) class UpperCamelCase__ ( lowercase__ ): '''simple docstring''' def __init__( self , UpperCamelCase__ , UpperCamelCase__=None , UpperCamelCase__=2048...
715
# 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
0
import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNetaDConditionModel, ) from diffusers.pipelin...
716
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
0
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets _SCREAMING_SNAKE_CASE : Tuple = datasets.logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : List[str] = '''\ ...
717
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
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : str = { 'configuration_albert...
718
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
0
import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImageProcessor from diffusers.pipeli...
719
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
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _SCREAMING_SNAKE_CASE : List[str] = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : str = {...
720
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
0
'''simple docstring''' import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Tuple ) -> str: """simple docstring""" A__ : Optional[int] ...
721
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
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : str = {'configuration_fnet': ['FNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FNetConf...
700
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
0
from string import ascii_uppercase _SCREAMING_SNAKE_CASE : List[Any] = {str(ord(c) - 5_5): c for c in ascii_uppercase} def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Tuple , __UpperCamelCase : Tuple ) -> str: """simple docstring""" if is...
701
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
0
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int = 50 ) -> Tuple: """simple docstring""" A__ : Dict = [1] * (length + 1) for row_length in range(3 , length + 1 ): for block_length in range(3 , row_length + 1 ):...
702
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
0
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, get...
703
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
0
from manim import * class UpperCamelCase__ ( _UpperCAmelCase ): '''simple docstring''' def __snake_case ( self ): A__ : Union[str, Any] = Rectangle(height=0.5 , width=0.5 ) A__ : str = Rectangle(height=0.4_6 , width=0.4_6 )...
704
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
0
from __future__ import annotations def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int | float | str , __UpperCamelCase : int | float | str ) -> Dict: """simple docstring""" if nth_term == "": return [""] A__ = int(a_ ) A_...
705
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
0
from __future__ import annotations _SCREAMING_SNAKE_CASE : Any = { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], ""...
706
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
0
from math import loga def SCREAMING_SNAKE_CASE ( __UpperCamelCase : List[Any] ) -> int: """simple docstring""" if a < 0: raise ValueError('''Input value must be a positive integer''' ) elif isinstance(lowercase_ , lowercase_ ): ...
707
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
0
from __future__ import annotations _SCREAMING_SNAKE_CASE : Tuple = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } class UpperCamelCase__ : '''simple docstring''' def _...
708
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
0
import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from transformers.utils import logging ...
709
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
0
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
710
_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
0
from __future__ import annotations import typing from collections.abc import Iterable import numpy as np _SCREAMING_SNAKE_CASE : List[Any] = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 _SCREAMING_SNAKE_CASE : Tuple = typing.Union[np.floataa, int, flo...
711
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
0
from collections import defaultdict def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> int: """simple docstring""" A__ : List[Any] = 1 A__ : int = True for v in tree[start]: if v not in visited: ...
712
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
0
import torch from ..models.speechta import SpeechTaForTextToSpeech, SpeechTaHifiGan, SpeechTaProcessor from ..utils import is_datasets_available from .base import PipelineTool if is_datasets_available(): from datasets import load_dataset class UpperCamelCase__ ( __lowercase ): '''simple d...
713
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
0
from __future__ import annotations from collections.abc import Callable from typing import Any, Generic, TypeVar _SCREAMING_SNAKE_CASE : int = TypeVar('T') class UpperCamelCase__ ( Generic[T] ): '''simple docstring''' def __init__( self , UpperCamelCase__ ...
714
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
0
_SCREAMING_SNAKE_CASE : str = [ [0, 1_6, 1_3, 0, 0, 0], [0, 0, 1_0, 1_2, 0, 0], [0, 4, 0, 0, 1_4, 0], [0, 0, 9, 0, 0, 2_0], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def SCREAMING_SNAKE_CASE ( __UpperCamelCase : List[Any] , __UpperCamelCase :...
715
# 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
0
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() _SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE ...
716
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
0
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Union[str, Any] ): """simple docstring""" A__ : List[str] = 0 for ch in input_str: A__ : Any = ord(_lowercase ) A__ : List[str] = pow(2 , _lowercase ...
717
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
0
class UpperCamelCase__ : '''simple docstring''' def __init__( self , UpperCamelCase__ ): A__ : Optional[Any] = val A__ : Any = None A__ : Optional[Any] = None def __snake_case ( self , UpperCamelCase__ ): ...
718
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
0
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def SCREAMING_SNAKE_CASE ( ) -> Any: """simple docstring""" A__ : Any = HfArgumentParser(lowercase_ ) A__ : List[Any] = parser.parse_args_into_datacla...
719
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
0
import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create simlink # import classes from unilm.wavlm.WavLM im...
720
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
0
'''simple docstring''' import logging import os import threading import time try: import warnings except ImportError: _SCREAMING_SNAKE_CASE : List[str] = None try: import msvcrt except ImportError: _SCREAMING_SNAKE_CASE : Optional[Any] = None try: ...
721
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
0
import re def SCREAMING_SNAKE_CASE ( __UpperCamelCase : str ) -> Union[str, Any]: """simple docstring""" if len(re.findall('''[ATCG]''' , __UpperCamelCase ) ) != len(__UpperCamelCase ): raise ValueError('''Invalid Strand''' ) ...
700
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
0
from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar _SCREAMING_SNAKE_CASE : Union[str, Any] = TypeVar('T') class UpperCamelCase__ ( Generic[T] ): _lowerCAmelCase = 42 # Cache store of keys _lowerCAmelCase ...
701
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
0
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Optional[int] ) -> list: """simple docstring""" if bit_count < 0: raise ValueError('''The given input must be positive''' ) # get the generated string sequence A__ : Any = gray_code_sequenc...
702
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
0
from collections import defaultdict from math import ceil, sqrt def SCREAMING_SNAKE_CASE ( __UpperCamelCase : int = 1_00_00_00 , __UpperCamelCase : int = 10 ): """simple docstring""" A__ : defaultdict = defaultdict(__lowercase ) for out...
703
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
0
import re def SCREAMING_SNAKE_CASE ( __UpperCamelCase : List[str] ) -> Tuple: """simple docstring""" if len(re.findall('''[ATCG]''' , __snake_case ) ) != len(__snake_case ): raise ValueError('''Invalid Strand''' ) return dna...
704
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
0
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _SCREAMING_SNAKE_CASE : List[Any] = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : Any = { '''vocab_file''': '''vo...
705
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
0
import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class UpperCamelCase__ ( ctypes.Structure ): '''simple docstring''' _lowerCAmelCase = [('''size''...
706
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
0
import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCLIPTextConfig, XCLIPVisionConfig, ) def SCREA...
707
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
0
from collections import defaultdict def SCREAMING_SNAKE_CASE ( __UpperCamelCase : str , __UpperCamelCase : str ) -> bool: """simple docstring""" A__ : Tuple = first_str.lower().strip() A__ : str = second_str.lower().strip(...
708
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
0
# flake8: noqa # Lint as: python3 _SCREAMING_SNAKE_CASE : Tuple = [ 'VerificationMode', 'Version', 'disable_progress_bar', 'enable_progress_bar', 'is_progress_bar_enabled', 'experimental', ] from .info_utils import VerificationMode from .logging import disable_progress_bar, ...
709
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
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer _SCREAMING_SNAKE_CASE : List[str] = logging.get_logger(__name__...
710
_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
0
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : str ) -> float: """simple docstring""" if not nums: # Makes sure that the list is not empty raise ValueError('''List is empty''' ) A__ : Union[str, Any] = sum(__snake_case ) / len(__snak...
711
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
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : Optional[Any] = { 'studio-ousia/luke-base': 'https://huggingface.co/studio-ousia/luke-base/resolve/main/config...
712
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
0
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__ ( __l...
713
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
0
from random import shuffle import tensorflow as tf from numpy import array def SCREAMING_SNAKE_CASE ( __UpperCamelCase : Tuple , __UpperCamelCase : Optional[Any] ) -> Tuple: """simple docstring""" A__ : Any = int(lowerCamelCase__ ) ...
714
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
0