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 |
|---|---|---|---|---|
import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import Audio, Features, Value
from .base import TaskTemplate
@dataclass(frozen=__A )
class snake_case__ ( __A ):
UpperCAmelCase : str = field(default="""automatic-speech-recog... | 419 |
from itertools import permutations
def _lowerCamelCase ( SCREAMING_SNAKE_CASE_ : tuple ):
"""simple docstring"""
if num[3] % 2 != 0:
return False
if (num[2] + num[3] + num[4]) % 3 != 0:
return False
if num[5] % 5 != 0:
... | 419 | 1 |
def lowerCamelCase__ ( a : int , a : int ) -> Any:
"""simple docstring"""
a__ :Optional[int] = (boundary[1] - boundary[0]) / steps
a__ :str = boundary[0]
a__ :Optional[int] = boundary[1]
a__ :str = make_points(a , a , a )
a__ :An... | 700 |
from collections import OrderedDict
from typing import Mapping
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
snake_case__ = {
'''albert-base-v1''': '''https://huggingface.co/albert-base-v1/resolve/main/config.json''',
'''albert-large-v1''': '''https://huggingfa... | 373 | 0 |
from math import factorial
def a ( snake_case__: int = 20 ):
'''simple docstring'''
lowercase_ = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1,
# 2, 3,...
lowercase_ = n // 2
return int(factorial(snake_case__ ) / (fac... | 97 |
def a ( snake_case__: int ):
'''simple docstring'''
if not isinstance(snake_case__ , snake_case__ ):
raise ValueError('''Input must be an integer''' )
if input_num <= 0:
raise ValueError('''Input must be positive''' )
return sum(
divisor for di... | 97 | 1 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
UpperCAmelCase_ = logging.get_logger(__name__)
UpperCAmelCase_ = {
# See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert
}
class lowercase__ ( __low... | 369 |
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
logging.set_verbosity... | 369 | 1 |
import numpy as np
from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey
def a (lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ ):
# prepare kernel
# the kernel size have to ... | 99 |
import importlib
import json
import os
from collections import OrderedDict
from typing import Dict, Optional, Union
# Build the list of all feature extractors
from ...configuration_utils import PretrainedConfig
from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remot... | 406 | 0 |
def __UpperCAmelCase ( __A ) -> int:
'''simple docstring'''
if a < 0:
raise ValueError("Input value must be a positive integer" )
elif isinstance(__A , __A ):
raise TypeError("Input value must be a 'int' type" )
... | 277 |
import os
import unittest
from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer
from transformers.testing_utils import get_tests_dir
from ...test_tokenization_common import TokenizerTesterMixin
A = get_tests_dir("fixtures/test_sentencepiece_bpe.model")
... | 277 | 1 |
"""simple docstring"""
from datetime import datetime
import matplotlib.pyplot as plt
import torch
def _snake_case ( _snake_case : Dict ) -> Optional[Any]:
'''simple docstring'''
for param in module.parameters():
_A = False
def _snake_case ( ... | 7 |
from __future__ import annotations
import copy
import inspect
import json
import math
import os
import tempfile
import unittest
from importlib import import_module
import numpy as np
from transformers import ViTMAEConfig
from transformers.file_utils import cached_property, is_tf_available, is_vis... | 43 | 0 |
"""simple docstring"""
import unittest
from transformers import is_flax_available
from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow
if is_flax_available():
import optax
from flax.training.common_utils import onehot
from transformers impor... | 112 |
"""simple docstring"""
import json
import os
import tempfile
import transformers
import datasets
from utils import generate_example_dataset, get_duration
_lowerCamelCase = 500000
_lowerCamelCase , _lowerCamelCase = os.path.split(__file__)
_lowerCamelCase = os.path.join(RESULTS_BASEP... | 112 | 1 |
from ...utils import (
OptionalDependencyNotAvailable,
is_torch_available,
is_transformers_available,
is_transformers_version,
)
try:
if not (is_transformers_available() and is_torch_available()):
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
from ...... | 35 |
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"""
class lowerCamelCase__ :
def __init__( self ,A ):
# we need a list not a string, so do something to change the type
UpperCAmelCase = arr.split(""",""" )
def _UpperCamelCase ( self ):
... | 74 |
"""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
from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common imp... | 74 | 1 |
from math import ceil, sqrt
def __UpperCAmelCase ( a_ = 1_00_00_00):
snake_case_ = 0
for outer_width in range(3 , (limit // 4) + 2):
if outer_width**2 > limit:
snake_case_ = max(ceil(sqrt(outer_width**2 - limit)) , 1)
... | 198 |
from __future__ import annotations
import sys
from collections import deque
from typing import Generic, TypeVar
lowercase = TypeVar("T")
class UpperCamelCase_ ( Generic[T] ):
'''simple docstring'''
lowerCAmelCase = 42 # Cache store of keys
lowerCAmelCase = ... | 198 | 1 |
import os
import time
from dataclasses import dataclass, field
from enum import Enum
from typing import Dict, List, Optional, Union
import torch
from filelock import FileLock
from torch.utils.data import Dataset
from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING
from ... | 717 |
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 A_ ( unittest.TestCase ):
... | 535 | 0 |
'''simple docstring'''
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, ... | 634 |
'''simple docstring'''
import gc
import importlib.metadata
import tempfile
import unittest
from packaging import version
from transformers import (
AutoModel,
AutoModelForCausalLM,
AutoModelForSeqaSeqLM,
AutoModelForSequenceClassification,
AutoTokenizer,
BitsAndBytesCon... | 634 | 1 |
"""simple docstring"""
from __future__ import annotations
import math
class UpperCamelCase :
"""simple docstring"""
def __init__( self ,UpperCAmelCase_ ):
_lowercase : Union[str, Any] = size
# approximate the overall size of segment tree with given ... | 703 |
"""simple docstring"""
def __SCREAMING_SNAKE_CASE ( __UpperCAmelCase = 1000000 ):
_lowercase : Tuple = 1
_lowercase : Optional[int] = 1
_lowercase : Tuple = {1: 1}
for inputa in range(2 , __UpperCAmelCase ):
_lowercase ... | 600 | 0 |
import logging
from dataclasses import dataclass, field
from typing import Optional
from seqaseq_trainer import arg_to_scheduler
from transformers import TrainingArguments
SCREAMING_SNAKE_CASE : Union[str, Any] = logging.getLogger(__name__)
@dataclass
class _lowerCamelCase( _a ):
lower... | 89 |
'''simple docstring'''
class _UpperCamelCase :
'''simple docstring'''
def __init__( self , _a ):
"""simple docstring"""
# we need a list not a string, so do something to change the type
a__ = arr.split(',' )
... | 394 | 0 |
import collections
import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging
a_ = logging.get_logger(__name__)
a_ = "▁"
a_ = {"vocab_file": "prophetnet.tokenizer"}
a_ ... | 375 |
from __future__ import annotations
import queue
class _lowerCamelCase :
"""simple docstring"""
def __init__( self : Any , snake_case : Tuple ):
__UpperCamelCase = data
__UpperCamelCase = None
__UpperCamelCase = None
... | 375 | 1 |
import os
_lowercase = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 1_00, "D": 5_00, "M": 10_00}
def _A (UpperCamelCase : str ) ->int:
'''simple docstring'''
lowerCamelCase__ : Tuple = 0
lowerCamelCase__ : Union[str, Any] = 0
while index < len(... | 157 |
import argparse
import os
import torch
from diffusers import (
CMStochasticIterativeScheduler,
ConsistencyModelPipeline,
UNetaDModel,
)
SCREAMING_SNAKE_CASE__ : Any = {
"sample_size": 32,
"in_channels": 3,
"out_channels": 3,
"layers_per_block": 2,
"num_class_embeds"... | 298 | 0 |
from __future__ import annotations
def a ( lowerCamelCase_ , lowerCamelCase_ ):
'''simple docstring'''
if partitions <= 0:
raise ValueError('''partitions must be a positive number!''' )
if partitions > number_of_bytes:
raise ValueError('''partitio... | 671 |
import argparse
import re
from typing import Dict
import torch
from datasets import Audio, Dataset, load_dataset, load_metric
from transformers import AutoFeatureExtractor, pipeline
def a ( lowerCamelCase_ , lowerCamelCase_ ):
'''simple docstring'''
lowercase__ =... | 671 | 1 |
import argparse
import requests
import torch
from PIL import Image
from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel
def __snake_case ( __UpperCamelCase : Optional[int] ):
"""simple docstring"""
if "img_encoder.pos_embed" in name:
A_ ... | 86 |
import copy
import random
from transformers import CLIPTokenizer
class A__ ( __SCREAMING_SNAKE_CASE):
def __init__( self , *__magic_name__ , **__magic_name__ ):
super().__init__(*__magic_name__ , **__magic_name__ )
lowerCamelCase : Dict ... | 681 | 0 |
"""simple docstring"""
import sys
import webbrowser
import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent
if __name__ == "__main__":
print("""Googling.....""")
A = """https://www.google.com/search?q=""" + """ """.join(sys.argv[1:])
A = requests.get... | 707 |
"""simple docstring"""
from collections import OrderedDict
from typing import Mapping
from packaging import version
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ..auto import CONFIG_MAPPING
A = logging.get_logger(__name__)
A ... | 487 | 0 |
import json
import os
import re
import shutil
import tempfile
import unittest
from typing import Tuple
from transformers import AddedToken, BatchEncoding, ByTaTokenizer
from transformers.utils import cached_property, is_tf_available, is_torch_available
from ...test_tokenization_common import TokenizerTesterMixin
... | 647 |
def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int]):
'''simple docstring'''
lowerCAmelCase__ : int = (boundary[1] - boundary[0]) / steps
lowerCAmelCase__ : Optional[int] = boundary[0]
lowerCAmelCase__ : ... | 647 | 1 |
'''simple docstring'''
from typing import Any, Dict, List, Union
from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends
from .base import PIPELINE_INIT_ARGS, ChunkPipeline
if is_vision_available():
from PIL import Image
from ..image_utils import... | 555 |
'''simple docstring'''
from __future__ import annotations
def A ( A_ : list[int] , A_ : int ):
snake_case : list[list[int]] = []
snake_case : list[int] = []
snake_case : int = 0
snake_case : int... | 555 | 1 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
lowerCAmelCase_ = {'''configuration_vit_msn''': ['''VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMSNConfig''']}
try:
if not is_torch_available():
raise Op... | 39 | """simple docstring"""
SCREAMING_SNAKE_CASE__ : Dict =[
999,
800,
799,
600,
599,
500,
400,
399,
377,
355,
333,
311,
288,
266,
244,
222,
200,
199,
177,
155,
133,
111,
88,
66,
44,
... | 434 | 0 |
'''simple docstring'''
import os
from dataclasses import dataclass, field
from io import BytesIO
from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union
import numpy as np
import pyarrow as pa
from .. import config
from ..download.streaming_download_manager import xopen, xsplitext
from ..table ... | 570 |
'''simple docstring'''
import warnings
from ...utils import logging
from .image_processing_layoutlmva import LayoutLMvaImageProcessor
a__ : Optional[Any] = logging.get_logger(__name__)
class lowerCAmelCase__ ( UpperCAmelCase_ ):
'''simple docstring'''
def __in... | 570 | 1 |
from typing import Callable, List, Optional, Union
import PIL
import torch
from transformers import (
CLIPImageProcessor,
CLIPSegForImageSegmentation,
CLIPSegProcessor,
CLIPTextModel,
CLIPTokenizer,
)
from diffusers import DiffusionPipeline
from diffusers.configuration_utils import FrozenDic... | 504 |
from collections import defaultdict
class __magic_name__ :
"""simple docstring"""
def __init__( self :int , snake_case :Dict , snake_case :Optional[Any] ):
'''simple docstring'''
A_ : Optional[int] = total... | 454 | 0 |
import argparse
import os
import torch
from transformers.utils import WEIGHTS_NAME
__a : List[str] = ['''small''', '''medium''', '''large''']
__a : Optional[Any] = '''lm_head.decoder.weight'''
__a : Union[str, Any] = '''lm_head.weight'''
def snake_cas... | 298 |
import unittest
from knapsack import knapsack as k
class UpperCAmelCase( unittest.TestCase ):
"""simple docstring"""
def __a ( self ) -> Union[str, Any]:
"""simple docstring"""
lowercase__ : Optional[Any] ... | 298 | 1 |
import numpy as np
def UpperCAmelCase__( __UpperCAmelCase : np.ndarray ):
return 1 / (1 + np.exp(-vector ))
def UpperCAmelCase__( __UpperCAmelCase : np.ndarray ):
return vector * sigmoid(__UpperCAmelCase )
if __name__ == "__main__":
import d... | 576 | from collections import OrderedDict
from typing import Mapping
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
__magic_name__ = logging.get_logger(__name__)
__magic_name__ = {
'''facebook/xmod-base''': '''https://hug... | 576 | 1 |
import os
def __magic_name__ ( ):
'''simple docstring'''
with open(os.path.dirname(__a ) + """/grid.txt""" ) as f:
UpperCamelCase__ = [] # noqa: E741
for _ in range(20 ):
l.append([int(__a ) for x in f.readline().split()] )
Uppe... | 707 |
class __A:
"""simple docstring"""
def __init__(self , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ):
UpperCamelCase__ = None
UpperCamelCase__ = None
UpperCamelCase__ = graph
self._normalize_graph(SCREAMING_SNAKE_CASE_ ... | 86 | 0 |
'''simple docstring'''
A_ = "Input must be a string of 8 numbers plus letter"
A_ = "TRWAGMYFPDXBNJZSQVHLCKE"
def _UpperCamelCase ( __UpperCamelCase ) -> bool:
if not isinstance(__UpperCamelCase ,__UpperCamelCase ):
lowerCamelCase_ = f'''Expected string as input, fou... | 42 | def A__ ( lowercase: Any, lowercase: List[Any], lowercase: List[Any]=False ) -> Dict:
if isinstance(lowercase, lowercase ) and isinstance(lowercase, lowercase ):
A : int =len(set_a.intersection(lowercase ) )
if alternati... | 305 | 0 |
"""simple docstring"""
import os
import sys
import tempfile
import torch
from .state import AcceleratorState
from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment
def lowercase (snake_case__ : Optional[int] , snake_case__ : Optional[int]=() ... | 529 |
"""simple docstring"""
import argparse
import os
import re
import tensorflow as tf
import torch
from transformers import BertConfig, BertModel
from transformers.utils import logging
logging.set_verbosity_info()
a = logging.get_logger(__name__)
def lowercase (snake_case__ : s... | 529 | 1 |
'''simple docstring'''
from __future__ import annotations
import json
import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent
lowercase__ : Tuple = {"UserAgent": UserAgent().random}
def __lowerCamelCase ( _UpperCamelCase : Dict ):
'''simple docs... | 390 | '''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging
lowercase__ : str = logging.get_logger(__name__)
lowercase__ : Optional[int] = {
"sayakpaul/vit-msn-base": "https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.j... | 390 | 1 |
from __future__ import annotations
def _SCREAMING_SNAKE_CASE ( __lowercase : int | str ) -> bool:
"""simple docstring"""
__A = str(__lowercase )
return n == n[::-1]
def _SCREAMING_SNAKE_CASE ( __lowercase : int = 1_0_0_0_0_0_0 ) -> ... | 199 |
from dataclasses import dataclass
from typing import Optional, Tuple, Union
import torch
import torch.nn as nn
from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import BaseOutput, apply_forward_hook
from .modeling_utils import ModelMixin
from .vae import Decoder, DecoderOutput, Enc... | 199 | 1 |
import heapq as hq
import math
from collections.abc import Iterator
class A_ :
def __init__( self : int , __SCREAMING_SNAKE_CASE : str ):
__a = str(id_ )
__a = None
__a = None
__a = []
__a = {} # {vertex:distance}
def __lt__( s... | 197 | import argparse
from copy import deepcopy
import numpy as np
from datasets import ClassLabel, DatasetDict, load_dataset
from evaluate import load
from transformers import (
AutoModelForSequenceClassification,
AutoTokenizer,
DataCollatorWithPadding,
Trainer,
TrainerCallback,
Traini... | 197 | 1 |
'''simple docstring'''
from __future__ import annotations
import requests
def snake_case_ (_a : str ):
UpperCAmelCase = F"https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty"
return requests.get(_a ).json()
def snake_case_ (_a : in... | 358 |
'''simple docstring'''
import argparse
import logging
import os
import sys
import numpy as np
import onnxruntime
import torch
from bart_onnx.generation_onnx import BARTBeamSearchGenerator
from bart_onnx.reduce_onnx_size import remove_dup_initializers
import transformers
from transformers import BartForCon... | 358 | 1 |
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
snake_case__ : Dict = collections.namedtuple('_Datasets', ['train'... | 278 |
import argparse
from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection
from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline
if __name__ == "__main__":
snake_case__ : Optional[int] = argparse.ArgumentParser()
parser.add_argument('--dump_path', defau... | 278 | 1 |
import unittest
from transformers import is_vision_available
from transformers.pipelines import pipeline
from transformers.testing_utils import (
is_pipeline_test,
nested_simplify,
require_tf,
require_torch,
require_vision,
slow,
)
from .test_pipelines_common import ANY
... | 712 |
import torch
from diffusers import DiffusionPipeline
class _a ( snake_case_ ):
def __init__( self , lowercase_ , lowercase_ ) -> int:
super().__init__()
self.register_modules(unet=lowercase_ , scheduler=lowercase... | 693 | 0 |
"""simple docstring"""
import logging
import os
import threading
import time
try:
import warnings
except ImportError:
UpperCAmelCase = None
try:
import msvcrt
except ImportError:
UpperCAmelCase = None
try:
import fcntl
except ImportError:
UpperCAmelCase = None
# Backward compatib... | 420 | """simple docstring"""
from __future__ import annotations
import time
import numpy as np
UpperCAmelCase = [8, 5, 9, 7]
UpperCAmelCase = [
[2, 0, 1, 1],
[0, 1, 2, 1],
[4, 0, 0, 3],
[0, 2, 1, 0],
[1, 0, 3, 0],
]
UpperCAmelCase = [
[3, 2, 1, 4],
[0, 2, 5, 2],
[5, 1,... | 420 | 1 |
"""simple docstring"""
import logging
import os
from dataclasses import dataclass
from enum import Enum
from typing import List, Optional, Union
from filelock import FileLock
from transformers import PreTrainedTokenizer, is_tf_available, is_torch_available
__a = logging.getLogger(__name__)
@data... | 310 |
"""simple docstring"""
from typing import Callable, List, Optional, Tuple, Union
import torch
from transformers import CLIPTextModel, CLIPTokenizer
from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixin, TransformeraDModel, VQModel
from ...schedulers import VQDiffusion... | 310 | 1 |
"""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 lowercas... | 247 |
"""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 | 1 |
"""simple docstring"""
import json
import os
from typing import Optional, Tuple
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging
UpperCamelCase__ = logging.get_logger(__name__)
UpperCamelCase__ = {'''vocab_file''': '''vocab.json'''}
UpperCamelCase__ =... | 439 |
"""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''',... | 439 | 1 |
'''simple docstring'''
from math import pow
def UpperCamelCase__ ( __magic_name__ : int , __magic_name__ : int , __magic_name__ : int , __magic_name__ : int , __magic_name__ : int , ) -> tuple[int, int]:
'''simple docstring'''
if... | 38 |
"""simple docstring"""
def _a ( UpperCAmelCase__ ) -> int:
if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) or number < 0:
raise ValueError('''Input must be a non-negative integer''' )
__SCREAMING_SNAKE_CASE = 0
while number:
... | 482 | 0 |
"""simple docstring"""
import warnings
from ...utils import logging
from .image_processing_deformable_detr import DeformableDetrImageProcessor
_lowerCamelCase = logging.get_logger(__name__)
class lowerCamelCase_ ( lowercase ):
"""simple docstring"""
def __init__( self... | 112 |
"""simple docstring"""
import ast
import os
import re
import shutil
import tempfile
import unittest
from unittest import mock
import torch
from accelerate.test_utils.examples import compare_against_test
from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command, slow
from accele... | 112 | 1 |
"""simple docstring"""
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
fro... | 589 |
"""simple docstring"""
a__ : Optional[int] = [
999,
800,
799,
600,
599,
500,
400,
399,
377,
355,
333,
311,
288,
266,
244,
222,
200,
199,
177,
155,
133,
111,
88,
66,
44,
22,
0,
]
... | 589 | 1 |
from __future__ import annotations
def a ( _UpperCAmelCase : list[float] ):
'''simple docstring'''
if len(_UpperCAmelCase ) < 2:
raise ValueError('''Monogons and Digons are not polygons in the Euclidean space''' )
if any(i <= 0 for i in nums ):
ra... | 241 |
import subprocess
import sys
from transformers import BertConfig, BertModel, BertTokenizer, pipeline
from transformers.testing_utils import TestCasePlus, require_torch
class UpperCAmelCase__ ( __UpperCamelCase ):
'''simple docstring'''
@require_torch
def sn... | 241 | 1 |
import argparse
import importlib
from pathlib import Path
# Test all the extensions added in the setup
_lowerCamelCase : Optional[Any] = [
'''kernels/rwkv/wkv_cuda.cu''',
'''kernels/rwkv/wkv_op.cpp''',
'''kernels/deformable_detr/ms_deform_attn.h''',
'''kernels/deformable_detr/cuda... | 686 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tensorflow_text_available, is_torch_available
_lowerCamelCase : int = {
'''configuration_ernie''': ['''ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ErnieConfig''', '''ErnieOnnxConfig'''],
}
t... | 686 | 1 |
"""simple docstring"""
from ...utils import (
OptionalDependencyNotAvailable,
is_flax_available,
is_torch_available,
is_transformers_available,
)
try:
if not (is_transformers_available() and is_torch_available()):
raise OptionalDependencyNotAvailable()
except OptionalDependencyNotA... | 74 |
"""simple docstring"""
from __future__ import annotations
import random
import unittest
from transformers import TransfoXLConfig, is_tf_available
from transformers.testing_utils import require_tf, slow
from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelT... | 74 | 1 |
import os
import tempfile
import unittest
from transformers import NezhaConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device
from ...generation.test_utils import GenerationTesterMixin
f... | 234 |
import copy
from typing import Dict, List, Optional
from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto import CONFIG_MAPPING
__SCREAMING_SNAKE_CASE ={
"""facebook/mask2former-swin-small-coco-instance""": (
"""https://huggingface.co/faceb... | 234 | 1 |
'''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():
from ... | 570 |
'''simple docstring'''
def __snake_case ( ) -> List[Any]:
"""simple docstring"""
for n in range(1 , 1_000_000 ):
yield n * (n + 1) // 2
def __snake_case ( SCREAMING_SNAKE_CASE_ : Optional[Any] ) -> List[Any]:
"""simple docstring"""
... | 570 | 1 |
from itertools import zip_longest
import requests
from bsa import BeautifulSoup
from pandas import DataFrame
def lowerCamelCase__ ( _lowerCamelCase = "laptop" ) ->DataFrame:
_UpperCAmelCase =F"https://www.amazon.in/laptop/s?k={product}"
_UpperCAmelCase ={
"User-Agent": "Mozilla/5.0 (X11;... | 408 |
from __future__ import annotations
from collections.abc import MutableSequence
class _a :
"""simple docstring"""
def __init__( self , _snake_case , _snake_case ):
if len(_snake_case ) != degree + 1:
raise ValueError(
"The number of... | 408 | 1 |
"""simple docstring"""
import argparse
import requests
import torch
# pip3 install salesforce-lavis
# I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis_float32 (there's also the fix_lavis branch)
# also note: to convert Vicuna checkpoints... | 498 |
"""simple docstring"""
import os
try:
from .build_directory_md import good_file_paths
except ImportError:
from build_directory_md import good_file_paths # type: ignore
A_ = list(good_file_paths())
assert filepaths, "good_file_paths() failed!"
A_ = [file for file in filepaths ... | 498 | 1 |
'''simple docstring'''
class __SCREAMING_SNAKE_CASE :
"""simple docstring"""
def __init__( self : Tuple , __a : list[int] ):
_a = len(__a )
_a = [0] * len_array
if len_array > 0:
_a = ... | 692 |
'''simple docstring'''
import warnings
from ...utils import logging
from .image_processing_chinese_clip import ChineseCLIPImageProcessor
lowerCAmelCase_ : Union[str, Any] = logging.get_logger(__name__)
class __SCREAMING_SNAKE_CASE (lowerCamelCase_ ):
"""simple docst... | 692 | 1 |
from __future__ import annotations
import math
class snake_case__ :
'''simple docstring'''
def __init__( self : Optional[Any] , lowerCAmelCase_ : int ) -> None:
UpperCAmelCase_ = size
# approximate the overall size of segmen... | 703 |
def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int ):
return int((input_a, input_a).count(0 ) == 0 )
def _lowerCAmelCase ( ):
assert and_gate(0 , 0 ) == 0
assert and_gate(0 , 1 ) == 0
assert and_gate(1 , ... | 407 | 0 |
"""simple docstring"""
import os
import unittest
from transformers import BertTokenizerFast
from transformers.models.bert.tokenization_bert import (
VOCAB_FILES_NAMES,
BasicTokenizer,
BertTokenizer,
WordpieceTokenizer,
_is_control,
_is_punctuation,
_is_whitespace,
)
from transformer... | 595 |
'''simple docstring'''
import time
from dataclasses import dataclass
from multiprocessing import Pool
from unittest import TestCase
from unittest.mock import patch
import multiprocess
import numpy as np
import pytest
from datasets.utils.py_utils import (
NestedDataStructure,
asdict,
iflatmap_un... | 330 | 0 |
"""simple docstring"""
from scipy.stats import spearmanr
import datasets
a__ : List[str] = '''
The Spearman rank-order correlation coefficient is a measure of the
relationship between two datasets. Like other correlation coefficients,
this one varies between -1 and +1 with 0 implying no... | 553 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
a__ : Optional[Any] = {
'''configuration_jukebox''': [
'''JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP''',
'''JukeboxConfig''',
... | 553 | 1 |
def a_ ( SCREAMING_SNAKE_CASE__ : Optional[int] ):
'''simple docstring'''
_lowerCamelCase : Any =len(SCREAMING_SNAKE_CASE__ )
while cur > 1:
# Find the maximum number in arr
_lowerCamelCase : int =arr.index(max(ar... | 464 |
import argparse
import fairseq
import torch
from torch import nn
from transformers import (
MBartaaTokenizer,
MBartConfig,
MBartForCausalLM,
SpeechEncoderDecoderConfig,
SpeechEncoderDecoderModel,
WavaVecaConfig,
WavaVecaFeatureExtractor,
WavaVecaModel,
logging,
)
logging.set_v... | 464 | 1 |
from copy import deepcopy
class UpperCAmelCase__ :
'''simple docstring'''
def __init__( self : Tuple , a_ : list[int] | None = None , a_ : int | None = None ):
'''simple docstring'''
if arr is None and size is not None:
... | 241 |
import importlib.util
import json
import os
import warnings
from dataclasses import dataclass, field
import torch
from ..training_args import TrainingArguments
from ..utils import cached_property, is_sagemaker_dp_enabled, logging
__A =logging.get_logger(__name__)
def a ( ):
... | 241 | 1 |
def _UpperCAmelCase ( a : int ):
# bit count represents no. of bits in the gray code
if bit_count < 0:
raise ValueError("""The given input must be positive""" )
# get the generated string sequence
snake_case__ = gray_code_sequence_string(a ... | 654 |
class _lowerCAmelCase :
"""simple docstring"""
def __init__( self : List[Any] , UpperCamelCase__ : int):
'''simple docstring'''
snake_case__ = size
snake_case__ = [0] * size
snake_case__ ... | 654 | 1 |
'''simple docstring'''
import gc
import math
import unittest
import torch
from diffusers import UNetaDModel
from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device
from diffusers.utils.testing_utils import enable_full_determinism
from .test_modeling_common import ModelTes... | 606 | '''simple docstring'''
import argparse
import json
import os
from collections import OrderedDict
import numpy as np
import tensorflow as tf
import torch
def snake_case_ ( __snake_case : Tuple) -> str:
lowerCAmelCase_ = os.path.join(args.tf_model_dir , '''parameters.jso... | 606 | 1 |
import requests
from bsa import BeautifulSoup
def SCREAMING_SNAKE_CASE ( _UpperCAmelCase = "https://www.worldometers.info/coronavirus" ) -> dict:
lowerCamelCase__ : Optional[Any] = BeautifulSoup(requests.get(_UpperCAmelCase ).text , 'html.parser' )
lowerCamel... | 295 |
import gc
import threading
import time
import psutil
import torch
class lowerCAmelCase :
def __init__( self : str ) -> Union[str, Any]:
lowerCamelCase__ : Optional[Any] = psutil.Process()
lowerCamelCase__ : Union[str, Any] = False
def A_ ... | 295 | 1 |
'''simple docstring'''
from typing import List, Optional, Union
import numpy as np
import tensorflow as tf
from .utils import logging
_snake_case : Optional[Any] = logging.get_logger(__name__)
def _a ( _SCREAMING_SNAKE_CASE : Union[tf.Tensor, np.ndarray] ):
if isinstance(a_ , np... | 705 |
'''simple docstring'''
def _a ( _SCREAMING_SNAKE_CASE : list[int] , _SCREAMING_SNAKE_CASE : list[int] ):
# Check if the input is valid
if not len(_SCREAMING_SNAKE_CASE ) == len(_SCREAMING_SNAKE_CASE ) == 3:
raise ValueError("Please enter a valid equation." )
if equ... | 493 | 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,
WEIGHT... | 251 |
'''simple docstring'''
from __future__ import annotations
import unittest
from transformers import LEDConfig, is_tf_available
from transformers.testing_utils import require_tf, slow
from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor
fro... | 150 | 0 |
def SCREAMING_SNAKE_CASE_ ( UpperCamelCase__ ):
UpperCamelCase__ : List[str] = hex_num.strip()
if not hex_num:
raise ValueError('''No value was passed to the function''' )
UpperCamelCase__ : List[Any] = hex_num[0] == '''-'''
if is_negative:
... | 462 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
lowerCamelCase ={"configuration_swin": ["SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP", "SwinConfig", "SwinOnnxConfig"]}
try:
if not is_torch_available():
raise OptionalDep... | 462 | 1 |
import tempfile
import torch
from diffusers import (
DEISMultistepScheduler,
DPMSolverMultistepScheduler,
DPMSolverSinglestepScheduler,
UniPCMultistepScheduler,
)
from .test_schedulers import SchedulerCommonTest
class snake_case__ ( _lowerCAmelCase ):
lowercase__ : Dict = ... | 324 |
from __future__ import annotations
from collections import deque
from collections.abc import Iterator
from dataclasses import dataclass
@dataclass
class snake_case__ :
lowercase__ : int
lowercase__ : int
class snake_case__ :
def __init__( self , lowerCAmelCase__ ) -> D... | 324 | 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 Tokenizer... | 719 |
"""simple docstring"""
from manim import *
class __lowercase ( _UpperCAmelCase):
"""simple docstring"""
def __UpperCamelCase (self ):
snake_case_ : Union[str, Any] = Rectangle(height=0.5 , width=0.5 )
snake_c... | 48 | 0 |
"""simple docstring"""
def UpperCamelCase__ ( lowercase__ : int = 1000 ):
snake_case : List[str] = 3
snake_case : Any = 0
while a < n:
if a % 3 == 0 or a % 5 == 0:
result += a
elif a % 15 == 0:
result -= a
a += 1
return re... | 134 |
'''simple docstring'''
from collections import OrderedDict
from typing import Mapping
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
A = logging.get_logger(__name__)
A = {
'junnyu/roformer_chinese_smal... | 320 | 0 |
'''simple docstring'''
import os
def _A (lowerCAmelCase__ :Any ) -> List[str]:
'''simple docstring'''
_a = len(grid[0] )
_a = len(lowerCAmelCase__ )
_a = 0
_a = 0
_a ... | 532 |
'''simple docstring'''
import numpy as np
import qiskit
def _A (lowerCAmelCase__ :int = 8 , lowerCAmelCase__ :int | None = None ) -> str:
'''simple docstring'''
_a = np.random.default_rng(seed=lowerCAmelCase__ )
# Roughl... | 532 | 1 |
"""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_ = {'''configuration_opt''': ['''OPT_PRETRA... | 609 |
'''simple docstring'''
import argparse
import json
import os
from collections import OrderedDict
import numpy as np
import tensorflow as tf
import torch
def a ( UpperCamelCase_ : Any ) -> List[str]:
snake_case__ =os.path.join(args.tf_model_dir , 'parameters.json' )
... | 538 | 0 |
"""simple docstring"""
lowercase__ = [
999,
800,
799,
600,
599,
500,
400,
399,
377,
355,
333,
311,
288,
266,
244,
222,
200,
199,
177,
155,
133,
111,
88,
66,
44,
22... | 492 |
"""simple docstring"""
import copy
import os
import cva
import numpy as np
from matplotlib import pyplot as plt
class lowerCAmelCase__ :
'''simple docstring'''
def __init__( self ):
_lowerCamelCase : Tuple = ''
_... | 492 | 1 |
'''simple docstring'''
from unittest.mock import Mock, patch
from file_transfer.send_file import send_file
@patch('''socket.socket''' )
@patch('''builtins.open''' )
def _SCREAMING_SNAKE_CASE (A , A ) -> int:
"""simple docstring"""
lowercase__ = Mock()
lo... | 460 |
'''simple docstring'''
import os
import unicodedata
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 SPIECE_UNDERLINE, logging
lowerCamelCase : str = lo... | 460 | 1 |
import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple
import sentencepiece as spm
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging
SCREAMING_SNAKE_CASE__ : int = logging.get_logger(__name__)
SCREAMING_SNAKE_CASE__ : O... | 180 |
import argparse
import json
from typing import List
from ltp import LTP
from transformers import BertTokenizer
def __lowercase ( 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) #
or ... | 180 | 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 import Batc... | 83 |
"""simple docstring"""
from __future__ import annotations
import random
# Maximum size of the population. Bigger could be faster but is more memory expensive.
SCREAMING_SNAKE_CASE_ = 200
# Number of elements selected in every generation of evolution. The selection takes
# place from best to worst ... | 465 | 0 |
"""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
... | 704 | """simple docstring"""
import unittest
from transformers import DebertaConfig, is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common im... | 197 | 0 |
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from tensorflow.keras.layers import LSTM, Dense
from tensorflow.keras.models import Sequential
if __name__ == "__main__":
__a :int = pd.read_csv('sample_data.csv', header=None)
__a :List[str] ... | 86 |
lowerCamelCase__ = 8.3_1_4_4_5_9_8
def UpperCamelCase ( snake_case__ : float ,snake_case__ : float ):
'''simple docstring'''
if temperature < 0:
raise Exception("""Temperature cannot be less than 0 K""" )
if molar_mass <=... | 455 | 0 |
def UpperCAmelCase__( __UpperCAmelCase : str , __UpperCAmelCase : Optional[int] ):
__snake_case : Any = 0
while b > 0:
if b & 1:
res += a
a += a
b >>= 1
return res
def UpperCAmelCase__( __UpperCAmelCase : Optional[int] ... | 679 | from itertools import permutations
def UpperCAmelCase__( __UpperCAmelCase : tuple ):
if num[3] % 2 != 0:
return False
if (num[2] + num[3] + num[4]) % 3 != 0:
return False
if num[5] % 5 != 0:
return False
__snake_case : Any = [7, 11, 13, 17]
for i, t... | 679 | 1 |
import argparse
import json
import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel
from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
torch.set_grad_enabled(False)
... | 73 | import numpy as np
from PIL import Image
def UpperCamelCase ( __lowercase : np.ndarray ,__lowercase : int ,__lowercase : int ):
'''simple docstring'''
A_ : List[Any] = np.array(__lowercase )
if arr.shape[0] != arr.shape[1]:
raise Value... | 558 | 0 |
import unittest
import numpy as np
from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available
from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs
if is_torch_available():
import to... | 472 |
from typing import List
import datasets
from datasets.tasks import AudioClassification
from ..folder_based_builder import folder_based_builder
_SCREAMING_SNAKE_CASE : Optional[Any] = datasets.utils.logging.get_logger(__name__)
class UpperCAmelCase__ ( folder_based_builder.FolderBasedBuilde... | 472 | 1 |
"""simple docstring"""
import logging
import sys
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional, Union
import librosa
import torch
from datasets import DatasetDict, load_dataset
from packaging import version
from torch import nn
from transformers im... | 82 |
"""simple docstring"""
from math import atan, cos, radians, sin, tan
from .haversine_distance import haversine_distance
lowerCamelCase = 6_378_137.0
lowerCamelCase = 6_356_752.314_245
lowerCamelCase = 6_378_137
def a__ ( lowerCAmelCase__ , lowerCAmelCase__ ... | 82 | 1 |
"""simple docstring"""
from __future__ import annotations
__UpperCAmelCase = list[tuple[int, int]]
__UpperCAmelCase = [
[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],
[1, 0, 1, 0, 0, 0, ... | 251 |
"""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 To... | 251 | 1 |
from ...processing_utils import ProcessorMixin
class lowerCamelCase ( lowercase__ ):
'''simple docstring'''
lowerCAmelCase_ : List[Any] = 'SpeechT5FeatureExtractor'
lowerCAmelCase_ : Union[str, Any] = 'SpeechT5Tokenizer'
def __... | 579 |
"""simple docstring"""
import numpy as np
import pandas as pd
from sklearn.preprocessing import Normalizer
from sklearn.svm import SVR
from statsmodels.tsa.statespace.sarimax import SARIMAX
def lowerCamelCase_ (UpperCamelCase__ : list , UpperCamelCase__ : list , UpperCamelCase__ ... | 506 | 0 |
from math import ceil
from typing import List, Optional, Union
import numpy as np
from ...audio_utils import mel_filter_bank, spectrogram, window_function
from ...feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor
from ...utils import TensorType, logging
A = logging.get_log... | 718 |
import os
from bleurt import score # From: git+https://github.com/google-research/bleurt.git
import datasets
A = datasets.logging.get_logger(__name__)
A = '\\n@inproceedings{bleurt,\n title={BLEURT: Learning Robust Metrics for Text Generation},\n author={Thibault Sellam and Dipanjan Da... | 97 | 0 |
from pathlib import Path
import fire
from tqdm import tqdm
def __UpperCamelCase ( lowercase__ : str="ro" , lowercase__ : Optional[Any]="en" , lowercase__ : Any="wmt16" , lowercase__ : str=None ) -> None:
'''simple docstring'''
... | 600 |
def __UpperCamelCase ( lowercase__ : str , lowercase__ : str ) -> bool:
'''simple docstring'''
lowerCAmelCase_ : Optional[Any] = len(lowercase__ )
lowerCAmelCase_ : int = len(lowercase__ )
lowerCAmelCase_ ... | 600 | 1 |
'''simple docstring'''
from collections.abc import Sequence
def __a(SCREAMING_SNAKE_CASE_ : Sequence[float] , SCREAMING_SNAKE_CASE_ : bool = False ):
'''simple docstring'''
if not arr:
return 0
_lowerCAmelCase = 0 if allow_empty_subarrays else float("-... | 489 |
'''simple docstring'''
import unittest
from transformers import (
MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
TextClassificationPipeline,
pipeline,
)
from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch,... | 489 | 1 |
"""simple docstring"""
def __snake_case ( _lowercase = 6008_5147_5143 ):
"""simple docstring"""
try:
UpperCamelCase = int(_lowercase )
except (TypeError, ValueError):
raise TypeError('''Parameter n must be int or castable to int.''' )
if... | 34 |
"""simple docstring"""
import warnings
from ...utils import logging
from .image_processing_mobilevit import MobileViTImageProcessor
SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__)
class snake_case_ ( lowerCamelCase_ ):
"""simple docstring"""
def __init__( se... | 34 | 1 |
"""simple docstring"""
a_ : Optional[Any] = '''
# Installazione di Transformers
! pip install transformers datasets
# Per installare dalla fonte invece dell\'ultima versione rilasciata, commenta il comando sopra e
# rimuovi la modalità commento al comando seguente.
# ! pip install git+https://gi... | 704 |
"""simple docstring"""
import random
from typing import Any
def UpperCAmelCase ( A__: list ) -> list[Any]:
for _ in range(len(A__ ) ):
__lowerCamelCase : List[Any] = random.randint(0 , len(A__ ) - 1 )
__lowerCamelCase : Optional[... | 263 | 0 |
from typing import TYPE_CHECKING
from ...utils import _LazyModule
SCREAMING_SNAKE_CASE = {'tokenization_byt5': ['ByT5Tokenizer']}
if TYPE_CHECKING:
from .tokenization_byta import ByTaTokenizer
else:
import sys
SCREAMING_SNAKE_CASE = _LazyModule(__name__, gl... | 99 |
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_accelerate_available,
is_acce... | 655 | 0 |
from bisect import bisect
from itertools import accumulate
def SCREAMING_SNAKE_CASE__ ( __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ):
snake_case__ = sorted(zip(__lowerCAmelCase , __lowerCAmelCase ) , key=lambda __lowerCAmelCase ... | 530 |
import os
from shutil import copyfile
from typing import List, Optional, Tuple
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging
if is_sentencepiece_available():
from .tokenization_pegasus import PegasusTokenizer
else:
__magic_name__ ... | 530 | 1 |
"""simple docstring"""
from collections import OrderedDict
from typing import Mapping
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
A__ : int = logging.get_logger(__name__)
A__ : List[Any] = {
'andreasmadsen/efficient_mlm_m... | 353 |
"""simple docstring"""
import numpy as np
import torch
from torch.utils.data import Dataset
from utils import logger
class __magic_name__ ( SCREAMING_SNAKE_CASE__ ):
def __init__( self , A_ , A_ ) -> List[str]:
"""simple docstring"""
... | 353 | 1 |
'''simple docstring'''
import os
def snake_case_ ( SCREAMING_SNAKE_CASE__ = "input.txt" ):
'''simple docstring'''
with open(os.path.join(os.path.dirname(SCREAMING_SNAKE_CASE__ ) , SCREAMING_SNAKE_CASE__ ) ) as input_file:
_snake_case = [
... | 368 |
'''simple docstring'''
import itertools
import json
import os
import unittest
from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast
from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers, slow
... | 368 | 1 |
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 (
TFBaseModelOutputWithNoAttention,
... | 23 |
"""simple docstring"""
import asyncio
import os
import re
import sys
import tempfile
import unittest
from contextlib import contextmanager
from copy import deepcopy
from distutils.util import strtobool
from enum import Enum
from importlib.util import find_spec
from pathlib import Path
from unittest.mock imp... | 34 | 0 |
import unittest
from transformers import is_vision_available
from transformers.pipelines import pipeline
from transformers.testing_utils import (
is_pipeline_test,
nested_simplify,
require_tf,
require_torch,
require_vision,
slow,
)
from .test_pipelines_common import ANY
if is_vision_avai... | 714 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_torch_available,
)
SCREAMING_SNAKE_CASE = {
"configuration_gpt_bigcode": ["GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTBigCodeConfig"],
}
try:
if not is_torch_available():
... | 23 | 0 |
def lowercase ( __A : Tuple , __A : Optional[int] ) -> Optional[int]:
'''simple docstring'''
snake_case : List[Any] = [1]
for i in range(2 , __A ):
factorials.append(factorials[-1] * i )
assert 0 <= k < factorials[-1] * n, "k out of bound... | 36 |
"""simple docstring"""
import argparse
import os
import numpy as np
import tensorflow as tf
import torch
from transformers import BertModel
def UpperCAmelCase ( snake_case : BertModel , snake_case : str , snake_case : str ):
_lowerCAmelCa... | 227 | 0 |
"""simple docstring"""
from __future__ import annotations
def __a ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) ->List[str]:
# Checks if the entire collection has been sorted
if len(_SCREAMING_SNAKE_CASE ) <= 1 or n <= 1:
return
insert_next(_SCREAMING_SNAKE_CASE , n - 1 ... | 710 | """simple docstring"""
import unittest
from huggingface_hub import hf_hub_download
from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor
from transformers.pipelines import VideoClassificationPipeline, pipeline
from transformers.testing_utils import (
is_pipeline_test,
neste... | 217 | 0 |
'''simple docstring'''
from typing import List, Optional, Union
import torch
from transformers import (
XLMRobertaTokenizer,
)
from ...models import UNetaDConditionModel, VQModel
from ...pipelines import DiffusionPipeline
from ...pipelines.pipeline_utils import ImagePipelineOutput
from ...schedulers import D... | 78 |
'''simple docstring'''
import copy
from collections import OrderedDict
from typing import Dict, Mapping
from packaging import version
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
from ..auto import CONFIG_MAPPING
lowerCAmelCase_ = loggin... | 173 | 0 |
from ..utils import DummyObject, requires_backends
class lowerCamelCase ( metaclass=_lowerCamelCase ):
'''simple docstring'''
UpperCamelCase__ =['''flax''']
def __init__( self : Dict , *lowerCamelCase_ : Dict , **lowerCamelCase_ : Optional... | 501 |
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 import Dataset
from tr... | 501 | 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
a__ : str = 1.054_571_817e-34 # unit of ℏ : J * s
a__ : List[Any] = 3e8 # unit of c : ... | 51 |
import json
import os
import shutil
import tempfile
import unittest
from transformers import BatchEncoding, CanineTokenizer
from transformers.testing_utils import require_tokenizers, require_torch
from transformers.tokenization_utils import AddedToken
from transformers.utils import cached_property
fr... | 250 | 0 |
"""simple docstring"""
class _snake_case :
def __init__( self : List[str] , UpperCAmelCase : int ):
__lowerCamelCase : Any = size
__lowerCamelCase : Union[str, Any] = [0] * size
__lowerCamelCase :... | 366 | """simple docstring"""
import math
import torch
from torch import nn
from ..configuration_utils import ConfigMixin, register_to_config
from .attention_processor import Attention
from .embeddings import get_timestep_embedding
from .modeling_utils import ModelMixin
class _snake_case ( a__ , a__ ):
... | 366 | 1 |
from __future__ import annotations
def snake_case_ ( SCREAMING_SNAKE_CASE_ ) -> list[int]:
lowercase__ : str = [True] * limit
lowercase__ : int = False
lowercase__ : Union[str, Any] = False
lowercase__ : Optional[A... | 397 |
import unittest
from transformers import is_vision_available
from transformers.pipelines import pipeline
from transformers.testing_utils import (
is_pipeline_test,
nested_simplify,
require_tf,
require_torch,
require_vision,
slow,
)
from .test_pipelines_common import ANY
if is_vision_avai... | 354 | 0 |
def _lowerCAmelCase ( __lowerCAmelCase ) -> int:
"""simple docstring"""
snake_case__ : str = len(SCREAMING_SNAKE_CASE_ )
snake_case__ : Optional[Any] = len(matrix[0] )
snake_case__ : Tuple = min(SCREAMING_SNAKE_CASE_ , SCREAMING... | 702 |
import random
from typing import Any
def _lowerCAmelCase ( __lowerCAmelCase ) -> list[Any]:
"""simple docstring"""
for _ in range(len(__lowerCAmelCase ) ):
snake_case__ : Union[str, Any] = random.randint(0 , len(__lowerCAmelCase ) - 1 ... | 219 | 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 __lowerCAmelCase ( ... | 665 |
'''simple docstring'''
import unittest
from transformers import (
MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING,
TextaTextGenerationPipeline,
pipeline,
)
from transformers.testing_utils import is_pipeline_test, require_tf, require_torch
from transformers.utils i... | 665 | 1 |
'''simple docstring'''
def UpperCAmelCase ( UpperCAmelCase__ : List[str]):
lowerCamelCase , lowerCamelCase : List[Any] = [], []
while len(UpperCAmelCase__) > 1:
lowerCamelCase , lowerCamelCase : Tuple = min(UpperCAmelCase__), max(Up... | 449 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
is_vision_available,
)
A = {
'configur... | 449 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.