code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __snake_case =logging.get_logger(__name__) __snake_...
4
'''simple docstring''' import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings __snake...
4
1
'''simple docstring''' import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def a_ ( lowerCamelCase : str ,...
4
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/f...
4
1
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.uti...
4
'''simple docstring''' import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor __snake_case =logging.get_logger(__name__) class UpperCAmelCase_ ( __lowercase ): def __init__( self : Dict , *Upper...
4
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING __snake_case =loggi...
4
'''simple docstring''' from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer __snake_case =logging...
4
1
'''simple docstring''' import os import re import shutil import sys import tempfile import unittest import black __snake_case =os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import check_copi...
4
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case =logging.get_logger(__name__) __snake_case ={ """facebook/s2t-wav2vec2-large-en-de""": ( """https://huggingface.co/facebook/s2t-wav2vec2-large-en-d...
4
1
'''simple docstring''' def a_ ( lowerCamelCase : int = 1000 ): lowerCAmelCase , lowerCAmelCase = 1, 1 lowerCAmelCase = 2 while True: lowerCAmelCase = 0 lowerCAmelCase = fa + fa lowerCAmelCase , lowerCAmelCase = fa, f ...
4
'''simple docstring''' from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class UpperCAmelCase_ ( __lowercase ): def __lt__( self : Optional[int] , UpperCAmelCa...
4
1
'''simple docstring''' import importlib import math import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Tuple, Union import flax import jax.numpy as jnp from ..utils import BaseOutput __snake_case ="""scheduler_config.json"""...
4
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __snake_case ="""\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, ti...
4
1
'''simple docstring''' 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 ImageProcessingSav...
4
'''simple docstring''' from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record __snake_case ="""\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding ...
4
1
'''simple docstring''' import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTo...
4
'''simple docstring''' print((lambda quine: quine % quine)("""print((lambda quine: quine %% quine)(%r))"""))
4
1
'''simple docstring''' from maths.prime_check import is_prime def a_ ( lowerCamelCase : int ): if not isinstance(lowerCamelCase , lowerCamelCase ): lowerCAmelCase = f'''Input value of [number={number}] must be an integer''' raise TypeError(lowerCamelCase ...
4
'''simple docstring''' import os __snake_case ={"""I""": 1, """V""": 5, """X""": 10, """L""": 50, """C""": 100, """D""": 500, """M""": 1_000} def a_ ( lowerCamelCase : str ): lowerCAmelCase = 0 lowerCAmelCase = 0 while index < len(lowerCamelCas...
4
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __snake_case ={ """configuration_mega""": ["""MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MegaConfig""", """MegaOnnxConfig"...
4
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_...
4
1
'''simple docstring''' 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 impor...
4
'''simple docstring''' 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 UpperCAmelCase_ ( unittest.TestCase ): def __Upp...
4
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase_ ( metaclass=__lowercase ): lowerCamelCase : Any = ['''keras_nlp'''] def __init__( self : Dict , *UpperCAmelCase__ : List[str] , *...
4
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import loggin...
4
1
'''simple docstring''' # DISCLAIMER: This code is strongly influenced by https://github.com/pesser/pytorch_diffusion # and https://github.com/hojonathanho/diffusion import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch fro...
4
'''simple docstring''' from __future__ import annotations from statistics import mean def a_ ( lowerCamelCase : list[int] , lowerCamelCase : list[int] , lowerCamelCase : int ): lowerCAmelCase = [0] * no_of_processes lowerCAmelCase = [0] * no_of_proces...
4
1
'''simple docstring''' from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCAmelCase_ ( __lowercase ): @staticmethod @abstractmethod def __UpperCAmelCase ( UpperCAmelCase__ : ArgumentParser ) -> str: ...
4
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determini...
4
1
'''simple docstring''' from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def a_ ( lowerCamelCase : int , lowerCamelCase : int , lowerCamelCase : float = 1 / sqrt(2 ) ): lowerCAmelCase = tau * frequency / samplerate lower...
4
'''simple docstring''' # Copyright (c) 2021-, NVIDIA CORPORATION. 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/lice...
4
1
'''simple docstring''' from __future__ import annotations import matplotlib.pyplot as plt # type: ignore import numpy # initial triangle of Koch snowflake __snake_case =numpy.array([0, 0]) __snake_case =numpy.array([0.5, 0.8_6_6_0_2_5_4]) __snake_case =numpy.array([1...
4
'''simple docstring''' from __future__ import annotations from typing import Any class UpperCAmelCase_ : def __init__( self : Optional[int] , UpperCAmelCase__ : int , UpperCAmelCase__ : int , UpperCAmelCase__ : ...
4
1
'''simple docstring''' from __future__ import annotations import os from collections.abc import Mapping __snake_case =tuple[int, int] class UpperCAmelCase_ : def __init__( self : Optional[int] , UpperCAmelCase__ : set[int] , ...
4
'''simple docstring''' class UpperCAmelCase_ : def __init__( self : List[str] , UpperCAmelCase__ : list[int] ) -> None: lowerCAmelCase = len(UpperCAmelCase__ ) lowerCAmelCase = [0] * len_array if len_a...
4
1
'''simple docstring''' import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": __snake_case =argparse.ArgumentParser() parser.add_argument( """--checkpoint_path""", ...
4
'''simple docstring''' def a_ ( lowerCamelCase : Optional[Any] ): return [ { 0: [1, 2], 1: [0, 2], 2: [0, 1, 3, 5], 3: [2, 4], 4: [3], 5: [2, 6, 8], 6: [5, 7], 7: [6, 8], 8:...
4
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case =logging.get_logger(__name__) __snake_case ={ """RWKV/rwkv-4-169m-pile""": """https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json""", ...
4
'''simple docstring''' 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_verbosi...
4
1
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def a_ ( lowerCamelCase : Optional[int] ): lowerCAmelCase = SwinConfig(image_size=192 ) ...
4
'''simple docstring''' 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_se...
4
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case =logging.get_logger(__name__) __snake_case ={ """facebook/dpr-ctx_encoder-single-nq-base""": ( """https://huggingface.co/facebook/dpr-ctx_encoder-s...
4
'''simple docstring''' import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def a_ ( lowerCamelCase : Dict ): lowerCAmelCase = {} lowerCAmel...
4
1
'''simple docstring''' import json import os import unittest from transformers.models.roc_bert.tokenization_roc_bert import ( VOCAB_FILES_NAMES, RoCBertBasicTokenizer, RoCBertTokenizer, RoCBertWordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) fr...
4
'''simple docstring''' import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings __snake...
4
1
'''simple docstring''' from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_p...
4
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/f...
4
1
'''simple docstring''' import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch fro...
4
'''simple docstring''' import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor __snake_case =logging.get_logger(__name__) class UpperCAmelCase_ ( __lowercase ): def __init__( self : Dict , *Upper...
4
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase_ ( metaclass=__lowercase ): lowerCamelCase : int = ['''onnx'''] def __init__( self : Dict , *UpperCAmelCase__ : str , **UpperCAmel...
4
'''simple docstring''' from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer __snake_case =logging...
4
1
'''simple docstring''' from __future__ import annotations __snake_case ={ """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""...
4
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case =logging.get_logger(__name__) __snake_case ={ """facebook/s2t-wav2vec2-large-en-de""": ( """https://huggingface.co/facebook/s2t-wav2vec2-large-en-d...
4
1
'''simple docstring''' import inspect import unittest from math import floor from transformers import CvtConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device f...
4
'''simple docstring''' from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class UpperCAmelCase_ ( __lowercase ): def __lt__( self : Optional[int] , UpperCAmelCa...
4
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lice...
4
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __snake_case ="""\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, ti...
4
1
'''simple docstring''' from __future__ import annotations import math def a_ ( lowerCamelCase : float , lowerCamelCase : int ): lowerCAmelCase = u for i in range(1 , lowerCamelCase ): lowerCAmelCase = temp * (u - i) return temp de...
4
'''simple docstring''' from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record __snake_case ="""\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding ...
4
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import LEDConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin,...
4
'''simple docstring''' print((lambda quine: quine % quine)("""print((lambda quine: quine %% quine)(%r))"""))
4
1
'''simple docstring''' import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings __snake...
4
'''simple docstring''' import os __snake_case ={"""I""": 1, """V""": 5, """X""": 10, """L""": 50, """C""": 100, """D""": 500, """M""": 1_000} def a_ ( lowerCamelCase : str ): lowerCAmelCase = 0 lowerCAmelCase = 0 while index < len(lowerCamelCas...
4
1
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs ...
4
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_...
4
1
'''simple docstring''' def a_ ( lowerCamelCase : list ): if len(lowerCamelCase ) <= 1: return lst lowerCAmelCase = 1 while i < len(lowerCamelCase ): if lst[i - 1] <= lst[i]: i += 1 else: lowerCAmelCase , lowerCAmelCase ...
4
'''simple docstring''' 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 UpperCAmelCase_ ( unittest.TestCase ): def __Upp...
4
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mobilebert import MobileBertTokenizer __snake_case =logging....
4
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import loggin...
4
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase_ ( metaclass=__lowercase ): lowerCamelCase : Tuple = ['''flax''', '''transformers'''] def __init__( self : Optional[Any] , *UpperCAmelCase__ : ...
4
'''simple docstring''' from __future__ import annotations from statistics import mean def a_ ( lowerCamelCase : list[int] , lowerCamelCase : list[int] , lowerCamelCase : int ): lowerCAmelCase = [0] * no_of_processes lowerCAmelCase = [0] * no_of_proces...
4
1
'''simple docstring''' def a_ ( lowerCamelCase : int , lowerCamelCase : int , lowerCamelCase : int ): lowerCAmelCase = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series return total def a_ ( ): pr...
4
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determini...
4
1
'''simple docstring''' from typing import List import numpy as np def a_ ( lowerCamelCase : dict ): lowerCAmelCase = {key: len(lowerCamelCase ) for key, value in gen_kwargs.items() if isinstance(lowerCamelCase , lowerCamelCase )} if len(set(lists_lengths.valu...
4
'''simple docstring''' # Copyright (c) 2021-, NVIDIA CORPORATION. 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/lice...
4
1
'''simple docstring''' from __future__ import annotations from statistics import mean def a_ ( lowerCamelCase : list[int] , lowerCamelCase : list[int] , lowerCamelCase : int ): lowerCAmelCase = [0] * no_of_processes lowerCAmelCase = [0] * no_of_proces...
4
'''simple docstring''' from __future__ import annotations from typing import Any class UpperCAmelCase_ : def __init__( self : Optional[int] , UpperCAmelCase__ : int , UpperCAmelCase__ : int , UpperCAmelCase__ : ...
4
1
'''simple docstring''' import logging import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import librosa import torch from datasets import DatasetDict, load_dataset from packaging import version from torch import nn from transformers import...
4
'''simple docstring''' class UpperCAmelCase_ : def __init__( self : List[str] , UpperCAmelCase__ : list[int] ) -> None: lowerCAmelCase = len(UpperCAmelCase__ ) lowerCAmelCase = [0] * len_array if len_a...
4
1
'''simple docstring''' import os def a_ ( ): lowerCAmelCase = os.path.join(os.path.dirname(lowerCamelCase ) , 'num.txt' ) with open(lowerCamelCase ) as file_hand: return str(sum(int(lowerCamelCase ) for line in file_hand ) )[:10] if __name__ == ...
4
'''simple docstring''' def a_ ( lowerCamelCase : Optional[Any] ): return [ { 0: [1, 2], 1: [0, 2], 2: [0, 1, 3, 5], 3: [2, 4], 4: [3], 5: [2, 6, 8], 6: [5, 7], 7: [6, 8], 8:...
4
1
'''simple docstring''' import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def a_ ( lowerCamelCase : Dict ): lowerCAmelCase = {} lowerCAmel...
4
'''simple docstring''' 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_verbosi...
4
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __snake_case =logging.get_logger(__name__) __snake_case ={ """google...
4
'''simple docstring''' 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_se...
4
1
'''simple docstring''' import os import pytest from transformers.dynamic_module_utils import get_imports __snake_case =""" import os """ __snake_case =""" def foo(): import os return False """ __snake_case =""" def foo(): def bar(): if True:...
4
'''simple docstring''' import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def a_ ( lowerCamelCase : Dict ): lowerCAmelCase = {} lowerCAmel...
4
1
'''simple docstring''' from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record __snake_case ="""\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding ...
4
'''simple docstring''' import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings __snake...
4
1
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split __snake_case =datasets.load_iris() __snake_case =np.array(data["""data"""]) __snake_case =np.array(data["""tar...
4
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/f...
4
1
'''simple docstring''' def a_ ( lowerCamelCase : list[list[int]] , lowerCamelCase : int , lowerCamelCase : int , lowerCamelCase : set ): lowerCAmelCase , lowerCAmelCase = len(lowerCamelCase ), len(grid[0] ) if ( min(lowerCamelCase , lowerCamelCase ...
4
'''simple docstring''' import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor __snake_case =logging.get_logger(__name__) class UpperCAmelCase_ ( __lowercase ): def __init__( self : Dict , *Upper...
4
1
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_s...
4
'''simple docstring''' from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer __snake_case =logging...
4
1
'''simple docstring''' from __future__ import annotations class UpperCAmelCase_ : def __init__( self : List[Any] , UpperCAmelCase__ : int ) -> None: lowerCAmelCase = order # a_{0} ... a_{k} lowerCAmelCase ...
4
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case =logging.get_logger(__name__) __snake_case ={ """facebook/s2t-wav2vec2-large-en-de""": ( """https://huggingface.co/facebook/s2t-wav2vec2-large-en-d...
4
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __snake_case ={ """configuration_rem...
4
'''simple docstring''' from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class UpperCAmelCase_ ( __lowercase ): def __lt__( self : Optional[int] , UpperCAmelCa...
4
1
'''simple docstring''' 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 __snake_case ={ """facebook/maskfo...
4
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __snake_case ="""\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, ti...
4
1
'''simple docstring''' 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, RobertaT...
4
'''simple docstring''' from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record __snake_case ="""\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding ...
4
1
'''simple docstring''' import logging import os from .state import PartialState class UpperCAmelCase_ ( logging.LoggerAdapter ): @staticmethod def __UpperCAmelCase ( UpperCAmelCase__ : List[Any] ) -> Optional[int]: lowerCAmelCas...
4
'''simple docstring''' print((lambda quine: quine % quine)("""print((lambda quine: quine %% quine)(%r))"""))
4
1
'''simple docstring''' import unittest from transformers import AutoTokenizer, FalconConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester...
4
'''simple docstring''' import os __snake_case ={"""I""": 1, """V""": 5, """X""": 10, """L""": 50, """C""": 100, """D""": 500, """M""": 1_000} def a_ ( lowerCamelCase : str ): lowerCAmelCase = 0 lowerCAmelCase = 0 while index < len(lowerCamelCas...
4
1
'''simple docstring''' from ... import PretrainedConfig __snake_case ={ """sijunhe/nezha-cn-base""": """https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json""", } class UpperCAmelCase_ ( __lowercase ): lowerCamelCase : Dict = NEZHA_PRETRAINED...
4
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_...
4
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __snake_case ={ """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], ...
4
'''simple docstring''' 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 UpperCAmelCase_ ( unittest.TestCase ): def __Upp...
4
1
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig __snake_case =logging.get_logger(__name__) __snake_case ={ """Intel/dpt-large""": """https://huggingface.co/Intel/dpt-large/r...
4
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import loggin...
4
1
'''simple docstring''' import ast import os import re import shutil import tempfile import unittest from unittest import mock import torch from accelerate.test_utils.examples import compare_against_test from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command,...
4
'''simple docstring''' from __future__ import annotations from statistics import mean def a_ ( lowerCamelCase : list[int] , lowerCamelCase : list[int] , lowerCamelCase : int ): lowerCAmelCase = [0] * no_of_processes lowerCAmelCase = [0] * no_of_proces...
4
1
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip insta...
4
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determini...
4
1
'''simple docstring''' 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 ...
4
'''simple docstring''' # Copyright (c) 2021-, NVIDIA CORPORATION. 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/lice...
4
1
'''simple docstring''' import inspect import unittest from transformers import BitConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common i...
4
'''simple docstring''' from __future__ import annotations from typing import Any class UpperCAmelCase_ : def __init__( self : Optional[int] , UpperCAmelCase__ : int , UpperCAmelCase__ : int , UpperCAmelCase__ : ...
4
1
'''simple docstring''' import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class UpperCAmelCase_ ( ctypes.Structure ): # _fields is a specific attr expected by ctypes ...
4
'''simple docstring''' class UpperCAmelCase_ : def __init__( self : List[str] , UpperCAmelCase__ : list[int] ) -> None: lowerCAmelCase = len(UpperCAmelCase__ ) lowerCAmelCase = [0] * len_array if len_a...
4
1
'''simple docstring''' import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import Tokeniz...
4
'''simple docstring''' def a_ ( lowerCamelCase : Optional[Any] ): return [ { 0: [1, 2], 1: [0, 2], 2: [0, 1, 3, 5], 3: [2, 4], 4: [3], 5: [2, 6, 8], 6: [5, 7], 7: [6, 8], 8:...
4
1
'''simple docstring''' import unittest from transformers import BertGenerationTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin ...
4
'''simple docstring''' 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_verbosi...
4
1
'''simple docstring''' import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, ...
4
'''simple docstring''' 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_se...
4
1
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transf...
4
'''simple docstring''' import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def a_ ( lowerCamelCase : Dict ): lowerCAmelCase = {} lowerCAmel...
4
1
'''simple docstring''' def a_ ( ): return 1 def a_ ( lowerCamelCase : int ): return 0 if x < 0 else two_pence(x - 2 ) + one_pence() def a_ ( lowerCamelCase : int ): return 0 if x < 0 else five_pence(x - 5 ) + two_pence(lowerCamelCase ...
4
'''simple docstring''' import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings __snake...
4
1
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING __snake_case =logging.get_logger(__name__) class UpperCAmelCase_ ( __lowercase ): lowerCamelCase ...
4
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/f...
4
1
'''simple docstring''' def a_ ( lowerCamelCase : list ): if len(lowerCamelCase ) <= 1: return [tuple(lowerCamelCase )] lowerCAmelCase = [] def generate(lowerCamelCase : int , lowerCamelCase : list ): if k == 1: res.append(tuple(...
4
'''simple docstring''' import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor __snake_case =logging.get_logger(__name__) class UpperCAmelCase_ ( __lowercase ): def __init__( self : Dict , *Upper...
4
1
'''simple docstring''' __snake_case =frozenset( [ """prompt""", """height""", """width""", """guidance_scale""", """negative_prompt""", """prompt_embeds""", """negative_prompt_embeds""", """cross_attention_kwargs""", ...
4
'''simple docstring''' from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer __snake_case =logging...
4
1
'''simple docstring''' import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, Swin...
4
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case =logging.get_logger(__name__) __snake_case ={ """facebook/s2t-wav2vec2-large-en-de""": ( """https://huggingface.co/facebook/s2t-wav2vec2-large-en-d...
4
1
'''simple docstring''' from decimal import Decimal, getcontext from math import ceil, factorial def a_ ( lowerCamelCase : int ): if not isinstance(lowerCamelCase , lowerCamelCase ): raise TypeError('Undefined for non-integers' ) elif precision < 1: ra...
4
'''simple docstring''' from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class UpperCAmelCase_ ( __lowercase ): def __lt__( self : Optional[int] , UpperCAmelCa...
4
1
'''simple docstring''' import argparse from collections import defaultdict import yaml __snake_case ="""docs/source/en/_toctree.yml""" def a_ ( lowerCamelCase : Any ): lowerCAmelCase = defaultdict(lowerCamelCase ) for doc in model_doc: coun...
4
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __snake_case ="""\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, ti...
4
1
'''simple docstring''' import warnings from .generation import TFGenerationMixin class UpperCAmelCase_ ( __lowercase ): # warning at import time warnings.warn( '''Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will ''' ...
4
'''simple docstring''' from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record __snake_case ="""\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding ...
4
1
'''simple docstring''' import argparse import json import os import torch from transformers.file_utils import has_file from diffusers import UNetaDConditionModel, UNetaDModel __snake_case =False __snake_case =True __snake_case =False if __name__ == "__main_...
4
'''simple docstring''' print((lambda quine: quine % quine)("""print((lambda quine: quine %% quine)(%r))"""))
4
1
'''simple docstring''' __snake_case ={str(digit): digit**5 for digit in range(10)} def a_ ( lowerCamelCase : int ): return sum(DIGITS_FIFTH_POWER[digit] for digit in str(lowerCamelCase ) ) def a_ ( ): return sum( number for num...
4
'''simple docstring''' import os __snake_case ={"""I""": 1, """V""": 5, """X""": 10, """L""": 50, """C""": 100, """D""": 500, """M""": 1_000} def a_ ( lowerCamelCase : str ): lowerCAmelCase = 0 lowerCAmelCase = 0 while index < len(lowerCamelCas...
4
1
'''simple docstring''' import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class UpperCAmelCase_ ( unittest.TestCase ): def __UpperCAmelCase ( self : List[str] ...
4
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_...
4
1
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_...
4
'''simple docstring''' 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 UpperCAmelCase_ ( unittest.TestCase ): def __Upp...
4
1
'''simple docstring''' 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 UpperCAmelCase_ ( unittest.TestCase ): def __Upp...
4
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import loggin...
4
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __snake_case ={ """configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""], } try: if not is_torch_ava...
4
'''simple docstring''' from __future__ import annotations from statistics import mean def a_ ( lowerCamelCase : list[int] , lowerCamelCase : list[int] , lowerCamelCase : int ): lowerCAmelCase = [0] * no_of_processes lowerCAmelCase = [0] * no_of_proces...
4
1
'''simple docstring''' 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_docstrin...
4
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determini...
4
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lice...
4
'''simple docstring''' # Copyright (c) 2021-, NVIDIA CORPORATION. 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/lice...
4
1
'''simple docstring''' import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_availab...
4
'''simple docstring''' from __future__ import annotations from typing import Any class UpperCAmelCase_ : def __init__( self : Optional[int] , UpperCAmelCase__ : int , UpperCAmelCase__ : int , UpperCAmelCase__ : ...
4
1
'''simple docstring''' import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def a_ ( lowerCamelCase : Tuple , lowerCamelCase : Dict , lowerCamelCase : Tupl...
4
'''simple docstring''' class UpperCAmelCase_ : def __init__( self : List[str] , UpperCAmelCase__ : list[int] ) -> None: lowerCAmelCase = len(UpperCAmelCase__ ) lowerCAmelCase = [0] * len_array if len_a...
4
1
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils impor...
4
'''simple docstring''' def a_ ( lowerCamelCase : Optional[Any] ): return [ { 0: [1, 2], 1: [0, 2], 2: [0, 1, 3, 5], 3: [2, 4], 4: [3], 5: [2, 6, 8], 6: [5, 7], 7: [6, 8], 8:...
4
1
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .modeling_utils import ModelMixin from...
4
'''simple docstring''' 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_verbosi...
4
1
'''simple docstring''' from collections.abc import Callable import numpy as np def a_ ( lowerCamelCase : Callable , lowerCamelCase : float , lowerCamelCase : float , lowerCamelCase : float , lowerCamelCase : float ): lowerCAmelCase = int(np.ceil((x_end ...
4
'''simple docstring''' 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_se...
4
1
'''simple docstring''' def a_ ( lowerCamelCase : str , lowerCamelCase : str ): def get_matched_characters(lowerCamelCase : str , lowerCamelCase : str ) -> str: lowerCAmelCase = [] lowerCAmelCase = min(len(_stra ) , len(_stra ) ) // 2 ...
4
'''simple docstring''' import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def a_ ( lowerCamelCase : Dict ): lowerCAmelCase = {} lowerCAmel...
4
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeli...
4
'''simple docstring''' import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings __snake...
4
1
'''simple docstring''' import heapq def a_ ( lowerCamelCase : dict ): lowerCAmelCase = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the queue will be filled like a Priority Queue # heapq works with...
4
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/f...
4
1
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ...
4
'''simple docstring''' import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor __snake_case =logging.get_logger(__name__) class UpperCAmelCase_ ( __lowercase ): def __init__( self : Dict , *Upper...
4
1
'''simple docstring''' import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixi...
4
'''simple docstring''' from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer __snake_case =logging...
4
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligne...
4
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case =logging.get_logger(__name__) __snake_case ={ """facebook/s2t-wav2vec2-large-en-de""": ( """https://huggingface.co/facebook/s2t-wav2vec2-large-en-d...
4
1
'''simple docstring''' 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_configurat...
4
'''simple docstring''' from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class UpperCAmelCase_ ( __lowercase ): def __lt__( self : Optional[int] , UpperCAmelCa...
4
1
'''simple docstring''' import os import unittest from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, BertTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ...
4
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __snake_case ="""\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, ti...
4
1
'''simple docstring''' import unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, ids_ten...
4
'''simple docstring''' from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record __snake_case ="""\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding ...
4
1
'''simple docstring''' from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLa...
4
'''simple docstring''' print((lambda quine: quine % quine)("""print((lambda quine: quine %% quine)(%r))"""))
4
1
'''simple docstring''' import os from tempfile import TemporaryDirectory from unittest import TestCase import pytest from absl.testing import parameterized from datasets import config from datasets.arrow_reader import HF_GCP_BASE_URL from datasets.builder import DatasetBuilder from datasets.d...
4
'''simple docstring''' import os __snake_case ={"""I""": 1, """V""": 5, """X""": 10, """L""": 50, """C""": 100, """D""": 500, """M""": 1_000} def a_ ( lowerCamelCase : str ): lowerCAmelCase = 0 lowerCAmelCase = 0 while index < len(lowerCamelCas...
4
1
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __snake_case ="""\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, ti...
4
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_...
4
1
'''simple docstring''' from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer __snake_case =logging...
4
'''simple docstring''' 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 UpperCAmelCase_ ( unittest.TestCase ): def __Upp...
4
1