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
"""simple docstring""" import argparse import math import traceback import dateutil.parser as date_parser import requests def lowercase__ ( snake_case_ :Dict ): __UpperCAmelCase = {} __UpperCAmelCase = job['''started_at'''] __UpperCAmelCase ...
49
"""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_increase...
49
1
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 ( HfArgumentParser, Trainer, ...
711
from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor lowercase = transform...
607
0
"""simple docstring""" def _lowercase ( __lowerCAmelCase ) -> list[int]: if num <= 0: raise ValueError("""Input must be a positive integer""" ) SCREAMING_SNAKE_CASE__ : Any = [True] * (num + 1) SCREAMING_SNAKE_CASE__ : str = 2 ...
680
"""simple docstring""" import argparse from collections import OrderedDict from pathlib import Path import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision.transforms import functional as F from transformers import DetrImageProcessor, TableTransformerConfig, TableTransforme...
680
1
'''simple docstring''' import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import Tokeni...
704
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a__ : Dict = { 'configuration_electra': ['ELECTRA_PRETRAIN...
223
0
'''simple docstring''' import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate import ...
133
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 __magic_name__ : Optional[int] = logging.get_logger(__name__) def lowercase__ ( _UpperCamelCase) -> Dict: ""...
280
0
'''simple docstring''' from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable a_ : str = {"""configuration_dpt""": ["""DPT_PRETRAINED_CONFIG_ARCHI...
714
'''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 ImageProcessingSavingTes...
445
0
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.import_utils import is...
203
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 __lowercase = logging.get_logger(__name__) __lowercase ...
203
1
import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def __SCREAMING_SNAKE_CASE ( __U...
700
from math import log from scipy.constants import Boltzmann, physical_constants __lowerCamelCase : int = 300 # TEMPERATURE (unit = K) def __SCREAMING_SNAKE_CASE ( __UpperCamelCase : float , __UpperCamelCase : float , __UpperCamelCase : float , ) -...
379
0
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def _UpperCAmelCase ( a__ , a__ , a__ , a__=1_0_2_4): '''simple docstring''' a_ , a_ : Tuple = [], [] a_ : str = list(zip(a_...
540
import argparse import json import os import torch from transformers import LukeConfig, LukeModel, LukeTokenizer, RobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def _UpperCAmelCase ( a__ , a__ , a__ , a__ , a__): '''simple docstring''' with...
540
1
"""simple docstring""" def UpperCamelCase_ ( lowerCAmelCase__ : Tuple ) -> List[Any]: """simple docstring""" lowerCAmelCase_ : Dict = len(__A ) for i in range(1 , __A ): lowerCAmelCase_ : Union[str, Any] ...
701
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowercase__ : int = { """configuration_groupvit""": [ """GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", ...
317
0
'''simple docstring''' import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets UpperCAmelCase = datasets.logging.get_logger(__name__) UpperCAmelCase = '''\\n@InProceedings{moosavi2019minimum,\n...
119
'''simple docstring''' import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel a_ ...
296
0
"""simple docstring""" import argparse import os import re import numpy as np import PIL import torch from timm import create_model from torch.optim.lr_scheduler import OneCycleLR from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, RandomResizedCrop, Resize, ToTensor from ...
705
"""simple docstring""" import warnings from ..trainer import Trainer from ..utils import logging __SCREAMING_SNAKE_CASE : Dict = logging.get_logger(__name__) class lowerCamelCase_( A__ ): '''simple docstring''' def __init__( self , lowerCamelCase__...
623
0
'''simple docstring''' def A__ ( UpperCAmelCase_ ): if not nums: # Makes sure that the list is not empty raise ValueError('List is empty' ) _UpperCamelCase : List[str] = sum(UpperCAmelCase_ ) / len(UpperCAmelCase_ ) # Calculate the average return...
195
'''simple docstring''' import os from pathlib import Path def A__ ( ): from torch.utils.cpp_extension import load _UpperCamelCase : Optional[Any] = Path(UpperCAmelCase_ ).resolve().parent.parent.parent / 'kernels' / 'deformable_detr' _UpperCamelCase : Tupl...
195
1
'''simple docstring''' def __A ( _SCREAMING_SNAKE_CASE : str ): """simple docstring""" return credit_card_number.startswith(("34", "35", "37", "4", "5", "6") ) def __A ( _SCREAMING_SNAKE_CASE : str ): ...
702
'''simple docstring''' 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 ...
564
0
"""simple docstring""" from __future__ import annotations from sys import maxsize from typing import Generic, TypeVar SCREAMING_SNAKE_CASE__ : List[str] =TypeVar('T') def UpperCamelCase ( SCREAMING_SNAKE_CASE_ ) ->int: return (position - 1) // 2 def Upper...
434
"""simple docstring""" from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=a_ ) class _UpperCAmelCase ( a_ ): """simple docstring""" __snake_case = ...
434
1
'''simple docstring''' from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
449
'''simple docstring''' from __future__ import annotations A = '#' class __snake_case : def __init__( self ): """simple docstring""" lowerCamelCase : dict = {} def UpperCAmelCase_ ( self, A ): ...
449
1
'''simple docstring''' import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class __UpperCAmelCase ( __a , unittest.TestCase ): __A : List[Any] ...
274
'''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, PyTorchBenchmarkArgume...
274
1
'''simple docstring''' def __magic_name__ ( __UpperCAmelCase = 5000_0000 ) -> Any: '''simple docstring''' snake_case_ = set() snake_case_ = int((limit - 24) ** (1 / 2) ) snake_case_ = set(range(3, prime_square_limit + 1, 2 ) ) ...
707
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a : Optional[Any] = { 'configuration_autoformer': [ 'AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
593
0
def a_ ( __lowerCAmelCase ): if len(__lowerCAmelCase ) < 2: return collection def circle_sort_util(__lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ) -> bool: lowerCAmelCase__ = False if low == high: return swapped l...
615
"""simple docstring""" from dataclasses import dataclass, field from typing import Optional @dataclass class SCREAMING_SNAKE_CASE_ : """simple docstring""" __snake_case : Optional[str] = field( default="""codeparrot/codeparrot""" , metadata={"""help...
179
0
'''simple docstring''' import argparse import os import sys from unittest.mock import patch import pytorch_lightning as pl import timeout_decorator import torch from distillation import SummarizationDistiller, distill_main from finetune import SummarizationModule, main from transformers import MarianMTModel ...
301
'''simple docstring''' import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def __snake_case( ) -> Union[str, Any]: snake_case__ : Union[str, Any] = ArgumentParser( ...
301
1
"""simple docstring""" import collections import gzip import os import urllib import numpy from tensorflow.python.framework import dtypes, random_seed from tensorflow.python.platform import gfile from tensorflow.python.util.deprecation import deprecated __A = collections.namedtuple("""_Datas...
93
"""simple docstring""" from __future__ import annotations import math def __A (_SCREAMING_SNAKE_CASE ) ->bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even nu...
93
1
from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge A : Any = [ "Prosecutor: \"No videos were used in the crash investigation\" German papers say they saw a cell phone video of the" ...
356
from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge A : Any = [ "Prosecutor: \"No videos were used in the crash investigation\" German papers say they saw a cell phone video of the" ...
356
1
"""simple docstring""" from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def lowercase ( lowerCAmelCase__ ,lowerCAmelCase__ ,lowerCAmelCase__ ,lowerCAmelCase__ ,lowerCAmelCase__ ): lowerCamelCase_ = cva.getAffineTransform(lowerCAmelCase__ ,lowerCAme...
29
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _A = { '''configuration_falcon''': ['''FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FalconConfig'''], } try: if not is_torch_available(): raise Op...
431
0
"""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_distilbert import DistilBertTokenizer __UpperCAmelCase : Tuple ...
720
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCase = { 'microsoft/wavlm-base': 'https://huggingface.co/microsoft/w...
256
0
'''simple docstring''' import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def __lowerCamelCase ( _UpperCamelCase : List[Any] ): '''simple docstring''' UpperCAme...
390
'''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 ( AutoConfig, AutoMo...
390
1
"""simple docstring""" import os lowercase = {'''I''': 1, '''V''': 5, '''X''': 10, '''L''': 50, '''C''': 100, '''D''': 500, '''M''': 1000} def _lowerCAmelCase ( __lowerCamelCase:str ): '''simple docstring''' __magic_name__ = 0 ...
468
"""simple docstring""" import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, ...
468
1
from datetime import datetime import matplotlib.pyplot as plt import torch def _lowerCamelCase ( snake_case ): for param in module.parameters(): _lowerCAmelCase = False def _lowerCamelCase ( ): _lowerCAmelCase = 'cuda' if torch.cuda.is_available() el...
192
def _lowerCamelCase ( snake_case ): assert ( isinstance(snake_case , snake_case ) and number_of_steps > 0 ), F'number_of_steps needs to be positive integer, your input {number_of_steps}' if number_of_steps == 1: return 1 _lowerCAmelCase , _lowerCAmelCase ...
192
1
from __future__ import annotations def A(__a: list , __a: int ): # Checks if the entire collection has been sorted if len(__a ) <= 1 or n <= 1: return insert_next(__a , n - 1 ) rec_insertion_sort(__a , n - 1 ) def A(__a: list , __a: int ): #...
226
from __future__ import annotations from functools import lru_cache from math import ceil lowerCamelCase__ = 1_00 lowerCamelCase__ = set(range(3, NUM_PRIMES, 2)) primes.add(2) lowerCamelCase__ = 42 for prime in range(3, ceil(NUM_PRIMES**0.5), 2): if prime not in primes: ...
226
1
from __future__ import annotations def UpperCAmelCase ( UpperCAmelCase )-> bool: '''simple docstring''' return len(set(snake_case_ ) ) == len(snake_case_ ) if __name__ == "__main__": import doctest doctest.testmod()
393
'''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...
427
0
'''simple docstring''' from PIL import Image def __A ( a_ : Image ): lowerCAmelCase , lowerCAmelCase : List[Any] = image.size lowerCAmelCase : str = 0 lowerCAmelCase : Dict = image.load() for i in range(a_ ): for j in range(a...
551
'''simple docstring''' def __A ( a_ : int ): assert ( isinstance(a_ ,a_ ) and number_of_steps > 0 ), f'''number_of_steps needs to be positive integer, your input {number_of_steps}''' if number_of_steps == 1: return 1 lowerCAmelCase , lowerCAmelCase : int ...
551
1
from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record SCREAMING_SNAKE_CASE = '\\n@article{wang2019superglue,\n title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding Systems},\n au...
485
from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE = logging.get_logger(__name__) SCREAMING_SNAKE_CASE = { 'google/switch-base-8': 'https://huggingface.co/google/switch-base-8/blob/main/config.json', } class A_ ( ...
485
1
import unittest import numpy as np import torch from diffusers import DDIMPipeline, DDIMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, slow, torch_device from ..pipeline_params import UNCONDITIONAL_IMAGE_GENERATION_BATCH_PARAMS, UNCONDITIONAL_IMAGE...
707
from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand UpperCAmelCase_ : Optional[Any] = logging.get_logger(__name__) # pylint: disable=invalid-name def ...
590
0
'''simple docstring''' 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(): f...
531
'''simple docstring''' # Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position lowerCAmelCase_ = '''2.13.1''' import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < ...
531
1
"""simple docstring""" import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase_ : Tuple = logging.get_logger(__name__) lo...
302
"""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_verbosity_info() lowerCa...
302
1
"""simple docstring""" import unittest from transformers import MobileBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common im...
361
from .constants import ( MODEL_NAME, OPTIMIZER_NAME, RNG_STATE_NAME, SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, SCALER_NAME, SCHEDULER_NAME, TORCH_LAUNCH_PARAMS, WEIGHTS_INDEX_NAME, WEIGHTS_NAME, ) from .dataclasses import ( BnbQuantizationConfig, ComputeEnvironment...
332
0
"""simple docstring""" import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Voca...
709
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCamelCase = { """configuration_wav2vec2""": ["""WAV_2_V...
562
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCAmelCase : Optional[Any] =logging.get_logger(__name__) _lowerCAmelCase : Optional[Any] ...
113
import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as sp from digital_image_process...
333
0
def A_ ( snake_case : int , snake_case : int ) -> int: '''simple docstring''' __UpperCamelCase = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): __UpperCamelCase = n - k # Calculate C(n,k) ...
451
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformer...
451
1
'''simple docstring''' from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class A : lowercase_ = 42 lowercase_ = 42 class A ...
22
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCamelCase = logging.get_logger(__name__) _UpperCamelCase = {"vocab_file": "se...
363
0
import collections import inspect import unittest from transformers import FocalNetConfig 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 ...
57
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, ...
57
1
import multiprocessing from typing import TYPE_CHECKING, Optional, Union from .. import Dataset, Features, config from ..formatting import query_table from ..packaged_modules.sql.sql import Sql from ..utils import logging from .abc import AbstractDatasetInputStream if TYPE_CHECKING: import sqlitea impor...
362
"""simple docstring""" from __future__ import annotations from random import choice def __A ( a_ :Tuple) -> List[str]: return choice(a_) def __A ( a_ :list[int] , a_ :int) -> int: __a : Optional[int] = random_pivot(a...
52
0
import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils impo...
456
def __lowerCAmelCase ( __lowerCamelCase : int = 3 , __lowerCamelCase : int = 7 , __lowerCamelCase : int = 1000000 ) -> int: __lowerCAmelCase =0 __lowerCAmelCase =1 for current_denominator in range(1 , limit + 1 ): __lowerCAmelCase =current_deno...
456
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE_ = { '''configuration_blip_2''': [ '''BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Blip2Config''', '''Blip2QFor...
426
import unittest from knapsack import greedy_knapsack as kp class _A ( unittest.TestCase ): def __a ( self : List[Any] ) -> Optional[int]: """simple docstring""" lowercase : Dict = [10, 20, 30, 40, ...
217
0
import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( BarkCoarseConfig, ...
711
from typing import Dict, Optional import numpy as np import datasets __snake_case : str = """ IoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union between the predicted segmentation and the ground truth. For binary (two classes) or ...
365
0
from . import ( albert, align, altclip, audio_spectrogram_transformer, auto, autoformer, bark, bart, barthez, bartpho, beit, bert, bert_generation, bert_japanese, bertweet, big_bird, bigbird_pegasus, biogpt, bit, b...
101
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_channel_d...
23
0
'''simple docstring''' import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def _SCREAMING_SNAKE_CASE ( A : str , A : str , **A : Optional[Any] ) -> Union[str, Any]: """simple docstring""" ...
61
'''simple docstring''' import math class a_ : def __init__(self , __a=0) -> Any: # a graph with Node 0,1,...,N-1 """simple docstring""" __snake_case : List[str] = n __snake_case : Tuple ...
61
1
'''simple docstring''' from __future__ import annotations def lowerCAmelCase_ ( snake_case_ : float , snake_case_ : float , snake_case_ : float , ) -> tuple: '''simple docstring''' if (electron_conc, hole_conc, intrinsic_conc).count...
78
'''simple docstring''' from typing import Any class _a : def __init__( self ,_SCREAMING_SNAKE_CASE ) -> List[str]: _snake_case = data _snake_case = None class _a : def __init__( self ) -> List[Any]: ...
185
0
'''simple docstring''' import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup a__ : List[Any] = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' ' (KHTML, like Gecko) Chrome/70.0.3538.102 ...
702
'''simple docstring''' import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging a__ : Optional[int] = logging.get_logger(__name__) a__ : Union[str, Any] = {'vocab_fi...
570
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a_ :str = { 'configuration_bigbird_pegasus': [ 'BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BigBirdPegasusConfig', 'BigBirdPegasusOnnxConfig', ], } ...
35
def _a ( a :list ) -> list: if len(a ) < 2: return collection def circle_sort_util(a :list , a :int , a :int ) -> bool: a = False if low == high: return swapped a = low a = high while ...
117
0
"""simple docstring""" import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def __lowercase ( a : List[str] , a : str , a : str , a : Path , a : str = ...
705
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase_ : Optional[Any] = logging.get_logger(__n...
497
0
"""simple docstring""" from math import factorial def lowercase__ ( lowercase_ ,lowercase_ ) -> int: """simple docstring""" if n < k or k < 0: raise ValueError("Please enter positive integers for n and k where n >= k" ) return factorial(l...
624
"""simple docstring""" import numpy as np def lowercase__ ( lowercase_ ,lowercase_ ,lowercase_ = 1e-12 ,lowercase_ = 100 ,) -> tuple[float, np.ndarray]: """simple docstring""" assert np.shape(lowercase_ )[0] == np.shape(lowercase_ )[1] # Ensure pr...
624
1
'''simple docstring''' import os import re from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging A__ : List[str] = logging.get_logger(__nam...
719
'''simple docstring''' import re import time from typing import Optional import IPython.display as disp from ..trainer_callback import TrainerCallback from ..trainer_utils import IntervalStrategy, has_length def a_ ( _UpperCAmelCase : int ) -> Optional[Any]: __snak...
124
0
"""simple docstring""" from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_torch...
567
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary # Register SEW's fairseq modules from sew_asapp import tasks # noqa: F401 from transformers import ( SEWConfig, SEWForCTC, SEWModel, WavaVecaCTCTokeniz...
567
1
'''simple docstring''' from PIL import Image def _UpperCamelCase ( lowerCAmelCase__: Image ) -> Image: SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ = image.size SCREAMING_SNAKE_CASE_ = 0 SCREAMING_SNAKE_CASE_ ...
708
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE : str = { "configuration_pegasus_x": ["PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP", "PegasusXConfig"], } try: if...
238
0
'''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, SwinConfig from transfor...
78
from dataclasses import dataclass from typing import Optional, Tuple import torch from torch import nn from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel from transformers.utils import ModelOutput @dataclass class __SCREAMING_SNAKE_CASE ( _a ): snake_ca...
619
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from diffusers import ( DDIMScheduler, KandinskyVaaControlnetPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_nump...
720
def __SCREAMING_SNAKE_CASE ( UpperCamelCase : list[int] , UpperCamelCase : list[int] ) -> tuple[float, float]: """simple docstring""" if not len(UpperCamelCase ) == len(UpperCamelCase ) == 3: raise ValueError("""Please enter a valid equation.""" ) if equationa[0] == equationa[1] ...
403
0
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 .tokenizati...
313
'''simple docstring''' from __future__ import annotations def a ( UpperCamelCase_ : str , UpperCamelCase_ : list[str] | None = None , UpperCamelCase_ : dict[str, float] | None = None , UpperCamelCase_ : bool = False , ) -> tuple[int, ...
538
0
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class lowerCAmelCase_ (unit...
705
"""simple docstring""" import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow UpperCAmelCase__ : Any = logging.getLogger() ...
545
0
"""simple docstring""" import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLICommand if no...
646
'''simple docstring''' # A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs t...
296
0
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 __lowerCAmelCase ( __SCREAMING_SNAKE_CASE ): '''simp...
703
'''simple docstring''' import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data ...
27
0
"""simple docstring""" import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_model...
142
"""simple docstring""" import os def lowerCamelCase_ ( ): lowerCamelCase_ = os.path.dirname(os.path.realpath(_lowerCamelCase ) ) lowerCamelCase_ = os.path.join(_lowerCamelCase , '''triangle.txt''' ) with open(_lowerCamelCase ) as f: ...
142
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/licenses...
179
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_e...
179
1
import multiprocessing import os from typing import BinaryIO, Optional, Union import fsspec from .. import Dataset, Features, NamedSplit, config from ..formatting import query_table from ..packaged_modules.json.json import Json from ..utils import logging from ..utils.typing import NestedDataStructureLike, Pat...
0
'''simple docstring''' from torch import nn def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU() else: raise Value...
672
0
import math def A_ ( __a : Tuple , __a : List[Any] ): """simple docstring""" if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * math.logaa(__a ) else: if x == 0: # 0 raised to any number is 0 ...
351
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 .tokenization_al...
351
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_feature_extracti...
11
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import is_flaky, require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is...
366
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __magic_name__ : Dict = logging.get_logger(__name__) __magic_name__ : List[str] ...
410
__magic_name__ : List[str] = tuple[float, float, float] __magic_name__ : Optional[int] = tuple[float, float, float] def lowercase__ ( _UpperCamelCase , _UpperCamelCase) -> Vectorad: """simple docstring""" UpperCamelC...
410
1
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration a_ : str = 5_0_0_0_0_0 a_ , a_ : Any = os.path.split(__file__) a_ : Dict = os.path.join(RESULTS_BASEPATH, 'results', RESULTS...
623
def __lowercase( UpperCAmelCase__ ): """simple docstring""" if n == 1 or not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): return 0 elif n == 2: return 1 else: lowerCamelCase = [0, 1] for i i...
623
1
'''simple docstring''' import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io ...
708
'''simple docstring''' import math def UpperCAmelCase ( lowerCamelCase_ :list , lowerCamelCase_ :int ): '''simple docstring''' snake_case_ : Union[str, Any] = len(lowerCamelCase_ ) snake_case_ : List[Any] = int(math.floor(math.sqr...
267
0
"""simple docstring""" import warnings warnings.warn( """memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: """ """`from accelerate import find_executable_batch_size` to avoid this warning.""", FutureWarning, ) ...
82
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def snake_case_ ( SCREAMING_SNAKE_CASE__ , S...
672
0
import importlib.metadata import warnings from copy import deepcopy from packaging import version from ..utils import logging from .import_utils import is_accelerate_available, is_bitsandbytes_available if is_bitsandbytes_available(): import bitsandbytes as bnb import torch import torch.nn as nn from ..py...
704
'''simple docstring''' from __future__ import annotations import time import numpy as np __lowerCAmelCase = [8, 5, 9, 7] __lowerCAmelCase = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] __lowerCAmelCase = [ [3, 2, 1, 4], ...
319
0
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast from ...utils import logging if TYPE_CHECKING: from ...feature_extraction_utils import FeatureExtraction...
343
class __A : def __init__( self : Dict , UpperCAmelCase_ : Any , UpperCAmelCase_ : int ): lowerCAmelCase : Optional[Any] = name lowerCAmelCase : int = val def __str__( self :...
343
1
import os def a_ (_lowerCAmelCase : Any )-> Union[str, Any]: snake_case: Tuple = len(grid[0] ) snake_case: Optional[int] = len(_lowerCAmelCase ) snake_case: Optional[Any] = 0 snake_case: List[Any] = 0 snake_...
164
import collections import os import re from pathlib import Path __lowerCAmelCase : Tuple = 'src/transformers' # Matches is_xxx_available() __lowerCAmelCase : Union[str, Any] = re.compile(R'is\_([a-z_]*)_available()') # Catches a one-line _import_struct = {xxx} __lowerCAmelCase ...
164
1
import argparse import json from collections import OrderedDict from functools import partial from pathlib import Path import timm import torch from huggingface_hub import hf_hub_download from transformers import LevitConfig, LevitForImageClassificationWithTeacher, LevitImageProcessor from transformers.utils import ...
74
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_mo...
623
0
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_ = logging.get_logger(__name__) lowerCAmelCase_ = { 'goo...
596
import contextlib from multiprocessing import Pool, RLock from tqdm.auto import tqdm from ..utils import experimental, logging lowerCAmelCase_ = logging.get_logger(__name__) class _A : _UpperCamelCase : Dict = None @experimental def snake_case( ...
596
1
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, P...
21
from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common i...
311
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase ={ "configuration_convbert": ["CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "ConvBertConfig", "ConvBertOnnxConf...
462
lowerCamelCase ={"a": ["c", "b"], "b": ["d", "e"], "c": [], "d": [], "e": []} lowerCamelCase =["a", "b", "c", "d", "e"] def SCREAMING_SNAKE_CASE_ ( UpperCamelCase__ , UpperCamelCase__ , UpperCamelCase__ ): UpperCamelCase__ : str = start # add current to visited ...
462
1
'''simple docstring''' import socket def __lowercase () -> str: """simple docstring""" __lowerCamelCase : Optional[Any] = socket.socket(socket.AF_INET, socket.SOCK_STREAM ) __lowerCamelCase : Optional[int] = socket.gethostname() __lowerCamelCas...
150
'''simple docstring''' import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def __lowercase (_lowercase, _lowercase, _lowercase, _lowercase, _lowercase = None, _lowercase = None, _lowercase...
150
1
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, ...
369
import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensorflow as tf from...
369
1
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 TokenizerTesterMixin class a (_SCREAM...
81
lowercase : Dict = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_00_00)] def snake_case__ ( lowerCamelCase_ ): A : List[str] = 0 while number: # Increased Speed Slightly by checking every 5 digits together. ...
542
0
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 ModelTesterMixin, ids_tensor, random_attention_mask from...
682
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class UpperCAmelCase__ : """simple docstring""" def __init__( self , A_ = None ) -> None: if components is None: __U...
682
1
'''simple docstring''' import logging import math from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union import torch from .tensor_utils import tensor_tree_map, tree_map def lowerCAmelCase_ ( snake_case_ : Union[dict, list, ...
78
import argparse import json from typing import List from ltp import LTP from transformers import BertTokenizer def lowerCamelCase ( SCREAMING_SNAKE_CASE ): '''simple docstring''' if ( (cp >= 0X4_e_0_0 and cp <= 0X9_f_f_f) or (cp >= 0X3_4_0_0 and cp <= 0X4_d_b_f) # o...
167
0
"""simple docstring""" import mpmath # for roots of unity import numpy as np class __snake_case : def __init__( self : Dict , __lowerCAmelCase : Optional[int]=None , __lowerCAmelCase : Dict=None ): """simple docstring""" _lowerCamelCase : ...
598
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''google/canine-s''': '''https://huggingface.co/google/canine-s/resolve/main/config.json''', # ...
598
1
def UpperCamelCase ( snake_case__ : float , snake_case__ : list[float] ) -> float: if discount_rate < 0: raise ValueError('Discount rate cannot be negative' ) if not cash_flows: raise ValueError('Cash flows list cannot be empty' ) UpperCamelCase...
40
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, torch_device from diffusers.util...
540
0
from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def UpperCAmelCase__ ( _A = True , *_A , **_A ): """simple docstring""" if not is_tqdm_available(): ra...
143
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCamelCase__ = '''▁''' UpperCamelCase__ = {'''vocab_file''': '''...
143
1
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel _lowerCamelCase : List[Any] = { '''text_branch''': '''text_model''', '''audio_branch''': '''audio_model.audio_encoder''', '''attn''': '''...
403
class lowercase : # Public class to implement a graph def __init__( self : Union[str, Any] , _UpperCamelCase : int , _UpperCamelCase : int , _UpperCamelCase : list[list[bool]] ) -> None: '''simple docstring''' ...
403
1
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast _snake_case = datasets.utils.logging.get_logger(__name__) @dataclass class lowercase ( datas...
705
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.import_ut...
54
0
"""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/licenses/LICENSE-2.0 ...
506
"""simple docstring""" import qiskit def lowerCamelCase_ (UpperCamelCase__ : int , UpperCamelCase__ : int ): _UpperCAmelCase : Any = qiskit.Aer.get_backend('''aer_simulator''' ) # Create a Quantum Circuit acting on the q register _UpperCAmelC...
506
1
from __future__ import annotations def __lowercase ( _UpperCAmelCase ) -> bool: '''simple docstring''' __lowercase = len(_UpperCAmelCase ) # We need to create solution object to save path. __lowercase = [[0 for _ in range(_UpperCAmelCase )] for _ in range(_UpperCAmelCase )] ...
576
from __future__ import annotations def __lowercase ( _UpperCAmelCase , _UpperCAmelCase ) -> Union[str, Any]: '''simple docstring''' print(f'''Vertex\tShortest Distance from vertex {src}''' ) for i, d in enumerate(_UpperCAmelCase ): print(f'''{i}\t\t{d}''' ) def __lowercase ...
576
1
"""simple docstring""" from math import pi def lowerCAmelCase__ ( __magic_name__ , __magic_name__ ) ->float: return 2 * pi * radius * (angle / 3_6_0) if __name__ == "__main__": print(arc_length(90, 10))
118
"""simple docstring""" import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup _lowercase = { '''User-Agent''': '''Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36''' ''' (KHTML, like Gecko) Chrome/70.0.3538....
118
1
from __future__ import annotations from typing import Any class UpperCamelCase__ : def __init__(self : Any , snake_case_ : int = 6 ): __a : Node | None = None __a : Node | None = None self.create_linked_list(snake_case_ ...
326
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import ...
326
1
class lowerCamelCase: '''simple docstring''' def __init__( self , snake_case_ ): _A = len(snake_case_ ) _A = [0] * len_array if len_array > 0: _A = array[0] for i in range(1 ...
27
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> bool: """simple docstring""" _A = int(number**0.5 ) return number == sq * sq ...
27
1
"""simple docstring""" from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class a_ : UpperCamelCase_ : Tuple = 42 UpperCamelCase_ : Union[str, Any] = None Uppe...
721
"""simple docstring""" def _UpperCAmelCase ( lowerCamelCase__ ): """simple docstring""" assert isinstance(lowerCamelCase__ , lowerCamelCase__ ), f"""The input value of [n={number}] is not an integer""" if number == 1: return 2 elif number < 1: lowerCAmelCase__ ...
674
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { 'naver-clova-ix/donut-base': 'https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json', # Se...
384
'''simple docstring''' from __future__ import annotations import math def UpperCAmelCase ( lowerCamelCase_ :int ): '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even...
334
0
"""simple docstring""" from __future__ import annotations def SCREAMING_SNAKE_CASE ( __UpperCAmelCase , __UpperCAmelCase ) -> list[str]: if partitions <= 0: raise ValueError("partitions must be a positive number!" ) if partitions > number_of_b...
538
"""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...
538
1
'''simple docstring''' def __UpperCAmelCase ( __magic_name__ )-> str: """simple docstring""" return " ".join( "".join(word[::-1] ) if len(SCREAMING_SNAKE_CASE_ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": ...
653
"""simple docstring""" from manim import * class lowerCAmelCase ( lowerCamelCase_ ): '''simple docstring''' def __A ( self ) -> Union[str, Any]: SCREAMING_SNAKE_CASE = Rectangle(height=0.5 , width=0.5 ) SCRE...
247
0
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import IMAGENE...
568
'''simple docstring''' import os import sys snake_case = os.path.join(os.path.dirname(__file__), """src""") sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSequen...
568
1
'''simple docstring''' import json import logging import math import os import sys from dataclasses import dataclass, field from typing import Optional from datasets import Dataset, load_dataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_FOR_MASKED_LM_MAPPING, AutoConfig,...
186
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil UpperCAmelCase__ : Optional[Any] = 1_00 UpperCAmelCase__ : Any = set(range(3, NUM_PRIMES, 2)) primes.add(2) UpperCAmelCase__ : int for prime in range(3, ceil(NUM_PRIMES**0.5)...
48
0
"""simple docstring""" 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 A_ ...
468
"""simple docstring""" def _lowerCAmelCase ( __lowerCamelCase:int ): '''simple docstring''' if number < 0: raise ValueError("number must not be negative" ) return number & (number - 1) == 0 if __name__ == "__main__": import doctest doc...
468
1
'''simple docstring''' def UpperCamelCase__ ( __SCREAMING_SNAKE_CASE ) -> str: snake_case__ : Any = [0] * len(A_ ) snake_case__ : Union[str, Any] = [] snake_case__ : List[str] = [1] * len(A_ ) for values in graph.valu...
270
from typing import TYPE_CHECKING from ...utils import _LazyModule a_ = {"""tokenization_bertweet""": ["""BertweetTokenizer"""]} if TYPE_CHECKING: from .tokenization_bertweet import BertweetTokenizer else: import sys a_ = _LazyModule(__name__, globals()["""__file__"""], _i...
221
0
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Accelerator, Di...
711
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 _A = logging.getLogger(__name__) @dataclass ...
682
0