code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
'''simple docstring''' import math import sys def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> int: if number != int(UpperCamelCase ): raise ValueError("""the value of input must be a natural number""" ) if number < 0...
41
import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common impor...
21
0
'''simple docstring''' import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrat...
42
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers im...
21
0
import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor __lowercase = logging.getLogger(__name__) __lowercase = 50 # max width of layer nam...
43
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer SCREAMING_SNAKE_CASE : Any = logging.get_logg...
21
0
"""simple docstring""" import os import pickle import unittest from transformers import AutoTokenizer from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.models.bert_japanese.tokenization_bert_japanese import ( VOCAB_FILES_NAMES, BertJapaneseTokenizer, CharacterTokeni...
44
def UpperCamelCase_( lowerCamelCase_ ) -> int: if not numbers: return 0 if not isinstance(lowerCamelCase_ , (list, tuple) ) or not all( isinstance(lowerCamelCase_ , lowerCamelCase_ ) for number in numbers ): raise ValueError('numbers must be an iterable o...
21
0
"""simple docstring""" def lowercase ( lowerCAmelCase__ : str = "The quick brown fox jumps over the lazy dog" , ) -> bool: __a = set() # Replace all the whitespace in our sentence __a = input_str.replace(''' ''' , '''''' ) for a...
45
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass SCREAMING_SNAKE_CASE : Tuple = (3, 9, -11, 0, 7, 5, 1, -1) SCREAMING_SNAKE_CASE : Union[str, Any] = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class _lowe...
21
0
"""simple docstring""" import copy import random from transformers import CLIPTokenizer class lowercase ( _UpperCAmelCase ): def __init__( self , *lowercase , **lowercase ) -> Optional[int]: super().__init__(*lowercase , **lowerc...
46
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandinsky.text_encoder import ...
21
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCamelCase : List[Any] = { "configuration_tapas": ["TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP", "TapasConfig"], "tokenization_tapas": ["T...
47
from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_...
21
0
import warnings from ...utils import logging from .image_processing_perceiver import PerceiverImageProcessor SCREAMING_SNAKE_CASE__ : Dict = logging.get_logger(__name__) class UpperCamelCase__ (lowerCAmelCase__ ): '''simple docstring''' def __init__( ...
48
def UpperCamelCase_( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ) -> float: _lowercase : Tuple = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series return total def UpperCamelCase_( ) ...
21
0
import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( FlaxForcedBOSTokenLogits...
49
import unittest from transformers import SqueezeBertConfig, 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 import ModelTesterMixin, ids_tensor, ...
21
0
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...
50
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class _lowerCamelCase( unittest.TestCase ): lowercase_ : Dict = JukeboxTokenizer lowercase_ : Dict = { """artist""": """Zac Brown Band""", """ge...
21
0
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_...
51
import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffusers.utils import floats_tensor fr...
21
0
from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ......
52
import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImageProcessor from diffusers.pipe...
21
0
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES a__ : Optional[Any] =logging.get_logger(__name__) a__ : str =...
53
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : List[str] = { "SenseTime/deformable-detr": "https://huggi...
21
0
"""simple docstring""" 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__ : Dict = [ '''Prosecutor: "No videos were used in the crash investigation" German papers say they s...
54
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) SCREAMING_SNAKE_CASE : List[str] = { "configuration_speech_to_text": ["SPEE...
21
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 BaseTransformersCLIComma...
55
import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, ...
21
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_mobilebert import MobileBertTokenizer a : Any = logging.get_logger(__name__...
56
import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device from diffusers.utils.testing_utils import en...
21
0
"""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 _UpperCamelCase : '''simple docstring''' __UpperCAmelCase : int __UpperCAmel...
57
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def UpperCamelCase_( lowerCamelCase_ ) -> bool: _lowercase : int = int(number**0.5 ) return number == sq * sq def UpperCamelCase_( lowerCamelCase_ , lowerCam...
21
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_available(): ...
58
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE : str = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP"...
21
0
from __future__ import annotations from typing import Any class UpperCAmelCase : def __init__(self : str , snake_case__ : int ) -> None: '''simple docstring''' snake_case : str = num_of_nodes snake_case :...
59
from __future__ import annotations def UpperCamelCase_( lowerCamelCase_ ) -> bool: if len(lowerCamelCase_ ) < 2: raise ValueError('Monogons and Digons are not polygons in the Euclidean space' ) if any(i <= 0 for i in nums ): raise ValueError('All values must be greater tha...
21
0
"""simple docstring""" def _snake_case ( _snake_case : list , _snake_case : list ): _validate_point(_snake_case ) _validate_point(_snake_case ) if len(_snake_case ) != len(_snake_case ): raise ValueError('''Both points must be in the same n-dimensional space''' ) ...
60
from __future__ import annotations from math import ceil, floor, sqrt def UpperCamelCase_( lowerCamelCase_ = 200_0000 ) -> int: _lowercase : list[int] = [0] _lowercase : int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ): triangle...
21
0
"""simple docstring""" from __future__ import annotations _a = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } class A_ : '''simple docstring''' def __init__( self , lo...
61
import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_available, is_vision_available ...
21
0
import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, load_tf_weights_in_mobilenet_va, ...
62
import random from typing import Any def UpperCamelCase_( lowerCamelCase_ ) -> list[Any]: for _ in range(len(lowerCamelCase_ ) ): _lowercase : Optional[int] = random.randint(0 , len(lowerCamelCase_ ) - 1 ) _lowercase : str = random...
21
0
'''simple docstring''' import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate lowerCAmelCase_ : int = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerro...
63
import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common impor...
21
0
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings A_ = r''' [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and can be used to control th...
64
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers im...
21
0
import warnings from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ ...
65
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer SCREAMING_SNAKE_CASE : Any = logging.get_logg...
21
0
"""simple docstring""" import tempfile import unittest from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from transformers.testing_utils import ( is_torch_available, require_optimum, require_torch, slow, ) if is_torch_available(): import torch @require_torch @require_optimum @sl...
66
def UpperCamelCase_( lowerCamelCase_ ) -> int: if not numbers: return 0 if not isinstance(lowerCamelCase_ , (list, tuple) ) or not all( isinstance(lowerCamelCase_ , lowerCamelCase_ ) for number in numbers ): raise ValueError('numbers must be an iterable o...
21
0
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def __lowerCAmelCase ( UpperCamelCase__ ) -> int: __lowerCamelCase = SwinConfig(image_size=1_92 ) if "base" i...
67
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass SCREAMING_SNAKE_CASE : Tuple = (3, 9, -11, 0, 7, 5, 1, -1) SCREAMING_SNAKE_CASE : Union[str, Any] = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class _lowe...
21
0
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, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_channel_dime...
68
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandinsky.text_encoder import ...
21
0
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
69
from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_...
21
0
'''simple docstring''' import os import string import sys A__ : str =1 << 8 A__ : Optional[int] ={ '''tab''': ord('''\t'''), '''newline''': ord('''\r'''), '''esc''': 27, '''up''': 65 + ARROW_KEY_FLAG, '''down''': 66 + ARROW_KEY_FLAG, '...
70
def UpperCamelCase_( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ) -> float: _lowercase : Tuple = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series return total def UpperCamelCase_( ) ...
21
0
import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging ...
71
import unittest from transformers import SqueezeBertConfig, 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 import ModelTesterMixin, ids_tensor, ...
21
0
"""simple docstring""" import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import evaluate import numpy as np from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForSe...
72
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class _lowerCamelCase( unittest.TestCase ): lowercase_ : Dict = JukeboxTokenizer lowercase_ : Dict = { """artist""": """Zac Brown Band""", """ge...
21
0
from math import ceil def SCREAMING_SNAKE_CASE__ ( lowerCamelCase__ = 1_0_0_1 ) -> int: __lowerCamelCase : Tuple = 1 for i in range(1 , int(ceil(n / 2.0 ) ) ): __lowerCamelCase : Any = 2 * i + 1 __lowerCamelCase : Tuple ...
73
import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffusers.utils import floats_tensor fr...
21
0
"""simple docstring""" import argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() _lowercase = logging.get_logger(__name_...
74
import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImageProcessor from diffusers.pipe...
21
0
'''simple docstring''' import os def a_ ( ) -> Union[str, Any]: """simple docstring""" lowerCamelCase_ =os.path.join(os.path.dirname(__snake_case ) , '''num.txt''' ) with open(__snake_case ) as file_hand: return str(sum(i...
75
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : List[str] = { "SenseTime/deformable-detr": "https://huggi...
21
0
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 DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils import logging logging.set_...
76
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) SCREAMING_SNAKE_CASE : List[str] = { "configuration_speech_to_text": ["SPEE...
21
0
"""simple docstring""" import unittest from transformers import SPIECE_UNDERLINE, ReformerTokenizer, ReformerTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_...
77
import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, ...
21
0
"""simple docstring""" from __future__ import annotations import pandas as pd def _lowerCAmelCase ( lowercase_ , lowercase_ , lowercase_ ): UpperCAmelCase = [0] * no_of_processes UpperCAmelCase = [0] * no_of_processes # Copy the burst time i...
78
import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device from diffusers.utils.testing_utils import en...
21
0
'''simple docstring''' def __lowercase ( __lowercase , __lowercase = False ) -> str: '''simple docstring''' if not isinstance(__lowercase , __lowercase ): _A = F'''Expected string as input, found {type(__lowercase )}''' ...
79
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def UpperCamelCase_( lowerCamelCase_ ) -> bool: _lowercase : int = int(number**0.5 ) return number == sq * sq def UpperCamelCase_( lowerCamelCase_ , lowerCam...
21
0
'''simple docstring''' import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CH...
80
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE : str = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP"...
21
0
"""simple docstring""" import argparse lowerCamelCase_ : int = """docs/source/_static/js/custom.js""" def _A ( lowercase ): """simple docstring""" with open(lowercase , encoding='''utf-8''' , newline='''\n''' ) as f: ...
81
from __future__ import annotations def UpperCamelCase_( lowerCamelCase_ ) -> bool: if len(lowerCamelCase_ ) < 2: raise ValueError('Monogons and Digons are not polygons in the Euclidean space' ) if any(i <= 0 for i in nums ): raise ValueError('All values must be greater tha...
21
0
from __future__ import annotations import math A__ = """2020.9.26""" A__ = """xcodz-dot, cclaus, dhruvmanila""" def _UpperCAmelCase ( snake_case , snake_case , snake_case , snake_case , snake_case ): """simple docstring""" if not all(isinst...
82
from __future__ import annotations from math import ceil, floor, sqrt def UpperCamelCase_( lowerCamelCase_ = 200_0000 ) -> int: _lowercase : list[int] = [0] _lowercase : int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ): triangle...
21
0
'''simple docstring''' import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configuration_pegasus import DEFAU...
83
import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_available, is_vision_available ...
21
0
"""simple docstring""" def _snake_case ( lowercase__ : str , lowercase__ : int ) -> str: '''simple docstring''' lowerCAmelCase_ :list[list[str]] = [[] for _ in range(lowercase__ )] lowerCAmelCase_ :Optional[Any] = key - 1 ...
84
import random from typing import Any def UpperCamelCase_( lowerCamelCase_ ) -> list[Any]: for _ in range(len(lowerCamelCase_ ) ): _lowercase : Optional[int] = random.randint(0 , len(lowerCamelCase_ ) - 1 ) _lowercase : str = random...
21
0
'''simple docstring''' def UpperCamelCase_( snake_case : int ): '''simple docstring''' snake_case_ = len(snake_case ) while cur > 1: # Find the maximum number in arr snake_case_ = arr.index(max(arr[0:cur] ...
85
import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common impor...
21
0
"""simple docstring""" from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def __lowerCAmelCase (_UpperCamelCase , _UpperCamelCase , _UpperCamelCase , _UpperCamelCase , ): __lowerCAmelCase , __lowerCAmelCase ...
86
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers im...
21
0
import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict UpperCamelCase = namedtuple( '''_TestCommandArgs''', [ ...
87
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer SCREAMING_SNAKE_CASE : Any = logging.get_logg...
21
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 .tokenization_barth...
88
def UpperCamelCase_( lowerCamelCase_ ) -> int: if not numbers: return 0 if not isinstance(lowerCamelCase_ , (list, tuple) ) or not all( isinstance(lowerCamelCase_ , lowerCamelCase_ ) for number in numbers ): raise ValueError('numbers must be an iterable o...
21
0
'''simple docstring''' def __lowerCamelCase ( lowerCAmelCase_ , lowerCAmelCase_ ) -> str: if number < 0 or shift_amount < 0: raise ValueError('both inputs must be positive integers' ) _a : Optional[int] = str(bin(lowerCAmelCase_ ) ) binary_number += ...
89
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass SCREAMING_SNAKE_CASE : Tuple = (3, 9, -11, 0, 7, 5, 1, -1) SCREAMING_SNAKE_CASE : Union[str, Any] = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class _lowe...
21
0
from math import pi, sqrt def lowerCamelCase_ ( UpperCamelCase__ : float ) -> float: """simple docstring""" if num <= 0: raise ValueError('math domain error' ) if num > 1_71.5: raise OverflowError('math range e...
90
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandinsky.text_encoder import ...
21
0
"""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/LIC...
91
from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_...
21
0
from __future__ import annotations UpperCamelCase__ = 1.6021E-19 # units = C def _a ( SCREAMING_SNAKE_CASE_ : float , SCREAMING_SNAKE_CASE_ : float , SCREAMING_SNAKE_CASE_ : float , ): if (conductivity, electron_conc, mobilit...
92
def UpperCamelCase_( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ) -> float: _lowercase : Tuple = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series return total def UpperCamelCase_( ) ...
21
0
'''simple docstring''' import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap _lowercase : Union[str, Any] = "Usage of script: script_name <size_of_canvas:int>" _lowercase : Union[str, Any] = ...
93
import unittest from transformers import SqueezeBertConfig, 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 import ModelTesterMixin, ids_tensor, ...
21
0
def __lowerCamelCase ( UpperCAmelCase_ : int = 1000 ): """simple docstring""" a , a :int = 1, 1 a :Any = 2 while True: a :Optional[int] = 0 a :str = fa + fa ...
94
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class _lowerCamelCase( unittest.TestCase ): lowercase_ : Dict = JukeboxTokenizer lowercase_ : Dict = { """artist""": """Zac Brown Band""", """ge...
21
0
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) class __lowerCAmelCase ( UpperCamelCase__): def __init__( self , *...
95
import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffusers.utils import floats_tensor fr...
21
0
"""simple docstring""" import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def _snake_case ( lowercase__ ): _lowerCamelCase : Dict = [ 'decoder.version', ...
96
import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImageProcessor from diffusers.pipe...
21
0
'''simple docstring''' import unittest from dataclasses import dataclass import pytest from accelerate.commands.config.config_args import SageMakerConfig from accelerate.utils import ComputeEnvironment from accelerate.utils.launch import _convert_nargs_to_dict @dataclass class lowercase ( A__ ): ""...
97
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : List[str] = { "SenseTime/deformable-detr": "https://huggi...
21
0
"""simple docstring""" import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import List import timm import torch import torch.nn as nn from huggingface_hub import hf_hub_download from torch import Tensor from transformers import ...
98
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) SCREAMING_SNAKE_CASE : List[str] = { "configuration_speech_to_text": ["SPEE...
21
0
import gc import unittest from transformers import CTRLConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTes...
99
import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, ...
21
0
"""simple docstring""" import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import numpy as np from utils_multiple_choice import MultipleChoiceDataset, Split, processors import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice, ...
100
import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device from diffusers.utils.testing_utils import en...
21
0
import os import unittest from transformers import MobileBertTokenizer, MobileBertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils import...
101
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def UpperCamelCase_( lowerCamelCase_ ) -> bool: _lowercase : int = int(number**0.5 ) return number == sq * sq def UpperCamelCase_( lowerCamelCase_ , lowerCam...
21
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import DebertaVaConfig, 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, r...
102
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE : str = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP"...
21
0
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before toke...
103
from __future__ import annotations def UpperCamelCase_( lowerCamelCase_ ) -> bool: if len(lowerCamelCase_ ) < 2: raise ValueError('Monogons and Digons are not polygons in the Euclidean space' ) if any(i <= 0 for i in nums ): raise ValueError('All values must be greater tha...
21
0
'''simple docstring''' import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class lowercase_ ...
104
from __future__ import annotations from math import ceil, floor, sqrt def UpperCamelCase_( lowerCamelCase_ = 200_0000 ) -> int: _lowercase : list[int] = [0] _lowercase : int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ): triangle...
21
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_funnel import FunnelTokenizer a : str = logging.get...
105
import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_available, is_vision_available ...
21
0
"""simple docstring""" import cva import numpy as np class SCREAMING_SNAKE_CASE : """simple docstring""" def __init__( self : str ,lowercase_ : float ,lowercase_ : int ): if k in (0.04, 0.06): lowerCAmelCase__ : Optional[Any] = k...
106
import random from typing import Any def UpperCamelCase_( lowerCamelCase_ ) -> list[Any]: for _ in range(len(lowerCamelCase_ ) ): _lowercase : Optional[int] = random.randint(0 , len(lowerCamelCase_ ) - 1 ) _lowercase : str = random...
21
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, is_vision_available, ) __lowerCAmelCase : List[str] = {'processing_layoutxlm': ['LayoutXLMProcessor'...
107
import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common impor...
21
0
"""simple docstring""" from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass lowerCAmelCase__ = (3, 9, -11, 0, 7, 5, 1, -1) lowerCAmelCase__ = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class SCREAMING_SNAKE_CASE__ : ...
108
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers im...
21
0
"""simple docstring""" from collections import defaultdict from math import ceil, sqrt def _snake_case ( UpperCamelCase : int = 1000000 , UpperCamelCase : int = 10 ): UpperCAmelCase : defaultdict = defaultdict(UpperCamelCase ) for outer_width in range(3 , (t_limit...
109
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer SCREAMING_SNAKE_CASE : Any = logging.get_logg...
21
0
import os from math import logaa def _a ( SCREAMING_SNAKE_CASE = "base_exp.txt" ): """simple docstring""" lowercase__ = 0 lowercase__ = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(SCREAMING_SNAKE_CASE ) , SCREAMING_...
110
def UpperCamelCase_( lowerCamelCase_ ) -> int: if not numbers: return 0 if not isinstance(lowerCamelCase_ , (list, tuple) ) or not all( isinstance(lowerCamelCase_ , lowerCamelCase_ ) for number in numbers ): raise ValueError('numbers must be an iterable o...
21
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCAmelCase = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except Optiona...
126
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass SCREAMING_SNAKE_CASE : Tuple = (3, 9, -11, 0, 7, 5, 1, -1) SCREAMING_SNAKE_CASE : Union[str, Any] = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class _lowe...
21
0
import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteria, MaxNewT...
343
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandinsky.text_encoder import ...
21
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase : Dict = { "configuration_biogpt": ["BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BioGptConfig"], "tokenization_biogpt": ["BioGptTokeni...
280
from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_...
21
0
"""simple docstring""" def __magic_name__ ( lowercase , lowercase ): if a < 0 or b < 0: raise ValueError("""the value of both inputs must be positive""" ) SCREAMING_SNAKE_CASE_: int =str(bin(lowerCamelCase_ ) )[2:] # remove the leading "0b" SC...
173
def UpperCamelCase_( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ) -> float: _lowercase : Tuple = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series return total def UpperCamelCase_( ) ...
21
0
import json import os import tempfile import unittest import numpy as np from datasets import load_dataset 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 ImageProcessin...
209
import unittest from transformers import SqueezeBertConfig, 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 import ModelTesterMixin, ids_tensor, ...
21
0
import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from...
29
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class _lowerCamelCase( unittest.TestCase ): lowercase_ : Dict = JukeboxTokenizer lowercase_ : Dict = { """artist""": """Zac Brown Band""", """ge...
21
0
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ) -> List[str]: _enforce_args(lowerCamelCase_ , lowerCamelCase_ ) if n == 0: return 0 lowerCAmelCase__ : Union[str, Any] = float('-inf' ) for i in range(1 , ...
212
import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffusers.utils import floats_tensor fr...
21
0
# flake8: noqa # Lint as: python3 lowerCAmelCase__ :int = [ "VerificationMode", "Version", "disable_progress_bar", "enable_progress_bar", "is_progress_bar_enabled", "experimental", ] from .info_utils import VerificationMode from .logging import disable_progress_bar, enable_progre...
329
import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImageProcessor from diffusers.pipe...
21
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from t...
187
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE : int = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : List[str] = { "SenseTime/deformable-detr": "https://huggi...
21
0
'''simple docstring''' 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, ...
97
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) SCREAMING_SNAKE_CASE : List[str] = { "configuration_speech_to_text": ["SPEE...
21
0
"""simple docstring""" from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu...
293
import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, ...
21
0
"""simple docstring""" import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from transformers.mode...
126
import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device from diffusers.utils.testing_utils import en...
21
0
import argparse import collections import os import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_table.py _SCREAMING_SNAKE_CASE = "src/transformers" _SCREAMING_SNA...
343
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def UpperCamelCase_( lowerCamelCase_ ) -> bool: _lowercase : int = int(number**0.5 ) return number == sq * sq def UpperCamelCase_( lowerCamelCase_ , lowerCam...
21
0
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def _SCREAMING_SNAKE_CASE ( ) -> Any: __A : Dict = ArgumentParser( description=( 'PyTorch TPU...
280
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE : str = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP"...
21
0
"""simple docstring""" from math import factorial _UpperCAmelCase = {str(d): factorial(d) for d in range(1_0)} def __magic_name__ ( lowercase ): return sum(DIGIT_FACTORIAL[d] for d in str(lowerCamelCase_ ) ) def __magic_name__ ( ): SCREAMIN...
173
from __future__ import annotations def UpperCamelCase_( lowerCamelCase_ ) -> bool: if len(lowerCamelCase_ ) < 2: raise ValueError('Monogons and Digons are not polygons in the Euclidean space' ) if any(i <= 0 for i in nums ): raise ValueError('All values must be greater tha...
21
0
# 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-2.0 # # Unless required b...
209
from __future__ import annotations from math import ceil, floor, sqrt def UpperCamelCase_( lowerCamelCase_ = 200_0000 ) -> int: _lowercase : list[int] = [0] _lowercase : int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ): triangle...
21
0
from __future__ import annotations from scipy.special import comb # type: ignore class lowerCamelCase : '''simple docstring''' def __init__( self , _UpperCamelCase ) -> Tuple: UpperCAmelCase_ : Optional[Any] = li...
29
import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_available, is_vision_available ...
21
0
import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import evaluate import numpy as np from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForSequenceClassifica...
212
import random from typing import Any def UpperCamelCase_( lowerCamelCase_ ) -> list[Any]: for _ in range(len(lowerCamelCase_ ) ): _lowercase : Optional[int] = random.randint(0 , len(lowerCamelCase_ ) - 1 ) _lowercase : str = random...
21
0
import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase__ ( a__: Tuple ) -> float: '''simple docstring''' return np.dot(lowerCamelCase_ , lowerCamelCase_ ) class __a : def __init__( self...
329
import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common impor...
21
0
from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ....
187
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers im...
21
0
'''simple docstring''' class lowercase : """simple docstring""" def __init__( self ): '''simple docstring''' UpperCamelCase__ :Union[str, Any] = {} def lowerCAmelCase__ ( self ): '''simple docstring''' print(self.vertex ) ...
97
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer SCREAMING_SNAKE_CASE : Any = logging.get_logg...
21
0
"""simple docstring""" import json import os import shutil import warnings from argparse import ArgumentParser, Namespace from pathlib import Path from typing import List from ..utils import logging from . import BaseTransformersCLICommand try: from cookiecutter.main import cookiecutter __A ...
293
def UpperCamelCase_( lowerCamelCase_ ) -> int: if not numbers: return 0 if not isinstance(lowerCamelCase_ , (list, tuple) ) or not all( isinstance(lowerCamelCase_ , lowerCamelCase_ ) for number in numbers ): raise ValueError('numbers must be an iterable o...
21
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase = { "configuration_llama": ["LLAMA_PRETRAINED_CO...
126
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass SCREAMING_SNAKE_CASE : Tuple = (3, 9, -11, 0, 7, 5, 1, -1) SCREAMING_SNAKE_CASE : Union[str, Any] = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class _lowe...
21
0
from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor, ra...
343
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandinsky.text_encoder import ...
21
0
from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def _SCREAMING_SNAKE_CASE ( a , a , a , a , ) -> list[float]: __A : Union[str, Any] = coefficient_matrix.shape __A : ...
280
from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_...
21
0
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config impor...
173
def UpperCamelCase_( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ) -> float: _lowercase : Tuple = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series return total def UpperCamelCase_( ) ...
21
0
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def lowerCAmelCase__(__snake_case ,__snake_case ,__snake_case ,__snake_case ,__snake_case = None ,__snake_case = None ,_...
209
import unittest from transformers import SqueezeBertConfig, 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 import ModelTesterMixin, ids_tensor, ...
21
0
def lowercase__ ( __snake_case : List[Any] = 100 ): '''simple docstring''' UpperCAmelCase_ : int = set() UpperCAmelCase_ : str = 0 UpperCAmelCase_ : int = n + 1 # maximum li...
29
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class _lowerCamelCase( unittest.TestCase ): lowercase_ : Dict = JukeboxTokenizer lowercase_ : Dict = { """artist""": """Zac Brown Band""", """ge...
21
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) lowerCamelCase__ = { "configuration_speech_to_text": ["SPEECH_TO_TEXT_PRETR...
212
import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffusers.utils import floats_tensor fr...
21
0
from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import floats_tensor, ids_tensor, ra...
329
import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImageProcessor from diffusers.pipe...
21
0