code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
import comet # From: unbabel-comet import torch import datasets _SCREAMING_SNAKE_CASE = datasets.logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = """\ @inproceedings{rei-EtAl:2020:WMT, author = {Rei, Ricardo and Stewart, Craig and Farinha, Ana C and Lavie, Alon}, ...
88
_SCREAMING_SNAKE_CASE = { """Pillow""": """Pillow""", """accelerate""": """accelerate>=0.11.0""", """compel""": """compel==0.1.8""", """black""": """black~=23.1""", """datasets""": """datasets""", """filelock""": """filelock""", """flax""": """flax>=0.4.1""", "...
88
1
def SCREAMING_SNAKE_CASE__ ( __a = 10**9 ): snake_case_ : str = 1 snake_case_ : int = 2 snake_case_ : Optional[int] = 0 snake_case_ : List[str] = 0 snake_case_ : List[Any] = 0 while perimeter <= max_perimeter...
88
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_comm...
88
1
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_t...
88
from __future__ import annotations import math def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = u for i in range(1 , __a ): snake_case_ : Optional[Any] = temp * (u - i) return temp def SCREAMING_SNAKE_CA...
88
1
import numpy as np def SCREAMING_SNAKE_CASE__ ( __a ): return 1 / (1 + np.exp(-vector )) def SCREAMING_SNAKE_CASE__ ( __a ): return vector * sigmoid(1.702 * vector ) if __name__ == "__main__": import doctest doctest.testmod()
88
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def SCREAMING_SNAKE_CASE__ ( __a , __a=None ): snake_case_ : Optional[int] = None if token is not None: snake_c...
88
1
import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils import cached_p...
88
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class SCREAMING_SNAKE_CASE_ ( snake_case_ , snake_case_ ): @register_to_config def __init__( self : Optional[Any] , *, ...
88
1
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 = """\ @misc{chen2021evaluating, title={Evalua...
88
def SCREAMING_SNAKE_CASE__ ( __a = 60_08_51_47_51_43 ): try: snake_case_ : Optional[Any] = int(__a ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueError('Parameter n must be greater t...
88
1
import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, AdamW, ...
88
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import It...
88
1
def SCREAMING_SNAKE_CASE__ ( __a ): return 10 - x * x def SCREAMING_SNAKE_CASE__ ( __a , __a ): # Bolzano theory in order to find if there is a root between a and b if equation(__a ) * equation(__a ) >= 0: raise ValueError('Wrong space!' ) snake_...
88
# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won't be consider...
88
1
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_informer""": [ """INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Informe...
88
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_...
88
1
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Liter...
88
from __future__ import annotations import pandas as pd def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Optional[Any] = [0] * no_of_processes snake_case_ : Tuple = [0] * no_of_processes # Copy the burst time into remaining_time[] ...
88
1
def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : Dict = [int(__a ) for i in ip_va_address.split('.' ) if i.isdigit()] return len(__a ) == 4 and all(0 <= int(__a ) <= 2_54 for octet in octets ) if __name__ == "__main__": _SCREAMING_SNAKE_CASE = ...
88
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_informer""": [ """INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Informe...
88
1
import argparse import json import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( VideoMAEConfig, VideoMAEForPreTraining, VideoMAEForVideoClassification, VideoMAEImageProcessor, ) def SCREAMING_SNAKE_CAS...
88
import re import string import numpy as np import datasets _SCREAMING_SNAKE_CASE = """ Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. """ _SCREAMING_SNAKE_CASE = """ Args: ...
88
1
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : Tuple = len(__a ) # We need to create solution object to save path. snake_case_ : Dict = [[0 for _ in range(__a )] for _ in range(__a )] snake_case_ : ...
88
def SCREAMING_SNAKE_CASE__ ( __a , __a = False ): if not isinstance(__a , __a ): snake_case_ : str = f"""Expected string as input, found {type(__a )}""" raise ValueError(__a ) if not isinstance(__a , __a ): snake_case_ : int = f...
88
1
from .imports import is_rich_available if is_rich_available(): from rich.traceback import install install(show_locals=False) else: raise ModuleNotFoundError("""To use the rich extension, install rich with `pip install rich`""")
88
import argparse from collections import defaultdict import yaml _SCREAMING_SNAKE_CASE = """docs/source/en/_toctree.yml""" def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : List[Any] = defaultdict(__a ) snake_case_ : Optional[Any] = [] ...
88
1
from typing import TYPE_CHECKING from ...utils import _LazyModule _SCREAMING_SNAKE_CASE = {"""processing_wav2vec2_with_lm""": ["""Wav2Vec2ProcessorWithLM"""]} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys _SCRE...
88
def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = int(__a ) # Initialize Result snake_case_ : Tuple = [] # Traverse through all denomination for denomination in reversed(__a ): # Find denominations while int(__a ...
88
1
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : Optional[int] = 2 snake_case_ : List[str] = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(__a ) if n > 1: factors.append(...
88
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_robert...
88
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { """google/pegasus-large""": """https://huggingface.co/google/pegasus-large/resolve/main/config.json""", # See all P...
88
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : List[Any] = k_size // 2 snake_case_ ,snake...
88
1
import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _SCREAMING_SNAKE_CASE = get_tests_dir("""fixtures/test_sentencepiece_...
88
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class SCREAMING_SNAKE_CASE_ ( snake_case_ ...
88
1
import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as sp from di...
88
from decimal import Decimal, getcontext from math import ceil, factorial def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): raise TypeError('Undefined for non-integers' ) elif precision < 1: raise ValueError('Undefined for non-natural numbers' ) ...
88
1
import math import flax.linen as nn import jax.numpy as jnp def SCREAMING_SNAKE_CASE__ ( __a , __a , __a = 1 , __a = 1 , __a = 1.0E4 , __a = False , __a = 1.0 , ): assert timesteps.ndim == 1, "Timesteps should be a 1d-array" assert embedding_dim % 2 == 0, f"""E...
88
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_mctct""": ["""MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MCTCTConfig"""], """feature_extraction_mctct""": ["""MCTCTFeatur...
88
1
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def SCREAMING_SNAKE_CASE__ ( ): snake_case_ : str = ArgumentParser( description=( 'PyTorch TPU d...
88
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() d...
88
1
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_comm...
88
import warnings from ..trainer import Trainer from ..utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Any , _A : str=None , **_A : Union[str, Any] ) -> ...
88
1
import unittest from knapsack import greedy_knapsack as kp class SCREAMING_SNAKE_CASE_ ( unittest.TestCase ): def UpperCAmelCase_ ( self : int ) -> Tuple: """simple docstring""" snake_case_ : Optional[int] = [10, 20, 3...
88
_SCREAMING_SNAKE_CASE = { """Pillow""": """Pillow""", """accelerate""": """accelerate>=0.11.0""", """compel""": """compel==0.1.8""", """black""": """black~=23.1""", """datasets""": """datasets""", """filelock""": """filelock""", """flax""": """flax>=0.4.1""", "...
88
1
from typing import Optional from .. import Features, NamedSplit from ..packaged_modules.text.text import Text from ..utils.typing import NestedDataStructureLike, PathLike from .abc import AbstractDatasetReader class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : O...
88
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_comm...
88
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_clipseg""": [ """CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CLIPSegConfig""", """CLIPSegTextConfig...
88
from __future__ import annotations import math def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = u for i in range(1 , __a ): snake_case_ : Optional[Any] = temp * (u - i) return temp def SCREAMING_SNAKE_CA...
88
1
import argparse import dataclasses import json import logging import os import shutil from typing import List, Optional import datasets from accelerate import Accelerator from datasets import load_dataset from finetuning import finetune from tqdm.auto import tqdm import transformers from tr...
88
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def SCREAMING_SNAKE_CASE__ ( __a , __a=None ): snake_case_ : Optional[int] = None if token is not None: snake_c...
88
1
import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : int = [ 'decoder.version', 'decoder.output_projection.weight', ...
88
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class SCREAMING_SNAKE_CASE_ ( snake_case_ , snake_case_ ): @register_to_config def __init__( self : Optional[Any] , *, ...
88
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 .....
88
def SCREAMING_SNAKE_CASE__ ( __a = 60_08_51_47_51_43 ): try: snake_case_ : Optional[Any] = int(__a ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueError('Parameter n must be greater t...
88
1
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class SCREAMING_SNAKE_CASE_ ( snake_case_ , snake_case_ ): @register_to_config def __init__( self : Optional[Any] , *, ...
88
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import It...
88
1
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin _SCREAMING_SNAKE_CASE = """ Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot app tar...
88
# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won't be consider...
88
1
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() d...
88
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_...
88
1
import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMix...
88
from __future__ import annotations import pandas as pd def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Optional[Any] = [0] * no_of_processes snake_case_ : Tuple = [0] * no_of_processes # Copy the burst time into remaining_time[] ...
88
1
from ....utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Union[str, Any] , _A : Optional[int] , _A : Union[str, Any]=None , _A : List[Any]=2048 ) ->...
88
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_informer""": [ """INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Informe...
88
1
import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from torch.uti...
88
import re import string import numpy as np import datasets _SCREAMING_SNAKE_CASE = """ Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. """ _SCREAMING_SNAKE_CASE = """ Args: ...
88
1
from __future__ import annotations import math def SCREAMING_SNAKE_CASE__ ( __a ): if num <= 0: snake_case_ : Dict = f"""{num}: Invalid input, please enter a positive integer.""" raise ValueError(__a ) snake_case_ : Tuple = [True] * (num +...
88
def SCREAMING_SNAKE_CASE__ ( __a , __a = False ): if not isinstance(__a , __a ): snake_case_ : str = f"""Expected string as input, found {type(__a )}""" raise ValueError(__a ) if not isinstance(__a , __a ): snake_case_ : int = f...
88
1
from math import pi def SCREAMING_SNAKE_CASE__ ( __a , __a ): return 2 * pi * radius * (angle / 3_60) if __name__ == "__main__": print(arc_length(90, 10))
88
import argparse from collections import defaultdict import yaml _SCREAMING_SNAKE_CASE = """docs/source/en/_toctree.yml""" def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : List[Any] = defaultdict(__a ) snake_case_ : Optional[Any] = [] ...
88
1
from __future__ import annotations import string from itertools import cycle, product from pathlib import Path _SCREAMING_SNAKE_CASE = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) _SCREAMING_SNAKE_CASE = [ord(letter) for letter in string.asci...
88
def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = int(__a ) # Initialize Result snake_case_ : Tuple = [] # Traverse through all denomination for denomination in reversed(__a ): # Find denominations while int(__a ...
88
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, loggi...
88
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_robert...
88
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 = object() # For specifying empty leaf dict `{}` _SCREAMING_SNAKE_CASE = object() ...
88
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : List[Any] = k_size // 2 snake_case_ ,snake...
88
1
from dataclasses import dataclass from typing import Optional import numpy as np import torch import torch.nn as nn from ..utils import BaseOutput, is_torch_version, randn_tensor from .attention_processor import SpatialNorm from .unet_ad_blocks import UNetMidBlockaD, get_down_block, get_up_block ...
88
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class SCREAMING_SNAKE_CASE_ ( snake_case_ ...
88
1
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : list[list[int]] = [] snake_case_ : list[int] = [] snake_case_ : Dict = 0 snake_case_ : Any = sum(__a ) create_state_space_tr...
88
from decimal import Decimal, getcontext from math import ceil, factorial def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): raise TypeError('Undefined for non-integers' ) elif precision < 1: raise ValueError('Undefined for non-natural numbers' ) ...
88
1
def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = int(__a ) # Initialize Result snake_case_ : Tuple = [] # Traverse through all denomination for denomination in reversed(__a ): # Find denominations while int(__a ...
88
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_mctct""": ["""MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MCTCTConfig"""], """feature_extraction_mctct""": ["""MCTCTFeatur...
88
1
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.im...
88
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() d...
88
1
import unittest from transformers import MobileBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester fro...
88
import warnings from ..trainer import Trainer from ..utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Any , _A : str=None , **_A : Union[str, Any] ) -> ...
88
1
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch...
88
_SCREAMING_SNAKE_CASE = { """Pillow""": """Pillow""", """accelerate""": """accelerate>=0.11.0""", """compel""": """compel==0.1.8""", """black""": """black~=23.1""", """datasets""": """datasets""", """filelock""": """filelock""", """flax""": """flax>=0.4.1""", "...
88
1
_SCREAMING_SNAKE_CASE = """ # Transformers 설치 방법 ! pip install transformers datasets # 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요. # ! pip install git+https://github.com/huggingface/transformers.git """ _SCREAMING_SNAKE_CASE = [{"""type""": """code""", """content""": INSTALL_CONTENT...
88
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_comm...
88
1
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import It...
88
from __future__ import annotations import math def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = u for i in range(1 , __a ): snake_case_ : Optional[Any] = temp * (u - i) return temp def SCREAMING_SNAKE_CA...
88
1
import random def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : str = a[left_index] snake_case_ : str = left_index + 1 for j in range(left_index + 1 , __a ): if a[j] < pivot: snake_case_ ,snake_case_ : Any = ...
88
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def SCREAMING_SNAKE_CASE__ ( __a , __a=None ): snake_case_ : Optional[int] = None if token is not None: snake_c...
88
1
import contextlib from multiprocessing import Pool, RLock from tqdm.auto import tqdm from ..utils import experimental, logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ : __magic_name__: Dict = None @experimental def SCR...
88
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class SCREAMING_SNAKE_CASE_ ( snake_case_ , snake_case_ ): @register_to_config def __init__( self : Optional[Any] , *, ...
88
1
import math import os import sys def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : List[str] = '' try: with open(__a , 'rb' ) as binary_file: snake_case_ : int = binary_file.read() for dat in data: snake_case_ : int = f...
88
def SCREAMING_SNAKE_CASE__ ( __a = 60_08_51_47_51_43 ): try: snake_case_ : Optional[Any] = int(__a ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueError('Parameter n must be greater t...
88
1
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class SCREAMING_SNAKE_CASE_ ( snake_case_ ...
88
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import It...
88
1
import uuid from typing import Any, Dict, List, Optional, Union from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf if is_torch_available(): import torch ...
88
# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won't be consider...
88
1
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable _SCREAMING_SNAKE_CASE = {"""configuration_gpt_neox""": ["""GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTNeoXConfig"""]} ...
88
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_...
88
1
from typing import Union import fire import torch from tqdm import tqdm def SCREAMING_SNAKE_CASE__ ( __a , __a = "cpu" , __a = None ): snake_case_ : str = torch.load(__a , map_location=__a ) for k, v in tqdm(state_dict.items() ): if not isinstanc...
88
from __future__ import annotations import pandas as pd def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Optional[Any] = [0] * no_of_processes snake_case_ : Tuple = [0] * no_of_processes # Copy the burst time into remaining_time[] ...
88
1
import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency _SCREAMING_SNAKE_CASE = { """E""": 1_2.7_0, """T""": 9.0_6, """A""": 8.1_7, """O""": 7.5_1, """I""": 6.9_7, """N""": 6.7_5, """S""": 6.3_3, """H""": 6.0_9, """R""": 5.9...
88
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_informer""": [ """INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Informe...
88
1
import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ...test_modeling_flax_com...
88
import re import string import numpy as np import datasets _SCREAMING_SNAKE_CASE = """ Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. """ _SCREAMING_SNAKE_CASE = """ Args: ...
88
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_ctrl""": ["""CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CTRLConfig"""], """tokenization_ctrl""": ["""CTRLT...
88
def SCREAMING_SNAKE_CASE__ ( __a , __a = False ): if not isinstance(__a , __a ): snake_case_ : str = f"""Expected string as input, found {type(__a )}""" raise ValueError(__a ) if not isinstance(__a , __a ): snake_case_ : int = f...
88
1
def SCREAMING_SNAKE_CASE__ ( __a , __a ): if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) return (bulk_modulus / density) ** 0.5 if __name__ == "__main__": import doctest ...
88
import argparse from collections import defaultdict import yaml _SCREAMING_SNAKE_CASE = """docs/source/en/_toctree.yml""" def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : List[Any] = defaultdict(__a ) snake_case_ : Optional[Any] = [] ...
88
1
from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax.numpy as jnp from jax import random from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .scheduling_utils_flax import FlaxSchedulerMixin @flax.stru...
88
def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = int(__a ) # Initialize Result snake_case_ : Tuple = [] # Traverse through all denomination for denomination in reversed(__a ): # Find denominations while int(__a ...
88
1
from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance _SCREAMING_SNAKE_CASE = 6_3_7_8_1_3_7.0 _SCREAMING_SNAKE_CASE = 6_3_5_6_7_5_2.3_1_4_2_4_5 _SCREAMING_SNAKE_CASE = 6_37_81_37 def SCREAMING_SNAKE_CASE__ ( __a , _...
88
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_robert...
88
1
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : List[Any] = k_size // 2 snake_case_ ,snake...
88
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : List[Any] = k_size // 2 snake_case_ ,snake...
88
1
def SCREAMING_SNAKE_CASE__ ( __a = 10_00 ): return sum(e for e in range(3 , __a ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F'''{solution() = }''')
88
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class SCREAMING_SNAKE_CASE_ ( snake_case_ ...
88
1
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) _SCREAMING_SNAKE_CASE ...
88
from decimal import Decimal, getcontext from math import ceil, factorial def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): raise TypeError('Undefined for non-integers' ) elif precision < 1: raise ValueError('Undefined for non-natural numbers' ) ...
88
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_robert...
88
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_mctct""": ["""MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MCTCTConfig"""], """feature_extraction_mctct""": ["""MCTCTFeatur...
88
1
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def SCREAMING_SNAKE_CASE__ ( __a , __a=None ): snake_case_ : Optional[int] = None if token is not None: snake_c...
88
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() d...
88
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SC...
88
import warnings from ..trainer import Trainer from ..utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Any , _A : str=None , **_A : Union[str, Any] ) -> ...
88
1
import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing_utils ...
88
_SCREAMING_SNAKE_CASE = { """Pillow""": """Pillow""", """accelerate""": """accelerate>=0.11.0""", """compel""": """compel==0.1.8""", """black""": """black~=23.1""", """datasets""": """datasets""", """filelock""": """filelock""", """flax""": """flax>=0.4.1""", "...
88
1
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): # Initialise PyTorch model snake_case_ : A...
88
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_comm...
88
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 = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = ...
88
from __future__ import annotations import math def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = u for i in range(1 , __a ): snake_case_ : Optional[Any] = temp * (u - i) return temp def SCREAMING_SNAKE_CA...
88
1
import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : List[Any] , _A : int , _A : Tuple=None ...
88
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def SCREAMING_SNAKE_CASE__ ( __a , __a=None ): snake_case_ : Optional[int] = None if token is not None: snake_c...
88
1
from pathlib import PurePosixPath from typing import Optional import fsspec from fsspec import AbstractFileSystem from huggingface_hub.hf_api import DatasetInfo from ..utils.file_utils import get_authentication_headers_for_url from ..utils.hub import hf_hub_url class SCREAMING_SNAKE_CASE_ ( sn...
88
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class SCREAMING_SNAKE_CASE_ ( snake_case_ , snake_case_ ): @register_to_config def __init__( self : Optional[Any] , *, ...
88
1
from __future__ import annotations import pandas as pd def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Optional[Any] = [0] * no_of_processes snake_case_ : Tuple = [0] * no_of_processes # Copy the burst time into remaining_time[] ...
88
def SCREAMING_SNAKE_CASE__ ( __a = 60_08_51_47_51_43 ): try: snake_case_ : Optional[Any] = int(__a ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueError('Parameter n must be greater t...
88
1
from __future__ import annotations from typing import Any def SCREAMING_SNAKE_CASE__ ( __a ): create_state_space_tree(__a , [] , 0 ) def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): if index == len(__a ): print(__a ) return cre...
88
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import It...
88
1
from ....configuration_utils import PretrainedConfig from ....utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { """Visual-Attention-Network/van-base""": ( """https://huggingface.co/Visual-Attention-Network/van-base/blob/m...
88
# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won't be consider...
88
1
import re from filelock import FileLock try: import nltk _SCREAMING_SNAKE_CASE = True except (ImportError, ModuleNotFoundError): _SCREAMING_SNAKE_CASE = False if NLTK_AVAILABLE: with FileLock(""".lock""") as lock: nltk.download("""punkt"""...
88
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_...
88
1
import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Tuple = 1....
88
from __future__ import annotations import pandas as pd def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Optional[Any] = [0] * no_of_processes snake_case_ : Tuple = [0] * no_of_processes # Copy the burst time into remaining_time[] ...
88
1
import requests _SCREAMING_SNAKE_CASE = """https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=""" def SCREAMING_SNAKE_CASE__ ( __a ): # fetching a list of articles in json format snake_case_ : List[Any] = requests.get(_NEWS_API + bbc_news_api_k...
88
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_informer""": [ """INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Informe...
88
1
from collections.abc import Sequence def SCREAMING_SNAKE_CASE__ ( __a = None ): if nums is None or not nums: raise ValueError('Input sequence should not be empty' ) snake_case_ : Tuple = nums[0] for i in range(1 , len(__a ) ): snake_case_ : ...
88
import re import string import numpy as np import datasets _SCREAMING_SNAKE_CASE = """ Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. """ _SCREAMING_SNAKE_CASE = """ Args: ...
88
1
import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class SCREAMING_SNAKE_CASE_ ( unittest.TestCase ): def UpperCAmelCase_ ( self : Tuple )...
88
def SCREAMING_SNAKE_CASE__ ( __a , __a = False ): if not isinstance(__a , __a ): snake_case_ : str = f"""Expected string as input, found {type(__a )}""" raise ValueError(__a ) if not isinstance(__a , __a ): snake_case_ : int = f...
88
1
import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils import i...
88
import argparse from collections import defaultdict import yaml _SCREAMING_SNAKE_CASE = """docs/source/en/_toctree.yml""" def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : List[Any] = defaultdict(__a ) snake_case_ : Optional[Any] = [] ...
88
1
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable _SCREAMING_SNAKE_CASE = { """configuration_gpt_neox_japanese""": ["""GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTNeoXJapaneseConfi...
88
def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = int(__a ) # Initialize Result snake_case_ : Tuple = [] # Traverse through all denomination for denomination in reversed(__a ): # Find denominations while int(__a ...
88
1
def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : str = 0 snake_case_ : List[Any] = len(__a ) for i in range(n - 1 ): for j in range(i + 1 , __a ): if arr[i] > arr[j]: num_inversions += 1 return num_inversions def SC...
88
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_robert...
88
1
def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : Optional[Any] = abs(__a ) snake_case_ : Dict = 0 while n > 0: res += n % 10 n //= 10 return res def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : List[str] = ab...
88
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : List[Any] = k_size // 2 snake_case_ ,snake...
88
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_...
88
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class SCREAMING_SNAKE_CASE_ ( snake_case_ ...
88
1
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Any , *_A : Optional[int] ...
88
from decimal import Decimal, getcontext from math import ceil, factorial def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): raise TypeError('Undefined for non-integers' ) elif precision < 1: raise ValueError('Undefined for non-natural numbers' ) ...
88
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { """sayakpaul/vit-msn-base""": """https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json""", # See a...
88
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_mctct""": ["""MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MCTCTConfig"""], """feature_extraction_mctct""": ["""MCTCTFeatur...
88
1
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, ConditionalD...
88
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() d...
88
1
import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase from ...u...
88
import warnings from ..trainer import Trainer from ..utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Any , _A : str=None , **_A : Union[str, Any] ) -> ...
88
1
from queue import PriorityQueue from typing import Any import numpy as np def SCREAMING_SNAKE_CASE__ ( __a , __a , __a , __a , __a , __a , __a , __a , __a , ): for nxt, d in graph[v]: if nxt in visited_forward: continue snake_case_ : Any ...
88
_SCREAMING_SNAKE_CASE = { """Pillow""": """Pillow""", """accelerate""": """accelerate>=0.11.0""", """compel""": """compel==0.1.8""", """black""": """black~=23.1""", """datasets""": """datasets""", """filelock""": """filelock""", """flax""": """flax>=0.4.1""", "...
88
1
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem _SCREAMING_SNAKE_CASE = importlib.util.find_spec("""s3fs""") is not None if _has_safs: f...
88
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_comm...
88
1
import logging import os from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional from tqdm import auto as tqdm_lib _SCREAMING_SNAKE_CASE...
88
from __future__ import annotations import math def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Optional[int] = u for i in range(1 , __a ): snake_case_ : Optional[Any] = temp * (u - i) return temp def SCREAMING_SNAKE_CA...
88
1
def SCREAMING_SNAKE_CASE__ ( __a , __a ): if digit_amount > 0: return round(number - int(__a ) , __a ) return number - int(__a ) if __name__ == "__main__": print(decimal_isolate(1.5_3, 0)) print(decimal_isolate(3_5.3_4_5, 1)) print(decimal_isol...
88
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def SCREAMING_SNAKE_CASE__ ( __a , __a=None ): snake_case_ : Optional[int] = None if token is not None: snake_c...
88
1
def SCREAMING_SNAKE_CASE__ ( __a ): # if the collection is empty, returns empty if collection == []: return [] # get some information about the collection snake_case_ : Dict = len(__a ) snake_case_ : Optional[int] = max(__a ) snake_case_ ...
88
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class SCREAMING_SNAKE_CASE_ ( snake_case_ , snake_case_ ): @register_to_config def __init__( self : Optional[Any] , *, ...
88
1
import argparse from collections import defaultdict import yaml _SCREAMING_SNAKE_CASE = """docs/source/en/_toctree.yml""" def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : List[Any] = defaultdict(__a ) snake_case_ : Optional[Any] = [] ...
88
def SCREAMING_SNAKE_CASE__ ( __a = 60_08_51_47_51_43 ): try: snake_case_ : Optional[Any] = int(__a ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueError('Parameter n must be greater t...
88
1
import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def SCREAMING_SNAKE_CASE__ ( __a ): # picklable for multiprocessi...
88
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import It...
88
1
import inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List, Tuple import numpy as np fr...
88
# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won't be consider...
88
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_retribert import RetriBertTokenizer _SCREAMING_SNAKE_CASE = logging.get_logger(__name_...
88
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_...
88
1
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_imag...
88
from __future__ import annotations import pandas as pd def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Optional[Any] = [0] * no_of_processes snake_case_ : Tuple = [0] * no_of_processes # Copy the burst time into remaining_time[] ...
88
1
from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def SCREAMING_SNAKE_CASE__ ( ): snake_case_ ,snake_case_ : Dict = 9, 14 # noqa: F841 snake_case_ : Union[str, Any] = [ [0, 1, 4], [0, ...
88
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_informer""": [ """INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Informe...
88
1
def SCREAMING_SNAKE_CASE__ ( __a ): stooge(__a , 0 , len(__a ) - 1 ) return arr def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): if i >= h: return # If first element is smaller than the last then swap them if arr[i] > arr[h]: snake_case...
88
import re import string import numpy as np import datasets _SCREAMING_SNAKE_CASE = """ Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. """ _SCREAMING_SNAKE_CASE = """ Args: ...
88
1