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
from collections.abc import Sequence def lowerCamelCase_ ( UpperCamelCase__ : Sequence[int] | None = None ): '''simple docstring''' if nums is None or not nums: raise ValueError('''Input sequence should not be empty''' ) UpperCamelCase__ ...
35
lowercase = { "joule": 1.0, "kilojoule": 1_0_0_0, "megajoule": 1_0_0_0_0_0_0, "gigajoule": 1_0_0_0_0_0_0_0_0_0, "wattsecond": 1.0, "watthour": 3_6_0_0, "kilowatthour": 3_6_0_0_0_0_0, "newtonmeter": 1.0, "calorie_nutr": 4_1_8_6.8, "kilocalorie_nutr": 4_1_8...
35
1
import inspect import os import torch from transformers import AutoModel from transformers.testing_utils import mockenv_context from transformers.trainer_utils import set_seed import accelerate from accelerate.accelerator import Accelerator from accelerate.state import AcceleratorState from accelerate.test...
35
import datasets from .evaluate import evaluate lowercase = """\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, journal={arXiv preprint arXiv:2103.06268},...
35
1
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def lowerCamelCase_ ( UpperCamelCase__ : Optional[int], UpperCamelCase__ : List[Any]=(), UpperCame...
35
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, ) lowercase = { """configuration_xlm_roberta""...
35
1
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils import logging logging....
35
import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets lowercase = """\ @inproceedings{kakwani2020indicnlpsuite, title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained Multilingual Language Models for I...
35
1
import copy import os import cva import numpy as np from matplotlib import pyplot as plt class __lowercase : '''simple docstring''' def __init__( self : Union[str, Any] ): UpperCamelCase__ = '''''' UpperCamelCase__ = ...
35
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor lowercase = logging.get_logger(__name__) class __lowercase ( A ): '''simple docstring''' def __init__( self : List[str] , *...
35
1
from typing import List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase = logging.get_logger(__name__) lowercase = { """huggingface/autoformer-tourism-monthly""": """https://huggingface.co/huggingface/autoformer-tourism-...
35
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowercase = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_xlm""": ["""XLMT...
35
1
import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope='''session''' ) def lowerCamelCase_ ( ): ...
35
from __future__ import annotations lowercase = list[list[int]] # assigning initial values to the grid lowercase = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, 0, 8, 6, 3, 0, 0, 5...
35
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, ) lowercase = { """configuration_xlm_roberta""...
35
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenP...
35
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase = { """configuration_mvp""": ["""MVP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MvpConfig""", """MvpOnnxConfig"""], """tokenization_mvp""": ...
35
from __future__ import annotations from typing import Any def lowerCamelCase_ ( UpperCamelCase__ : list ): '''simple docstring''' if not postfix_notation: return 0 UpperCamelCase__ = {'''+''', '''-''', '''*''', '''/'''} ...
35
1
from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils import stable_softmax if...
35
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_common import Co...
35
1
def lowerCamelCase_ ( UpperCamelCase__ : int = 100_0000 ): '''simple docstring''' UpperCamelCase__ = limit + 1 UpperCamelCase__ = [0] * limit for first_term in range(1, UpperCamelCase__ ): for n in range(UpperCamelCase__,...
35
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: if not is_torch_available(): ...
35
1
import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import TEXT_GUID...
35
def lowerCamelCase_ ( UpperCamelCase__ : list[int], UpperCamelCase__ : list[int], UpperCamelCase__ : int ): '''simple docstring''' return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(UpperCamel...
35
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: if not is_torch_available(): ...
35
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging impo...
35
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase = { """configuration_clap""": [ """CLAP_PRETRAINED_MODEL_ARCHIVE_LIST""", """ClapAudioConfig""", """ClapConfig""", """ClapTextCo...
35
import copy import os from typing import TYPE_CHECKING, List, Union if TYPE_CHECKING: pass from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase = logging.get_logger(__name__) lowercase = { """kakaobrain/align-base""": """http...
35
1
import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets lowercase = """\ @inproceedings{kakwani2020indicnlpsuite, title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained Multilingual Language Models for I...
35
import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig lowercase = { """facebook/maskformer-swin-base-ade""": ( ...
35
1
from __future__ import annotations def lowerCamelCase_ ( UpperCamelCase__ : list ): '''simple docstring''' if not nums: raise ValueError('''List is empty''' ) return sum(UpperCamelCase__ ) / len(UpperCamelCase__ ) if __name__ == "__main_...
35
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class __lowercase ( unittest.TestCase ): ...
35
1
from __future__ import annotations class __lowercase : '''simple docstring''' def __init__( self : List[Any] , _a : int ): UpperCamelCase__ = data UpperCamelCase__ = None UpperCamelCase__ = ...
35
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor lowercase = logging.get_logger(__name__) class __lowercase ( A ): '''simple docstring''' def __init__( self : Any , *_a : Optional[A...
35
1
import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() lowercase = ...
35
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py lowercase = """src/transformers""" # This is to make sure ...
35
1
import qiskit def lowerCamelCase_ ( UpperCamelCase__ : int = 2 ): '''simple docstring''' UpperCamelCase__ = qubits # Using Aer's simulator UpperCamelCase__ = qiskit.Aer.get_backend('''aer_simulator''' ) # Creating...
35
from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before tokenizers ...
35
1
def lowerCamelCase_ ( UpperCamelCase__ : Dict, UpperCamelCase__ : Any ): '''simple docstring''' UpperCamelCase__ = '''''' for i in table: res += inp[i - 1] return res def lowerCamelCase_ ( UpperCamelCase__ ...
35
from __future__ import annotations class __lowercase : '''simple docstring''' def __init__( self : List[Any] , _a : int ): UpperCamelCase__ = data UpperCamelCase__ = None UpperCamelCase__ = ...
35
1
from functools import reduce lowercase = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """668...
35
from __future__ import annotations from collections import Counter from random import random class __lowercase : '''simple docstring''' def __init__( self : List[Any] ): UpperCamelCase__ = {} def A_ ( self : ...
35
1
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 .....
35
import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineO...
35
1
import torch from transformers import AutoModel class __lowercase ( torch.nn.Module ): '''simple docstring''' def __init__( self : List[str] , _a : int="sayef/fsner-bert-base-uncased" ): super(_a , self ).__init__() ...
35
lowercase = { "joule": 1.0, "kilojoule": 1_0_0_0, "megajoule": 1_0_0_0_0_0_0, "gigajoule": 1_0_0_0_0_0_0_0_0_0, "wattsecond": 1.0, "watthour": 3_6_0_0, "kilowatthour": 3_6_0_0_0_0_0, "newtonmeter": 1.0, "calorie_nutr": 4_1_8_6.8, "kilocalorie_nutr": 4_1_8...
35
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase = logging.get_logger(__name__) lowercase = { """vinvino02/glpn-kitti""": """https://huggingface.co/vinvino02/glpn-kitti/resolve/main/config.json""", # See all GLPN models at https:...
35
import datasets from .evaluate import evaluate lowercase = """\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, journal={arXiv preprint arXiv:2103.06268},...
35
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) lowercase = {"""configuration_vit""": ["""VIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ViT...
35
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, ) lowercase = { """configuration_xlm_roberta""...
35
1
import os def lowerCamelCase_ ( ): '''simple docstring''' with open(os.path.dirname(UpperCamelCase__ ) + '''/p022_names.txt''' ) as file: UpperCamelCase__ = str(file.readlines()[0] ) UpperCamelCase__ = names.replace('...
35
import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets lowercase = """\ @inproceedings{kakwani2020indicnlpsuite, title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained Multilingual Language Models for I...
35
1
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtract...
35
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor lowercase = logging.get_logger(__name__) class __lowercase ( A ): '''simple docstring''' def __init__( self : List[str] , *...
35
1
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor lowercase = logging.get_logger(__name__) class __lowercase ( A ): '''simple docstring''' def __init__( self : List[str] , *...
35
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowercase = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_xlm""": ["""XLMT...
35
1
import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets lowercase = """ @inproceedings{xu-etal-2016-optimizing, title = {Optimizing Statistical Machine Translation for Text Simplification}, authors={Xu...
35
from __future__ import annotations lowercase = list[list[int]] # assigning initial values to the grid lowercase = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, 0, 8, 6, 3, 0, 0, 5...
35
1
from __future__ import annotations from collections import Counter from random import random class __lowercase : '''simple docstring''' def __init__( self : List[Any] ): UpperCamelCase__ = {} def A_ ( self : ...
35
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenP...
35
1
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class __lowercase ( unittest.TestCase ): '''simple docstring''' def A_ ( self : Optional[int] ): ...
35
from __future__ import annotations from typing import Any def lowerCamelCase_ ( UpperCamelCase__ : list ): '''simple docstring''' if not postfix_notation: return 0 UpperCamelCase__ = {'''+''', '''-''', '''*''', '''/'''} ...
35
1
import pytest from datasets.splits import SplitDict, SplitInfo from datasets.utils.py_utils import asdict @pytest.mark.parametrize( '''split_dict''', [ SplitDict(), SplitDict({'''train''': SplitInfo(name='''train''', num_bytes=1337, num_examples=42, dataset_na...
35
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_common import Co...
35
1
import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_RECORDS_FILENAME, Rea...
35
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: if not is_torch_available(): ...
35
1
import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineO...
35
def lowerCamelCase_ ( UpperCamelCase__ : list[int], UpperCamelCase__ : list[int], UpperCamelCase__ : int ): '''simple docstring''' return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(UpperCamel...
35
1
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow if is_torch_available(): import torch from transformers import XLMRobertaModel @require_sentencepiece @require_tokenizers @requi...
35
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging impo...
35
1
from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import floats_tensor, ids_te...
35
import copy import os from typing import TYPE_CHECKING, List, Union if TYPE_CHECKING: pass from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase = logging.get_logger(__name__) lowercase = { """kakaobrain/align-base""": """http...
35
1
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaImgPipeline, ...
35
import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig lowercase = { """facebook/maskformer-swin-base-ade""": ( ...
35
1
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.ut...
35
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class __lowercase ( unittest.TestCase ): ...
35
1
import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def lowerCamelCase_ ( ): '''simple docstring''' raise RuntimeError('''CUDA ...
35
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor lowercase = logging.get_logger(__name__) class __lowercase ( A ): '''simple docstring''' def __init__( self : Any , *_a : Optional[A...
35
1
from PIL import Image def lowerCamelCase_ ( UpperCamelCase__ : Image, UpperCamelCase__ : float ): '''simple docstring''' def brightness(UpperCamelCase__ : int ) -> float: return 128 + level + (c - 128) if not -255.0 <= level <= 2...
35
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py lowercase = """src/transformers""" # This is to make sure ...
35
1
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ( BitConfig, ...
35
from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before tokenizers ...
35
1
from __future__ import annotations from collections.abc import Generator def lowerCamelCase_ ( ): '''simple docstring''' UpperCamelCase__ = {} UpperCamelCase__ = 2 while True: UpperCamelCase__ = factor...
35
from __future__ import annotations class __lowercase : '''simple docstring''' def __init__( self : List[Any] , _a : int ): UpperCamelCase__ = data UpperCamelCase__ = None UpperCamelCase__ = ...
35
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase = logging.get_logger(__name__) lowercase = { """andreasmadsen/efficient_mlm_m0.40""": ...
35
from __future__ import annotations from collections import Counter from random import random class __lowercase : '''simple docstring''' def __init__( self : List[Any] ): UpperCamelCase__ = {} def A_ ( self : ...
35
1
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
35
import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineO...
35
1
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging impo...
35
lowercase = { "joule": 1.0, "kilojoule": 1_0_0_0, "megajoule": 1_0_0_0_0_0_0, "gigajoule": 1_0_0_0_0_0_0_0_0_0, "wattsecond": 1.0, "watthour": 3_6_0_0, "kilowatthour": 3_6_0_0_0_0_0, "newtonmeter": 1.0, "calorie_nutr": 4_1_8_6.8, "kilocalorie_nutr": 4_1_8...
35
1
import collections import os import re from pathlib import Path lowercase = """src/transformers""" # Matches is_xxx_available() lowercase = re.compile(R"""is\_([a-z_]*)_available()""") # Catches a one-line _import_struct = {xxx} lowercase = re.compile(R"""^_i...
35
import datasets from .evaluate import evaluate lowercase = """\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, journal={arXiv preprint arXiv:2103.06268},...
35
1
import importlib import os import sys # This is required to make the module import works (when the python process is running from the root of the repo) sys.path.append(""".""") def lowerCamelCase_ ( UpperCamelCase__ : Tuple ): '''simple docstring''' ...
35
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, ) lowercase = { """configuration_xlm_roberta""...
35
1
import logging import os from dataclasses import dataclass from typing import List, Optional, Union import tqdm from filelock import FileLock from transformers import ( BartTokenizer, BartTokenizerFast, DataProcessor, PreTrainedTokenizer, RobertaTokenizer, RobertaTokenizerFast, ...
35
import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets lowercase = """\ @inproceedings{kakwani2020indicnlpsuite, title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained Multilingual Language Models for I...
35
1
from __future__ import annotations lowercase = list[list[int]] # assigning initial values to the grid lowercase = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, 0, 8, 6, 3, 0, 0, 5...
35
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor lowercase = logging.get_logger(__name__) class __lowercase ( A ): '''simple docstring''' def __init__( self : List[str] , *...
35
1
import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer import RoFormerTokenizer from .t...
35
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowercase = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_xlm""": ["""XLMT...
35
1
import argparse import os from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_task_guides.py lowercase = """src/transformers""" lowercase = """do...
35
from __future__ import annotations lowercase = list[list[int]] # assigning initial values to the grid lowercase = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, 0, 8, 6, 3, 0, 0, 5...
35
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowercase = logging.get_logger(__name__) class __lowercase ( A, A ): '''simple docst...
35
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenP...
35
1
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor lowercase = logging.get_logger(__name__) class __lowercase ( A ): '''simple docstring''' def __init__( self : str , *_a : int , ...
35
from __future__ import annotations from typing import Any def lowerCamelCase_ ( UpperCamelCase__ : list ): '''simple docstring''' if not postfix_notation: return 0 UpperCamelCase__ = {'''+''', '''-''', '''*''', '''/'''} ...
35
1
import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenizerBase def...
35
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_common import Co...
35
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowercase = { """configuration_conditional_detr""": [ """CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ConditionalDetrConfig"""...
35
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: if not is_torch_available(): ...
35
1
def lowerCamelCase_ ( UpperCamelCase__ : list[int], UpperCamelCase__ : list[int], UpperCamelCase__ : int ): '''simple docstring''' return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(UpperCamel...
35
def lowerCamelCase_ ( UpperCamelCase__ : list[int], UpperCamelCase__ : list[int], UpperCamelCase__ : int ): '''simple docstring''' return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(UpperCamel...
35
1
from math import factorial def lowerCamelCase_ ( UpperCamelCase__ : int = 20 ): '''simple docstring''' UpperCamelCase__ = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... UpperCamelCase__ ...
35
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging impo...
35
1
import tempfile import unittest from make_student import create_student_by_copying_alternating_layers from transformers import AutoConfig from transformers.file_utils import cached_property from transformers.testing_utils import require_torch lowercase = """sshleifer/bart-tiny-random""" lo...
35
import copy import os from typing import TYPE_CHECKING, List, Union if TYPE_CHECKING: pass from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase = logging.get_logger(__name__) lowercase = { """kakaobrain/align-base""": """http...
35
1
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowercase = TypeVar("""T""") lowercase = TypeVar("""U""") class __lowercase ( Generic[T, U] ): '''simple docstring''' def __init__( ...
35
import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig lowercase = { """facebook/maskformer-swin-base-ade""": ( ...
35
1
import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor lowercase = logging.get_logger(__name__) class __lowercase ( A ): '''simple docstring''' def __init__( self : List[Any] , *_a : ...
35
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class __lowercase ( unittest.TestCase ): ...
35
1
class __lowercase : '''simple docstring''' def __init__( self : Optional[Any] , _a : int ): UpperCamelCase__ = n UpperCamelCase__ = [None] * self.n UpperCamelCase__ = 0 # index of the first element ...
35
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor lowercase = logging.get_logger(__name__) class __lowercase ( A ): '''simple docstring''' def __init__( self : Any , *_a : Optional[A...
35
1
import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class __lowercase ( A ): '''simple docstring''' ...
35
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py lowercase = """src/transformers""" # This is to make sure ...
35
1
def lowerCamelCase_ ( UpperCamelCase__ : str ): '''simple docstring''' if not all(x.isalpha() for x in string ): raise ValueError('''String must only contain alphabetic characters.''' ) UpperCamelCase__ = sorted(string.lower() ) return ...
35
from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before tokenizers ...
35
1
import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging lowercase = logging.get_logger(__name__) def lowerCamelCase_ ( UpperCamelCase__ : List[str]...
35
from __future__ import annotations class __lowercase : '''simple docstring''' def __init__( self : List[Any] , _a : int ): UpperCamelCase__ = data UpperCamelCase__ = None UpperCamelCase__ = ...
35
1
import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings lowercase = logging.getLogger(...
35
from __future__ import annotations from collections import Counter from random import random class __lowercase : '''simple docstring''' def __init__( self : List[Any] ): UpperCamelCase__ = {} def A_ ( self : ...
35
1
from collections.abc import Sequence def lowerCamelCase_ ( UpperCamelCase__ : Sequence[float], UpperCamelCase__ : bool = False ): '''simple docstring''' if not arr: return 0 UpperCamelCase__ = 0 if allow_empty_subarrays ...
35
import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineO...
35
1
import os import pytest from attr import dataclass lowercase = """us-east-1""" # defaults region @dataclass class __lowercase : '''simple docstring''' _A : str _A : Any = '''arn:aws:iam::558105141721:role/sagemaker_execution_role'...
35
lowercase = { "joule": 1.0, "kilojoule": 1_0_0_0, "megajoule": 1_0_0_0_0_0_0, "gigajoule": 1_0_0_0_0_0_0_0_0_0, "wattsecond": 1.0, "watthour": 3_6_0_0, "kilowatthour": 3_6_0_0_0_0_0, "newtonmeter": 1.0, "calorie_nutr": 4_1_8_6.8, "kilocalorie_nutr": 4_1_8...
35
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) lowercase = { """configuration_layoutlmv2""": ["""LAYOUTLMV2_PRETRAINED_CONFIG_ARCHIVE_MAP""", ""...
35
import datasets from .evaluate import evaluate lowercase = """\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, journal={arXiv preprint arXiv:2103.06268},...
35
1
import copy import os from typing import TYPE_CHECKING, List, Union if TYPE_CHECKING: pass from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase = logging.get_logger(__name__) lowercase = { """kakaobrain/align-base""": """http...
35
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, ) lowercase = { """configuration_xlm_roberta""...
35
1
import torch from diffusers import DiffusionPipeline class __lowercase ( A ): '''simple docstring''' def __init__( self : Dict , _a : Optional[int] , _a : Any ): super().__init__() self.register_modules(unet=_a ...
35
import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets lowercase = """\ @inproceedings{kakwani2020indicnlpsuite, title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained Multilingual Language Models for I...
35
1
from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before tokenizers ...
35
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor lowercase = logging.get_logger(__name__) class __lowercase ( A ): '''simple docstring''' def __init__( self : List[str] , *...
35
1
from __future__ import annotations from typing import Any def lowerCamelCase_ ( UpperCamelCase__ : list ): '''simple docstring''' if not postfix_notation: return 0 UpperCamelCase__ = {'''+''', '''-''', '''*''', '''/'''} ...
35
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowercase = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_xlm""": ["""XLMT...
35
1
from ..utils import DummyObject, requires_backends class __lowercase ( metaclass=A ): '''simple docstring''' _A : Dict = ['''keras_nlp'''] def __init__( self : Optional[int] , *_a : Tuple , **_a : Optional[Any] ...
35
from __future__ import annotations lowercase = list[list[int]] # assigning initial values to the grid lowercase = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, 0, 8, 6, 3, 0, 0, 5...
35
1
import os import jsonlines import numpy as np from tqdm import tqdm lowercase = 2_0_4_8 lowercase = 4_0_9_6 lowercase = 4_2 lowercase = os.environ.pop("""PROCESS_TRAIN""", """false""") lowercase = {"""null""": 0, """short""": 1, ""...
35
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenP...
35
1
class __lowercase : '''simple docstring''' def __init__( self : List[Any] , _a : list[int] ): UpperCamelCase__ = len(_a ) UpperCamelCase__ = [0] * len_array if len_array > 0: UpperCamelCase_...
35
from __future__ import annotations from typing import Any def lowerCamelCase_ ( UpperCamelCase__ : list ): '''simple docstring''' if not postfix_notation: return 0 UpperCamelCase__ = {'''+''', '''-''', '''*''', '''/'''} ...
35
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LDMTextToImagePipeline, UNetaDConditionModel from diffusers.utils.testing_utils import ( enable_full_determinism, load_n...
35
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_common import Co...
35
1
from __future__ import annotations import math from collections.abc import Callable def lowerCamelCase_ ( UpperCamelCase__ : Callable[[int | float], int | float], UpperCamelCase__ : int | float, UpperCamelCase__ : int | float, UpperCamelCase__ : int = 100, ): ...
35
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: if not is_torch_available(): ...
35
1
from __future__ import annotations from random import random from typing import Generic, TypeVar lowercase = TypeVar("""KT""") lowercase = TypeVar("""VT""") class __lowercase ( Generic[KT, VT] ): '''simple docstring''' def __init__( sel...
35
def lowerCamelCase_ ( UpperCamelCase__ : list[int], UpperCamelCase__ : list[int], UpperCamelCase__ : int ): '''simple docstring''' return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(UpperCamel...
35
1
from dataclasses import dataclass, field from typing import Optional @dataclass class __lowercase : '''simple docstring''' _A : Optional[str] = field( default='''codeparrot/codeparrot''', metadata={'''help''': '''Model name or path of model to be trained.'''...
35
import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from .logging impo...
35
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 .be...
35
import copy import os from typing import TYPE_CHECKING, List, Union if TYPE_CHECKING: pass from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase = logging.get_logger(__name__) lowercase = { """kakaobrain/align-base""": """http...
35
1
import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_common import SequenceFeatureExtr...
35
import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig lowercase = { """facebook/maskformer-swin-base-ade""": ( ...
35
1
import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class __lowercase ( A, unittest.TestCase ): ...
35
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class __lowercase ( unittest.TestCase ): ...
35
1
import argparse import os import re lowercase = """src/transformers""" # Pattern that looks at the indentation in a line. lowercase = re.compile(R"""^(\s*)\S""") # Pattern that matches `"key":" and puts `key` in group 0. lowercase = re.compile(R"""^\s*\"([^\"]+)...
35
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor lowercase = logging.get_logger(__name__) class __lowercase ( A ): '''simple docstring''' def __init__( self : Any , *_a : Optional[A...
35
1
def lowerCamelCase_ ( UpperCamelCase__ : int ): '''simple docstring''' if divisor % 5 == 0 or divisor % 2 == 0: return 0 UpperCamelCase__ = 1 UpperCamelCase__ = 1 while repunit: UpperCamelCase__ = (10...
35
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py lowercase = """src/transformers""" # This is to make sure ...
35
1
def lowerCamelCase_ ( UpperCamelCase__ : int ): '''simple docstring''' if n == 1 or not isinstance(UpperCamelCase__, UpperCamelCase__ ): return 0 elif n == 2: return 1 else: UpperCamelCase__ = [0, 1] for i ...
35
from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before tokenizers ...
35
1
import logging import os import threading import time try: import warnings except ImportError: lowercase = None try: import msvcrt except ImportError: lowercase = None try: import fcntl except ImportError: lowercase = None # Backward c...
35
from __future__ import annotations class __lowercase : '''simple docstring''' def __init__( self : List[Any] , _a : int ): UpperCamelCase__ = data UpperCamelCase__ = None UpperCamelCase__ = ...
35
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 lowercase = { ...
35
from __future__ import annotations from collections import Counter from random import random class __lowercase : '''simple docstring''' def __init__( self : List[Any] ): UpperCamelCase__ = {} def A_ ( self : ...
35
1
lowercase = { "joule": 1.0, "kilojoule": 1_0_0_0, "megajoule": 1_0_0_0_0_0_0, "gigajoule": 1_0_0_0_0_0_0_0_0_0, "wattsecond": 1.0, "watthour": 3_6_0_0, "kilowatthour": 3_6_0_0_0_0_0, "newtonmeter": 1.0, "calorie_nutr": 4_1_8_6.8, "kilocalorie_nutr": 4_1_8...
35
import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineO...
35
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase = { """configuration_jukebox""": [ """JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP""", """JukeboxConfig""", """JukeboxPriorConfig""", "...
35
lowercase = { "joule": 1.0, "kilojoule": 1_0_0_0, "megajoule": 1_0_0_0_0_0_0, "gigajoule": 1_0_0_0_0_0_0_0_0_0, "wattsecond": 1.0, "watthour": 3_6_0_0, "kilowatthour": 3_6_0_0_0_0_0, "newtonmeter": 1.0, "calorie_nutr": 4_1_8_6.8, "kilocalorie_nutr": 4_1_8...
35
1
import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig lowercase = { """facebook/maskformer-swin-base-ade""": ( ...
35
import datasets from .evaluate import evaluate lowercase = """\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, journal={arXiv preprint arXiv:2103.06268},...
35
1
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() ...
35
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, ) lowercase = { """configuration_xlm_roberta""...
35
1
from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class __lowercase ( A ): '''simple docstring''' _A : List[str] = CustomTokenizer pass
35
import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets lowercase = """\ @inproceedings{kakwani2020indicnlpsuite, title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained Multilingual Language Models for I...
35
1
def lowerCamelCase_ ( UpperCamelCase__ : int ): '''simple docstring''' if not isinstance(UpperCamelCase__, UpperCamelCase__ ) or number < 0: raise ValueError('''Input must be a non-negative integer''' ) UpperCamelCase__ = 0 while n...
35
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor lowercase = logging.get_logger(__name__) class __lowercase ( A ): '''simple docstring''' def __init__( self : List[str] , *...
35
1
from __future__ import annotations def lowerCamelCase_ ( UpperCamelCase__ : list[list[int]] ): '''simple docstring''' for i in range(1, len(matrix[0] ) ): matrix[0][i] += matrix[0][i - 1] # preprocessing the first column for i in ...
35
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowercase = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_xlm""": ["""XLMT...
35
1
import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_configuration_common import ConfigTester from ....
35
from __future__ import annotations lowercase = list[list[int]] # assigning initial values to the grid lowercase = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, 0, 8, 6, 3, 0, 0, 5...
35
1
from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuratio...
35
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenP...
35
1
import operator def lowerCamelCase_ ( UpperCamelCase__ : list, UpperCamelCase__ : bool = False, UpperCamelCase__ : list | None = None ): '''simple docstring''' UpperCamelCase__ = operator.lt if reverse else operator.gt Uppe...
35
from __future__ import annotations from typing import Any def lowerCamelCase_ ( UpperCamelCase__ : list ): '''simple docstring''' if not postfix_notation: return 0 UpperCamelCase__ = {'''+''', '''-''', '''*''', '''/'''} ...
35
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowercase = { """configuration_maskformer""": ["""MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MaskFormerConfig"""], """configuration_maskformer_...
35
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_common import Co...
35
1
from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, slow from ..test_...
35
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: if not is_torch_available(): ...
35
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase = { """configuration_electra""": ["""ELECTRA_PRETRAINED_CONFIG_ARCH...
35
def lowerCamelCase_ ( UpperCamelCase__ : list[int], UpperCamelCase__ : list[int], UpperCamelCase__ : int ): '''simple docstring''' return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(UpperCamel...
35
1