code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
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 lowerCamelCase__ : Optional[int] = logging.get_logger(__name__) lowerCamelCase__ ...
12
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorf...
179
0
'''simple docstring''' from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseModelOutputWithNoAtten...
707
'''simple docstring''' import random from typing import Any def UpperCAmelCase ( lowerCamelCase_ :list ): '''simple docstring''' for _ in range(len(lowerCamelCase_ ) ): snake_case_ : Union[str, Any] = random.randint(0 , len(lowerCamelCase_ ) - 1 ) ...
267
0
"""simple docstring""" from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class UpperCamelCase__ : """simple docstring""" A__ : Union[str, Any] = ...
104
'''simple docstring''' import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class SCREAMING_SNAKE_CASE ( __a ): """simple docstring""" __A = "" __A = ( None # protocol passed in...
309
0
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case = logging.get_logger(__name__) snake_case = { '''huggingface/time-series-transformer-tourism-mon...
404
"""simple docstring""" from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES snake_case = logging.get_logger(__name__) sna...
404
1
'''simple docstring''' import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def _lowerCAmelCase ( __magic_name__ : int , __magic_name__ : int , __magic_name__ : int , __magic_name__ : int , __magic_name__...
92
'''simple docstring''' from __future__ import annotations import math import numpy as np from numpy.linalg import norm def SCREAMING_SNAKE_CASE ( lowercase_ : np.ndarray , lowercase_ : np.ndarray ): return math.sqrt(sum(pow(a - b , 2 ) for a, b in zip(lowercase_ , ...
588
0
'''simple docstring''' from __future__ import annotations from fractions import Fraction def UpperCAmelCase ( A : int , A : int ): return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num / den ) def UpperCAmelCase ( A ...
711
'''simple docstring''' import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin lowerCAmelCase_ : ...
464
0
'''simple docstring''' import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_atte...
107
"""simple docstring""" import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from t...
449
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_chann...
716
"""simple docstring""" from typing import Any def __lowerCAmelCase ( lowercase : list , lowercase : list , lowercase : dict , lowercase : dict , lowercase : dict , ) -> list: """simple docstring""" ...
117
0
def lowerCAmelCase ( UpperCAmelCase = 100_0000 ) ->int: """simple docstring""" __magic_name__ : int = 1 __magic_name__ : Union[str, Any] = 1 __magic_name__ : Union[str, Any] = {1: 1} for inpu...
154
from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concatenate_iterable_dat...
154
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCamelCase : List[str] = { 'configuration_nllb_moe': [ 'NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'NllbMoeConfig', ] } try: if not is_torch_a...
710
"""simple docstring""" def snake_case (A_ :int ): '''simple docstring''' if upper_limit < 0: raise ValueError('Limit for the Catalan sequence must be ≥ 0' ) a : Any = [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 a : Optional[int] = 1 ...
118
0
import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def lowerCamelCase__ ( lowercase ): """simple docstring""" SCREAMING_SNAKE_CASE : Union[str, Any] = [ "decoder.version", ...
62
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _SCREAMING_SNAKE_CASE = { """configuration_maskformer""": ["""MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MaskFormerConfig"""...
163
0
"""simple docstring""" import os import jsonlines import numpy as np from tqdm import tqdm lowerCAmelCase__ = 2048 lowerCAmelCase__ = 4096 lowerCAmelCase__ = 42 lowerCAmelCase__ = os.environ.pop('''PROCESS_TRAIN''', '''false''') lowerCAmelCase__ ...
598
"""simple docstring""" from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accele...
598
1
import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class __SCREAMING_SNAKE_CASE ( unittest.TestCase ): def __lowerCamelCase ( self ): lowercase : int = Vector([1, 2, ...
319
import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import FlaxGenerationTesterMixin f...
319
1
from random import randint from tempfile import TemporaryFile import numpy as np def _snake_case ( lowerCAmelCase : int , lowerCAmelCase : str , lowerCAmelCase : Tuple ): """simple docstring""" SCREAMING_SNAKE_CASE_ : Tuple = 0 i...
714
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTesterMixin...
316
0
import json import logging import os import socket import git import numpy as np import torch logging.basicConfig( format='''%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s''', datefmt='''%m/%d/%Y %H:%M:%S''', level=logging.INFO, ) lowerCAmelCase__ :List[str] = log...
618
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging lowerCAmelCase__ :int = logging.get_logger(__name__) def lowerCAmelCase__ ( a__: Dict ) -> List[str]: '''simple ...
618
1
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_feature_extraction_common import Seque...
647
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs ...
647
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices A__: Tuple = logging.get_logger(__name__) A__: Tuple = { '''microsoft/focalnet-tiny''': '''https://hug...
380
def lowerCAmelCase_ ( A_): if not all(char in "01" for char in bin_string): raise ValueError("Non-binary value was passed to the function") if not bin_string: raise ValueError("Empty string was passed to the function") UpperCamelCase__: List[Any] = "" ...
380
1
"""simple docstring""" import math import time from typing import Dict, List, Optional from torch.utils.data import Dataset from transformers import SeqaSeqTrainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_devi...
709
"""simple docstring""" from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _SCREAMING_SNAKE_...
239
0
"""simple docstring""" import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ....
264
import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class a ( unittest.TestCase , __UpperCAmelC...
611
0
from typing import Dict from .base import GenericTensor, Pipeline class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): def __lowerCAmelCase ( self, _a=None, _a=None, _a=None, **_a ) -> Union[str, Any]: if tokenize_kwargs is None: __SCR...
721
import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput def _A...
214
0
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def __UpperCAmelCase( lowercase_ , lowercase_=() , lowercase_=None , lowercase_="no" , lowercase_="29500" ...
114
import os def __UpperCAmelCase( ): with open(os.path.dirname(lowercase_ ) + '''/p022_names.txt''' ) as file: _lowerCamelCase : Optional[int] = str(file.readlines()[0] ) _lowerCamelCase : List[Any] = names.replace('''"''' , '''''' ).split(...
114
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCamelCase : Union[str, Any] = { '''configuration_clipseg''': [ '''CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CLIPSegC...
417
'''simple docstring''' from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, flip_channel_order, get_resize_output_image_size, rescale, ...
417
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) a : Union[str, Any] = { 'configuration_vision_encoder_decoder': ['VisionEncoderDecod...
640
'''simple docstring''' def __magic_name__ ( __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase, __UpperCAmelCase ) -> Optional[Any]: '''simple docstring''' snake_case_ = [False] * len(__UpperCAmelCase ) snake_case_ = [] queue.append...
640
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_modeling...
604
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : Any = logging.get_logger(__name__) _lowerCAmelCase : Tuple = {} class __snake_case ( SCREAMING_SNAKE_CASE ): SCREAMING_SNAKE_CASE__ = 'llama' SCREAMING_SNAKE_CASE...
604
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase :Union[str, Any] = logging.get_logger(__name__) lowerCamelCase :Optional[Any] = { "uw-madison/mra-base-512-4": "https://huggingface.co/uw-madison/mra-...
667
import re from filelock import FileLock try: import nltk a_ : Optional[Any] = True except (ImportError, ModuleNotFoundError): a_ : Union[str, Any] = False if NLTK_AVAILABLE: with FileLock(".lock") as lock: nltk.download("punkt", quiet=True) def ...
439
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _lowerCAmelCase = {"configuration_encoder_decoder": ["EncoderDecoderConfig"]} try: if not is_...
245
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCAmelCase = { "configuration_rembert": ["REMBERT_PRE...
245
1
'''simple docstring''' import comet # From: unbabel-comet import torch import datasets UpperCamelCase__ : List[Any] = datasets.logging.get_logger(__name__) UpperCamelCase__ : Tuple = '''\ @inproceedings{rei-EtAl:2020:WMT, author = {Rei, Ricardo and Stewart, Craig...
578
'''simple docstring''' from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def lowerCAmelCase_ ( _lowerCamelCase: str , _lowerCamelCase: float | Decimal , _lowerCamelCase: float = 10**-10 ): __SCREAMING_SNAKE_CASE :...
578
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase = logging.get_logger(__name__) _lowerCamelCase = { 'YituTech/conv-bert-base': 'https://huggingface....
59
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from dataset...
59
1
import math UpperCAmelCase : str = 10 UpperCAmelCase : int = 7 UpperCAmelCase : Any = BALLS_PER_COLOUR * NUM_COLOURS def __lowerCamelCase ( lowerCamelCase__ : int = 20 ): '''simple docstring''' lowerCamelCase = math.comb(lowerCamelCase_...
457
import itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin if is_speech_available(): from trans...
457
1
'''simple docstring''' import operator def __snake_case (__UpperCAmelCase , __UpperCAmelCase = False , __UpperCAmelCase = None ): """simple docstring""" lowerCamelCase_ : List[Any] = operator.lt if reverse else operator.gt lowerCamelCase_ : Union[str, A...
719
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionSAGPipeline, UNetaDConditionModel, ) from diffusers.utils import slow,...
418
0
import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase_ ( _SCREAMING_SNAKE_CASE : str , _SCREAMING_SNAKE_CASE : List...
635
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_funnel import FunnelTokenizer SCREAMING_SNAKE_CASE : Union[str, Any] = logging.get_logger(__na...
635
1
def lowerCAmelCase_ ( __lowerCamelCase ): if len(__lowerCamelCase ) < 2: return collection def circle_sort_util(__lowerCamelCase , __lowerCamelCase , __lowerCamelCase ) -> bool: __snake_case : Tuple = False ...
714
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel _snake_case : int = { "text_branch": "text_model", "audio_branch": "audio_model.audio_encoder", "attn": "attention.self", "self.proj": "output.d...
203
0
"""simple docstring""" import uuid from typing import Any, Dict, List, Optional, Union from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf if is_torch_available(): import torch __...
357
"""simple docstring""" # This code is adapted from OpenAI's release # https://github.com/openai/human-eval/blob/master/human_eval/execution.py import contextlib import faulthandler import io import multiprocessing import os import platform import signal import tempfile def A_ ( __lowercase , ...
357
1
"""simple docstring""" 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 A = """src/transformers""" A = """docs/sou...
717
"""simple docstring""" import argparse import torch from datasets import load_dataset from donut import DonutModel from transformers import ( DonutImageProcessor, DonutProcessor, DonutSwinConfig, DonutSwinModel, MBartConfig, MBartForCausalLM, VisionEncoderDecoderModel, XLMRob...
487
0
'''simple docstring''' from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embedd...
430
'''simple docstring''' def __lowerCamelCase ( A__ ) -> str: """simple docstring""" UpperCamelCase = int(A__ ) if decimal in (0, 1): # Exit cases for the recursion return str(A__ ) UpperCamelCase , UpperCamelCase...
430
1
from __future__ import annotations _UpperCAmelCase = tuple[int, int, int] _UpperCAmelCase = tuple[str, str, str] # used alphabet -------------------------- # from string.ascii_uppercase _UpperCAmelCase = """ABCDEFGHIJKLMNOPQRSTUVWXYZ""" # -------------------------- default selection -...
707
def UpperCamelCase ( __lowercase : list ): '''simple docstring''' A_ : str = len(__lowercase ) for _ in range(__lowercase ): for i in range(_ % 2 ,arr_size - 1 ,2 ): if arr[i + 1] < arr[i]: A_ , A_ : Optional[Any] = a...
70
0
'''simple docstring''' from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = { "nielsr/canine-s": 20_48, } # Unicode defines...
539
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import Aut...
539
1
"""simple docstring""" import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class UpperCamel...
406
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging ...
406
1
import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup lowerCamelCase__ = logging.get_logger(__name__) class lowerCAmelCase_...
612
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _lowerCAmelCase : Tuple = { """configuration_resnet""": ["""RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ResNetConfig""", ""...
701
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _lowerCAmelCase : Optional[Any] = logging.get_logger(__name__) _lowerCAmelCase : Dict = { 'SenseTime/deformable-detr': 'https://huggingface...
646
0
"""simple docstring""" def lowerCamelCase ( _snake_case = 3 ,_snake_case = 7 ,_snake_case = 1000000 ): UpperCAmelCase__ : str = 0 UpperCAmelCase__ : Any = 1 for current_denominator in range(1 ,limit + 1 ): UpperCAmelCase__ : Dict ...
110
"""simple docstring""" def lowerCamelCase ( _snake_case ,_snake_case ): UpperCAmelCase__ : Optional[int] = '' for i in table: res += inp[i - 1] return res def lowerCamelCase ( _snake_case ): return data[1:] + data[0] def lowerCamelCase ( ...
110
1
'''simple docstring''' from __future__ import annotations def A (__lowerCamelCase :list[int | str] ): create_state_space_tree(__lowerCamelCase , [] , 0 , [0 for i in range(len(__lowerCamelCase ) )] ) def A (__lowerCamelCase :list[int | str] , __lowerCamelCase :list[int | str]...
162
'''simple docstring''' def A (__lowerCamelCase :int ): if not isinstance(__lowerCamelCase , __lowerCamelCase ): _lowerCAmelCase = f'Input value of [number={number}] must be an integer' raise TypeError(__lowerCamelCase ) if number < 1: _lowerCAmelC...
162
1
"""simple docstring""" def lowerCamelCase ( _snake_case ,_snake_case ): UpperCAmelCase__ : Union[str, Any] = len(_snake_case ) UpperCAmelCase__ : Dict = len(_snake_case ) UpperCAmelCase__ : str = [[False for _ in range(m + 1 )] fo...
110
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics ...
67
0
"""simple docstring""" import math class __lowerCamelCase : '''simple docstring''' def _UpperCAmelCase ( self , __UpperCAmelCase , __UpperCAmelCase ) -> int: _a = 0.0 _a = 0.0 for i in range(len(__Upp...
285
"""simple docstring""" from typing import Any def A_ ( _lowerCAmelCase : list ): """simple docstring""" if not input_list: return [] _a = [input_list.count(_lowerCAmelCase ) for value in input_list] _a = max(_lowerCAmelCase ...
285
1
'''simple docstring''' import numpy as np def __lowercase (_SCREAMING_SNAKE_CASE :np.ndarray , _SCREAMING_SNAKE_CASE :np.ndarray , _SCREAMING_SNAKE_CASE :float = 1E-1_2 , _SCREAMING_SNAKE_CASE :int = 1_00 , ): assert np.shape(_SCREAMING_SNAKE_CASE )[0]...
507
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer snake_case_ = {"""vocab_file""": """vocab.txt""", """tokenizer_file""": """tokeniz...
507
1
'''simple docstring''' import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_secondary_learner, ) from torch.utils...
705
import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Ac...
412
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __A = logging.get_logger(__name__) __A = { "google/bit-50": "https://huggingface.co/google/bit-50/resolve/main/config...
68
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { 'weiweishi/roc-bert-base-zh': 'https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json', } class Upp...
473
0
import torch from ..models.speechta import SpeechTaForTextToSpeech, SpeechTaHifiGan, SpeechTaProcessor from ..utils import is_datasets_available from .base import PipelineTool if is_datasets_available(): from datasets import load_dataset class _a ( lowerCamelCase_ ): """simple d...
704
from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline lowerCAmelCase__ = logging.get_logger(__name__) class _a ( lowerCamelCase_ ...
594
0
from typing import TYPE_CHECKING from ....utils import _LazyModule lowercase : int = {'tokenization_tapex': ['TapexTokenizer']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys lowercase : Dict = _LazyModule(__name__, globals()["""__file__...
302
"""simple docstring""" import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class __A : def __init__( self , a__ , a__ , a__ ): if dst_width < 0 or dst_height < 0: raise ValueError("""Destination width/height should be > 0""" ) ...
213
0
'''simple docstring''' from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward ...
265
'''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/licenses/LICENSE...
265
1
'''simple docstring''' from __future__ import annotations from math import pi # Define the Reduced Planck Constant ℏ (H bar), speed of light C, value of # Pi and the function lowercase_ = 1.0_54_57_18_17e-34 # unit of ℏ : J * s lowercase_ = 3e8 # unit of c : m * s^-1 def lowerCAm...
11
"""simple docstring""" import math from collections.abc import Iterator from itertools import takewhile def __lowerCAmelCase ( lowercase : int ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or nu...
178
0
'''simple docstring''' import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class __snake_case( unittest.TestCase ): '''simple docstring''' def __snake_case ( self ) -...
344
'''simple docstring''' import unittest from queue import Empty from threading import Thread from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available from transformers.testing_utils import CaptureStdout, require_torch, torch_device from ..test_modeling_common imp...
344
1
from __future__ import annotations def lowerCamelCase__ (_UpperCAmelCase , _UpperCAmelCase): SCREAMING_SNAKE_CASE = [] SCREAMING_SNAKE_CASE = [] SCREAMING_SNAKE_CASE = 0 SCREAMING_SNAKE_CASE = sum(_UpperCAmelCase) create_state_space_tree(_Upp...
73
"""simple docstring""" import math import unittest from transformers import BioGptConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_...
682
0
'''simple docstring''' from collections.abc import Callable import numpy as np def __UpperCamelCase ( _A : Tuple , _A : Any , _A : Any , _A : Tuple , _A : Dict ) -> np.array: """simple docstring""" lowerCAmelCase : List...
719
'''simple docstring''' import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _lowerCAmelCase : List[Any] = logging.getLogger(__name__) def __UpperCamelCase ( ) -> Any: """simple docstring""" lowerCAmelCase ...
646
0
import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets __lowercase : Optional[Any] =datasets.logging.get_logger(__name__) __lowercase : Optional[Any] ="""\ @inproceedings{bleurt, title={BLEURT: Learning Robust Metrics for T...
54
import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging SCREAMING_SNAKE_CASE__ : Union[str, Any] ...
205
0
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask f...
716
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tok...
154
0
'''simple docstring''' import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, ...
8
'''simple docstring''' def _lowerCAmelCase ( __snake_case : int ) -> bool: return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('''Program to check whether a number is a Perfect number or ...
8
1
'''simple docstring''' import json import os import re import unicodedata from json.encoder import INFINITY from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import regex from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base impor...
654
'''simple docstring''' from ...configuration_utils import PretrainedConfig class A ( UpperCAmelCase ): a_ = '''bert-generation''' def __init__( self : str , __a : str=5_0_3_5_8 , __a : int=1_0_2_4 , __a ...
654
1
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 __UpperCamelCase: int = logging.get_logger(__name__) __UpperCamelCase: Any = { ""...
266
import argparse import os import re __UpperCamelCase: Any = """src/transformers/models/auto""" # re pattern that matches mapping introductions: # SUPER_MODEL_MAPPING_NAMES = OrderedDict or SUPER_MODEL_MAPPING = OrderedDict __UpperCamelCase: Dict = re.compile(r"""[A-Z_]+_MAPPING(\s+|_[A-Z_]+...
266
1
from __future__ import annotations import string from itertools import cycle, product from pathlib import Path __A =( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) __A =[ord(letter) for letter in string.ascii_lowercase] __A ={ord(char) for char in VALID_CHARS} ...
313
import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class _SCREAMING_SNAKE_CASE ( unittest.TestCase ): def SCREAMING_SNAKE_CASE_( self ) -> None: lowerCamelCase_ = Vector([1, 2, 3] ...
313
1
import json import os import shutil import tempfile import unittest from multiprocessing import get_context from pathlib import Path import datasets import numpy as np from datasets import load_dataset from parameterized import parameterized from transformers import AutoProcessor from transformers...
33
"""simple docstring""" from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, Stab...
624
0
import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.i...
704
from jiwer import compute_measures import datasets lowerCAmelCase__: Union[str, Any] = "\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From WER and RIL to MER and WIL: ...
311
0
'''simple docstring''' import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common impor...
72
'''simple docstring''' def UpperCamelCase ( lowercase_ : int ) -> int: '''simple docstring''' if n == 1 or not isinstance(lowercase_ , lowercase_ ): return 0 elif n == 2: return 1 else: lowercase =[0, 1] for i in range(2 , n + 1 ): sequenc...
72
1
'''simple docstring''' from __future__ import annotations def UpperCamelCase__ ( __magic_name__ : float , __magic_name__ : float , __magic_name__ : float , ) -> tuple: '''simple docstring''' if (electron_conc, hole_conc, intrinsic_conc).count(...
419
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, ...
419
1
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('>=', '4.25.0')): raise OptionalDepende...
533
import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever UpperCAmelCase__ : Union[str, Any] = logging.getLogger(__name__) class __lowercase ...
313
0
'''simple docstring''' 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 ...
715
'''simple docstring''' import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def UpperCAmelCase__ ( ...
667
0
import argparse import json from typing import List from ltp import LTP from transformers.models.bert.tokenization_bert import BertTokenizer def a ( lowerCamelCase_ ): '''simple docstring''' # This defines a "chinese character" as anything in the CJK Unicode block: # ht...
183
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class _UpperCAmelCase ( A__...
183
1
def UpperCAmelCase ( _lowerCamelCase : int ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : List[Any] = 0 while num > 0: digit_sum += num % 10 num //= 10 return digit_sum def UpperCAmelCase ( _lo...
26
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import IterableDataset fro...
26
1
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def lowerCamelCase__ ( lowercase , lowercase ): """simple docstring""" SCREAMING_SNAKE_CASE : List[Any] = F'''{sampling_rate}''' SCREAMING_SNAKE_CASE ...
62
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available A : Union[str, Any] = { """configuration_m2m_100""": ["""M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP""", """M2M100Config""...
349
0
import argparse import os import torch from transformers.utils import WEIGHTS_NAME A = ['small', 'medium', 'large'] A = 'lm_head.decoder.weight' A = 'lm_head.weight' def a(lowercase__ , lowercase__ ): '''simple docstring''' snake_case_ = torch.load(l...
46
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging A = logging.get_logger(__name__) A = { 'microsoft/unispeech-sat-base-100h-libri-ft': ( 'https://huggingface.co/microsoft/unispeech-sat-base-100h-libri-ft/resolv...
46
1
'''simple docstring''' from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def UpperCamelCase_ ( ) -> Optional[Any]: """simple docstring""" import os as original_os from os import path as original_path from...
244
'''simple docstring''' def UpperCamelCase_ ( _UpperCAmelCase : int , _UpperCAmelCase : int ) -> int: """simple docstring""" return int((input_a, input_a).count(0 ) == 0 ) def UpperCamelCase_ ( ) -> None: ...
244
1
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, ...
387
import inspect import unittest from transformers import DPTConfig from transformers.file_utils import is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_comm...
387
1
def lowerCamelCase_ ( _UpperCamelCase ) -> list[int]: """simple docstring""" snake_case_ : Optional[int] = [0 for i in range(len(_UpperCamelCase ) )] # initialize interval's left pointer and right pointer snake_case_ , snake_case_ : ...
60
def UpperCamelCase_( _snake_case : int = 600851475143 ): """simple docstring""" try: __a =int(_snake_case ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: raise ValueErro...
242
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE__ : Union[str, Any] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ : Any = {} class a__( lowercase__ ): a_ : Optional[int] = """llama""" a_...
715
'''simple docstring''' import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def ...
581
0
import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test_mo...
16
from typing import Any class __lowercase : def __init__( self , lowercase_) -> str: __snake_case = data __snake_case = None def __repr__( self) -> str: return F"Node({self....
313
0
"""simple docstring""" from __future__ import annotations from typing import Generic, TypeVar __lowerCAmelCase : Optional[Any] = TypeVar('''T''') class _lowerCAmelCase ( Generic[T] ): """simple docstring""" def __init__( self , _lowercase ) -...
719
"""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_ava...
21
0
import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _SCREAMING_SNAKE_CASE ( snake_case ...
256
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class _SCREAMING_SNAKE_CASE : lowerCamelCase_ = 42 lowerCamelCase_ = 42 class _SCREAMING_SNAKE_CASE : def __...
256
1
from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def A_ ( snake_case : int ) -> int: '''simple docstring''' def is_in_circle(snake_case : float , snake_case : float ) -> bool: ...
451
from collections import Counter from timeit import timeit def A_ ( snake_case : str = "" , ) -> bool: '''simple docstring''' return sum(c % 2 for c in Counter(input_str.replace(''' ''' , '''''' ).lower() ).values() ) < 2 def A_ ( snake_case : str ...
451
1
import string from math import logaa def _lowerCAmelCase ( UpperCamelCase__: str , UpperCamelCase__: str ) -> int: """simple docstring""" A = document.translate( str.maketrans("""""" , """""" , string.punctuation ) ).replace("""\n""...
641
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def _lowerCAmelCase ( UpperCamelCase__: Optional[Any] ) -> Optio...
641
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( Diffu...
706
"""simple docstring""" def UpperCAmelCase__ ( A__ ) -> list[int]: """simple docstring""" if length <= 0 or not isinstance(A__ , A__ ): raise ValueError("Length must be a positive integer." ) return [n * (2 * n - 1) for n in range(A__ )] if __name__ == "__main__": ...
274
0
'''simple docstring''' UpperCAmelCase__ : str = {"a": ["c", "b"], "b": ["d", "e"], "c": [], "d": [], "e": []} UpperCAmelCase__ : Any = ["a", "b", "c", "d", "e"] def A ( UpperCamelCase_ : List[Any] , UpperCamelCase_ : str , UpperCamelCase_ : Any...
48
import sys def __magic_name__ ( __lowerCAmelCase : str ) -> Union[str, Any]: __lowerCamelCase = len(__lowerCAmelCase ) __lowerCamelCase = [[0 for x in range(__lowerCAmelCase )] for x in range(__lowerCAmelCase )] __lowerCamelCase = ...
298
0
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 _UpperCamelCase ( lowerCAmelCase ): UpperCAmelCase_ = (DP...
364
import random import unittest import torch from diffusers import IFInpaintingSuperResolutionPipeline 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_...
364
1
import numpy as np def UpperCAmelCase_ ( __UpperCAmelCase : np.array ) -> np.array: return 1 / (1 + np.exp(-vector )) if __name__ == "__main__": import doctest doctest.testmod()
31
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): ...
54
0
def SCREAMING_SNAKE_CASE ( snake_case_ : int ): if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(snake_case_ , snake_case_ ): raise TypeError("Input value must be a 'int' type" ) return bin(snake_case_ ).count("1" ) ...
25
from __future__ import annotations import time __lowerCamelCase : str = list[tuple[int, int]] __lowerCamelCase : Optional[int] = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0]...
25
1
import logging import os import sys from pathlib import Path from unittest.mock import patch from parameterized import parameterized from run_eval import run_generate from run_eval_search import run_search from transformers.testing_utils import CaptureStdout, TestCasePlus, slow from utils imp...
47
def SCREAMING_SNAKE_CASE ( snake_case , snake_case , snake_case , snake_case ) -> int: # Return True if there is node that has not iterated. __lowercase = [False] * len(snake_case ) __lowercase = [] queue.append(snake_case ) ...
375
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowerCAmelCase : int = { "configuration_chinese_clip": [ "CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "ChineseCLIPConfig", "Chin...
710
import heapq import sys import numpy as np _lowerCAmelCase : str = tuple[int, int] class __snake_case : def __init__( self ): """simple docstring""" lowerCAmelCase__ = [] lowerCAmelCase__ = set() def SCREAMING_SNAKE_CASE_ ( ...
604
0
import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImageProc...
280
def lowercase__ ( _UpperCamelCase , _UpperCamelCase) -> bool: """simple docstring""" return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
280
1
import os import zipfile import pytest from datasets.utils.extract import ( BzipaExtractor, Extractor, GzipExtractor, LzaExtractor, SevenZipExtractor, TarExtractor, XzExtractor, ZipExtractor, ZstdExtractor, ) from .utils import require_lza, require_pyazr, require_zstandard @...
712
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowercase: int = { '''configuration_mvp''': ['''MVP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MvpConfig''', '''MvpOnnxConfig'''], '''tokenization_mvp''': ['''MvpTo...
225
0
lowerCamelCase__ : int = tuple[float, float, float] lowerCamelCase__ : Optional[Any] = tuple[float, float, float] def UpperCAmelCase_ ( __UpperCAmelCase : Pointad , __UpperCAmelCase : Pointad ) -> Vectorad: SCREAMING_SNAKE_CASE_ ...
31
import os import re import shutil import sys import tempfile import unittest import black lowercase : Tuple = 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_copies # noqa: E402 # This is the refe...
336
0
import functools def lowerCAmelCase__ ( _UpperCamelCase : Optional[int] , _UpperCamelCase : List[str] ) -> int: """simple docstring""" snake_case = len(lowerCamelCase__ ) snake_case = len(lowerCamelCase__ ...
715
"""simple docstring""" import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class lowerCAmelCase_ ( unittest.TestCase ): """simple docstring""" def snake_cas...
104
0
import torch from transformers import AutoModel class _snake_case ( torch.nn.Module ): def __init__( self: str , __lowerCamelCase: Tuple="sayef/fsner-bert-base-uncased" ) -> str: super(__SCREAMING_SNAKE_CASE , self ).__init__() _...
382
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE : List[str] = {} tr...
549
0
import operator as op def _snake_case ( A ) -> List[Any]: lowerCAmelCase__ = [] lowerCAmelCase__ = lambda A , A : int(x / y ) # noqa: E731 integer division operation lowerCAmelCase__ = { '''^''': op.pow, '''*''': op....
704
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaF...
98
0
'''simple docstring''' from sklearn.metrics import recall_score import datasets __UpperCamelCase = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is...
26
"""simple docstring""" import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class __magic_name__ ( lowercase__ ): def __init__( self : int , *snake_ca...
163
0
import argparse import struct import unittest class lowerCamelCase__ : """simple docstring""" def __init__( self , snake_case ): '''simple docstring''' UpperCamelCase__ = data # Initialize hash values UpperCamelCase__ = ...
709
from __future__ import annotations def UpperCamelCase_( _A :list[int] , _A :int )-> list[int]: UpperCamelCase__ = 0 UpperCamelCase__ = len(_A ) - 1 while i < j: if nums[i] + nums[j] == target: return [i, j] elif nums[i] + nums[j] < target: ...
185
0
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( __snake_case ): _lowerCAmelCase = "encoder-decoder" _lowe...
581
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squee...
581
1
def a__ ( _UpperCamelCase : int ,_UpperCamelCase : int ): if not isinstance(_lowerCamelCase ,_lowerCamelCase ): raise ValueError('''iterations must be defined as integers''' ) if not isinstance(_lowerCamelCase ,_lowerCamelCase ) or not number >= 1: raise Value...
706
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 a_ = """src/transformers""" # This is to make sure the transformers module...
622
0
from graphs.minimum_spanning_tree_kruskal import kruskal def SCREAMING_SNAKE_CASE ( ) -> str: UpperCamelCase__ : Tuple = 9 UpperCamelCase__ : Optional[int] = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], ...
228
from typing import Dict, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import flip_channel_order, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ( ChannelDimension...
228
1
def _lowerCAmelCase ( A__: Any ): '''simple docstring''' if not isinstance(A__ , A__ ): UpperCAmelCase = F"""Input value of [number={number}] must be an integer""" raise TypeError(A__ ) if number < 0: return False UpperCAmelCase = ...
703
from math import factorial def _lowerCAmelCase ( A__: int , A__: int ): '''simple docstring''' if n < k or k < 0: raise ValueError('''Please enter positive integers for n and k where n >= k''' ) return factorial(A__ ) // (factorial(A__ ) * factorial(n - k...
391
0
from manim import * class __UpperCamelCase ( _lowerCAmelCase ): def _a ( self : str ) -> Tuple: """simple docstring""" __lowercase = Rectangle(height=0.5 , width=0.5 ) __lowercase = Rectangle(height=0.46 , width=0.46 ...
80
def snake_case ( lowerCamelCase = 2_000_000 ): '''simple docstring''' __lowercase = [0 for i in range(n + 1 )] __lowercase = 1 __lowercase = 1 for i in range(2 , int(n**0.5 ) + 1 ): if primality_list[i] == 0: for j in range(i * i ...
80
1
"""simple docstring""" def __snake_case ( SCREAMING_SNAKE_CASE: Any , SCREAMING_SNAKE_CASE: List[Any] , SCREAMING_SNAKE_CASE: Dict , SCREAMING_SNAKE_CASE: List[Any] ): """simple docstring""" if height >= 1: move_tower(hei...
491
"""simple docstring""" def __snake_case ( SCREAMING_SNAKE_CASE: int ): """simple docstring""" _lowerCAmelCase = generate_pascal_triangle(SCREAMING_SNAKE_CASE ) for row_idx in range(SCREAMING_SNAKE_CASE ): # Print left spaces ...
491
1