code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __a = logging.get_logger(__name__) __a = {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/config.json'} class __a( _a ): """simple docstring""" lowerCAmelCase ...
30
'''simple docstring''' # Copyright (c) 2021-, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses...
350
0
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, log...
169
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 ): ...
169
1
import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weights from .dataclasses import BnbQua...
216
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def _snake_case ( lowerCAmelCase : str , lowerCAmelCase : complex , lowerCAmelCase : str = "x" , lowerCAmelCase : float = 1_0**-1_0 , lowerCAmelCase : int = 1 , ): """simple do...
216
1
import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoFeatureExtractor, WavaVecaFeatureExtractor from transformers.testing_utils import TOKEN,...
495
from scipy.stats import spearmanr import datasets lowerCamelCase__ : Union[str, Any] = """ 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 correlation...
495
1
'''simple docstring''' from string import ascii_lowercase, ascii_uppercase def lowerCamelCase (_SCREAMING_SNAKE_CASE : str ): if not sentence: return "" __a : Optional[int] = dict(zip(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) ) return lower_to_upp...
476
'''simple docstring''' from math import ceil def lowerCamelCase (_SCREAMING_SNAKE_CASE : int = 1_001 ): __a : Union[str, Any] = 1 for i in range(1 , int(ceil(n / 2.0 ) ) ): __a : Optional[Any] = 2 * i + 1 __a : Dict ...
476
1
class lowerCAmelCase_ : '''simple docstring''' def __init__( self , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ): SCREAMING_SNAKE_CASE_ : List[str] =None SCREAMING_SNAKE_CASE_ : Any =None ...
153
import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging __SCREAMING_SNAKE_CASE = logging.get_logger(__name__) __SCREAMING_SNAKE_CASE = { 'RUCAIBox/mvp': 'https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json', } class lowerCAmelCase_ ( ...
153
1
'''simple docstring''' import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer A_ : ...
38
"""simple docstring""" from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=snake_case__ ) class __UpperCAmelCase ( snake_case__ ): """simple docstring""" _snake_case :...
505
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 UpperCamelCase =[ "Prosecutor: \"No videos were used in the crash investigation\" German papers say they saw a cell p...
543
'''simple docstring''' from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand UpperCamelCase =logging.get_logger(__name__) # pylint: disable=invalid-name def ...
543
1
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ = '''https://openaipu...
151
"""simple docstring""" import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import VideoMAEConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device f...
255
0
import functools from typing import Any def A ( _lowerCamelCase , _lowerCamelCase ): '''simple docstring''' if not isinstance(lowerCamelCase_ , lowerCamelCase_ ) or len(lowerCamelCase_ ) == 0: raise ValueError("the string s...
713
from __future__ import annotations from collections.abc import MutableSequence class UpperCAmelCase_ : def __init__( self, __a, __a): '''simple docstring''' if len(__a) != degree + 1: raise ValueError( ...
658
0
import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, DistilBertConfig, DistilBertForMaskedLM...
544
from datetime import datetime import requests from bsa import BeautifulSoup if __name__ == "__main__": A = input('Enter image url: ').strip() print(F'''Downloading image from {url} ...''') A = BeautifulSoup(requests.get(url).content, 'html.parser') # The image URL is in the cont...
544
1
"""simple docstring""" import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, require...
282
"""simple docstring""" import string def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' __lowerCAmelCase = "" for i in sequence: __lowerCAmelCase = ord(_UpperCamelCase ) if 65 <= extract <= 90: output += chr(155 - extract ) ...
282
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available SCREAMING_SNAKE_CASE__ = { '''configuration_bridgetower''': [ '''BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BridgeTowerC...
47
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from timm import create_model from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers im...
556
0
import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap lowerCAmelCase__ = "Usage of script: script_name <size_of_canvas:int>" lowerCAmelCase__ = [0] * 1_0_0 + [1] * 1_0 random.shuffle(choice) def __lowerCamelCase ( ...
701
import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print("Googling.....") lowerCAmelCase__ = "https://www.google.com/search?q=" + " ".join(sys.argv[1:]) lowerCAmelCase__ = requests.get(url, header...
594
0
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { 'naver-clova-ix/donut-base': 'https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json', # See all Donut models at https://hugging...
132
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { 'weiweishi/roc-bert-base-zh': 'https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json', } class _SCREAMING_SNAKE_CASE ( ...
132
1
'''simple docstring''' import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging A_ : List[str] =logging.get_logger(__name__) def snake_case_ ( __snake_case : int) -> int: lowerCAme...
707
'''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 imp...
606
0
'''simple docstring''' from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def _SCREAMING_SNAKE_CASE (A , A , A = "x" , A = 10**-10 , A = 1 , ) -> complex: """simple docstring""" lowercase__ = symbols(A )...
460
'''simple docstring''' import unittest import numpy as np def _SCREAMING_SNAKE_CASE (A , A , A , A = None , ) -> np.ndarray: """simple docstring""" lowercase__ = np.shape(A ) lowercase__ = np.shape(A ) lowercase__ ...
460
1
'''simple docstring''' import logging import math from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union import torch from .tensor_utils import tensor_tree_map, tree_map def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : ...
712
'''simple docstring''' from collections.abc import Iterable from typing import Any class __a : def __init__( self : Optional[Any] , __magic_name__ : int | None = None ) -> Tuple: """simple docstring""" Uppe...
644
0
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __magic_name__ = logging.get_logger(__name__) __magic_name__ = { "vocab_file": "vocab.json", "merges_f...
254
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer __magic_name__ = logging.get_logger(__name__) __magic_name__ = ...
254
1
"""simple docstring""" from manim import * class a__ ( a_ ): def __magic_name__ ( self ): lowercase : Union[str, Any] = Rectangle(height=0.5 , width=0.5 ) lowercase : Dict = Rectangle(height=0.2_5 , width=0....
518
"""simple docstring""" 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,...
518
1
'''simple docstring''' import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=__SCREAMING_SNAKE_CASE ) class _UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): ...
577
import itertools import math def UpperCAmelCase ( a_ ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3...
55
0
'''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, ) _lowerCamelCase = { 'configuration_owlv...
721
'''simple docstring''' import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedC...
572
0
import argparse import copy def lowerCamelCase__ ( lowercase ): """simple docstring""" SCREAMING_SNAKE_CASE : Tuple = {} with open(lowercase ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: SCREAMING_SNAKE_CASE : Li...
62
"""simple docstring""" def _A (__a ) -> list[list]: """simple docstring""" SCREAMING_SNAKE_CASE_ : int = current_set.copy() for row_index, row in enumerate(__a ): SCREAMING_SNAKE_CASE_ : Tuple = row[0] for column_index, co...
512
0
"""simple docstring""" import os import unittest from transformers import LayoutLMTokenizer, LayoutLMTokenizerFast from transformers.models.layoutlm.tokenization_layoutlm import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import Toke...
718
"""simple docstring""" from __future__ import annotations __snake_case = list[tuple[int, int]] __snake_case = [ [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, ...
117
0
from collections.abc import Sequence def lowerCamelCase_ ( lowerCAmelCase__ : Sequence[int] | None = None ) -> int: '''simple docstring''' if nums is None or not nums: raise ValueError('Input sequence should not be empty' ) A = n...
106
'''simple docstring''' import argparse import collections import json from pathlib import Path import requests import torch import yaml from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTImageProcessor, MobileViTVaConfig, MobileViTVaForImageClassi...
51
0
"""simple docstring""" import os import numpy import onnx def UpperCamelCase_ ( lowerCAmelCase__ : str , lowerCAmelCase__ : Any ) -> Any: """simple docstring""" lowerCAmelCase_ : Optional[Any] = a.name lowerCAme...
712
"""simple docstring""" from __future__ import annotations import bisect def UpperCamelCase_ ( lowerCAmelCase__ : list[int] , lowerCAmelCase__ : int , lowerCAmelCase__ : int = 0 , lowerCAmelCase__ : int = -1 ) -> in...
317
0
def lowercase__ ( _UpperCamelCase , _UpperCamelCase) -> float: """simple docstring""" if digit_amount > 0: return round(number - int(_UpperCamelCase) , _UpperCamelCase) return number - int(_UpperCamelCase) if __name__ == "__main__": ...
280
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging __magic_name__ : Optional[int] = logging.get_logger(__name__) def lowercase__ ( _UpperCamelCase) -> Dict: ""...
280
1
from collections import Counter from timeit import timeit def lowerCamelCase ( SCREAMING_SNAKE_CASE = "" , ): '''simple docstring''' return sum(c % 2 for c in Counter(input_str.replace(''' ''' , '''''' ).lower() ).values() ) < 2 def lowerCamelCase ( SCREAMING...
452
import os import unittest from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer from transformers.testing_utils import require_jieba, tooslow from ...test_tokenization_common import TokenizerTesterMixin @require_jieba class lowerCamelCase_ ( UpperCAmelCase_ , unitt...
452
1
"""simple docstring""" from . import ( albert, align, altclip, audio_spectrogram_transformer, auto, autoformer, bark, bart, barthez, bartpho, beit, bert, bert_generation, bert_japanese, bertweet, big_bird, bigb...
549
"""simple docstring""" from scipy.stats import pearsonr import datasets _SCREAMING_SNAKE_CASE : List[str] = ''' Pearson correlation coefficient and p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two dat...
549
1
print((lambda quine: quine % quine)("print((lambda quine: quine %% quine)(%r))"))
334
import argparse import json import os import torch from transformers.file_utils import has_file from diffusers import UNetaDConditionModel, UNetaDModel __A : Tuple = False __A : Optional[int] = True __A : Optional[Any] = False if __name__ == "__main__": __A : Any = argpar...
334
1
import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) fro...
23
"""simple docstring""" def __SCREAMING_SNAKE_CASE ( A_ ): for i in range(len(A_ ) - 1 , 0 , -1 ): lowerCAmelCase__ : Optional[Any] = False for j in range(A_ , 0 , -1 ): if unsorted[j] < unsorted[j - 1]: lowerCAmelCase__ ,lowerCAmelCase__ : ...
450
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE_ = {'''configuration_mba...
579
"""simple docstring""" from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class ...
579
1
'''simple docstring''' import re import string import numpy as np import datasets _A : List[Any] = ''' Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. ''' _A : List[Any] = ...
427
'''simple docstring''' import math def UpperCamelCase_ ( snake_case_ : float , snake_case_ : float ) -> float: '''simple docstring''' if initial_intensity < 0: raise ValueError("""The value of intensity cannot be negative""" ) # handling of negative values o...
427
1
"""simple docstring""" # This model implementation is heavily inspired by https://github.com/haofanwang/ControlNet-for-Diffusers/ import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer ...
718
"""simple docstring""" def __UpperCamelCase ( snake_case__ , snake_case__ , snake_case__ ): return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(snake_case__ ) ) def __UpperCamelCase ( snake_case__ , snake_case__ , snak...
480
0
"""simple docstring""" import re def __UpperCAmelCase ( lowercase ): """simple docstring""" _UpperCAmelCase = re.compile( R"""^(?:0|94|\+94|0{2}94)""" R"""7(0|1|2|4|5|6|7|8)""" R"""(-| |)""" R"""\d{7}$""" ) return bool(re.search(snake_case__ ,snake_case__ ) ) if...
277
import string from math import logaa def snake_case ( snake_case__ :str , snake_case__ :str) -> int: _A = document.translate( str.maketrans("""""" , """""" , string.punctuation)).replace("""\n""" , """""") _A = document_with...
401
0
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCamelCase : List[Any] = logging.get_logger(__name__) UpperCamelCase : Optional[Any] = { "ut/deta": "https://huggingfa...
705
"""simple docstring""" import numpy as np import qiskit def A ( snake_case :int = 8 , snake_case :int | None = None ) -> str: __UpperCamelCase = np.random.default_rng(seed=snake_case ) # Roughly 25% of the qubits will contribute to the key. # So we take more than...
293
0
from manim import * class lowerCamelCase ( SCREAMING_SNAKE_CASE ): def snake_case_ ( self : Optional[Any] ) -> Optional[Any]: _a : List[Any] = Rectangle(height=0.5 , width=0.5 ) _a : Dict = Rectangle(height=0.46 ,...
471
from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets __UpperCAmelCase : List[str] = '\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding},\n author={Wang, ...
471
1
"""simple docstring""" from __future__ import annotations def _lowerCamelCase( a , a , a ): __a = list(range(len(a ) ) ) __a = [v / w for v, w in zip(a , a )] index.sort(key=lambda a : ratio[i] , ...
67
"""simple docstring""" from .imports import is_rich_available if is_rich_available(): from rich.traceback import install install(show_locals=False) else: raise ModuleNotFoundError("""To use the rich extension, install rich with `pip install rich`""")
67
1
"""simple docstring""" def __lowercase ( _a ): snake_case_ : Union[str, Any] = [] snake_case_ : Tuple = [] snake_case_ : Dict = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, '-': 1, } # Priority o...
123
import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel _lowercase : Dict =HfApi() _lowercase : str ={} # fmt: off _lowercase : Union[str, Any] =torch.tensor([ -0.7515, -1.6883, 0.2420, 0.0300, 0.6347, 1.3433, -1.1...
364
0
'''simple docstring''' import math import sys import cva import numpy as np def __UpperCamelCase ( a : np.ndarray , a : float ) ->np.ndarray: # For applying gaussian function for each element in matrix. snake_case = math.sqrt(a ) snake_case = 1 / (sigma * math.sqrt(2 *...
717
'''simple docstring''' from ..utils import DummyObject, requires_backends class _lowercase ( metaclass=__a ): _UpperCAmelCase = ['''transformers''', '''torch''', '''note_seq'''] def __init__( self , *A__ , **A__ ) -> Union...
44
0
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _A ( unittest.TestCase ...
518
import glob import os import random from string import ascii_lowercase, digits import cva a = "" a = "" a = "" a = 1 # (0 is vertical, 1 is horizontal) def _SCREAMING_SNAKE_CASE ( ) -> None: _UpperCAmelCase , ...
518
1
'''simple docstring''' import argparse import json from collections import OrderedDict import torch from huggingface_hub import cached_download, hf_hub_url from transformers import AutoImageProcessor, CvtConfig, CvtForImageClassification def a(lowercase__ ): '''simple docstring''' snake_case_ ...
717
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 VQDiffusionScheduler from ...utils i...
46
0
def _a ( a :List[str] , a :Optional[int] ) -> Union[str, Any]: # "extended trapezoidal rule" # int(f) = dx/2 * (f1 + 2f2 + ... + fn) a = (boundary[1] - boundary[0]) / steps a = boundary[0] a = boundary[1] a = make_points(sn...
117
"""simple docstring""" import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def _snake_case ( ): with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT ): with p...
91
0
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary # Register SEW's fairseq modules from sew_asapp import tasks # noqa: F401 from transformers import ( SEWConfig, SEWForCTC, SEWModel, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVeca...
462
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase ={ "configuration_mobilebert": [ "MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MobileBertCon...
462
1
'''simple docstring''' from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration __lowerCamelCase = HfArgumentParser(InitializationArguments) __lowerCamelCase = parser.parse_args() # Load ...
288
'''simple docstring''' import inspect import unittest from transformers import SegformerConfig, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTeste...
288
1
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() a = logging.get_logger("""transformers.models.speecht5""") def UpperCamelCase_( __magic_name__ : Tuple , ...
708
from __future__ import annotations from math import pow, sqrt def UpperCamelCase_( __magic_name__ : float , __magic_name__ : float , __magic_name__ : float ): """simple docstring""" if (resistance, reactance, impedance).count(0 ) != 1: ...
382
0
"""simple docstring""" from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class __lowerCamelCase : a__: List[str] a__: Optional[str] ...
29
"""simple docstring""" 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 i...
29
1
'''simple docstring''' import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils im...
702
'''simple docstring''' from __future__ import annotations import time a : Dict = list[tuple[int, int]] a : int = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0...
593
0
import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from transformers.utils im...
14
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class lowercase__( _UpperCAmelCa...
698
0
'''simple docstring''' import argparse import importlib from pathlib import Path # Test all the extensions added in the setup __lowerCamelCase : Optional[int] = [ "kernels/rwkv/wkv_cuda.cu", "kernels/rwkv/wkv_op.cpp", "kernels/deformable_detr/ms_deform_attn.h", "kernels/deformable_d...
459
'''simple docstring''' import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset __lowerCamelCase : Any = {1: (1, 1), 2: (2, 1), 3: (3, 1), 4: (2,...
459
1
'''simple docstring''' import unittest from transformers import DonutProcessor __A : List[Any] = 'naver-clova-ix/donut-base' class __UpperCamelCase ( unittest.TestCase ): def a__ ( self :str ): snake_case_ : Dict = DonutProcessor.fro...
334
'''simple docstring''' import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig __A : List[Any] = { 'facebook/maskformer-swin-ba...
334
1
'''simple docstring''' from manim import * class a ( SCREAMING_SNAKE_CASE ): """simple docstring""" def __magic_name__ ( self : Dict ): '''simple docstring''' snake_case__ : List[str] = Rectangle(heigh...
502
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": lowerCAmelCase__ : Dict = argparse.ArgumentParser() parser.add_argum...
502
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, PNDMScheduler, StableDiffusionLDMaDPipeline, UNetaDConditi...
104
"""simple docstring""" SCREAMING_SNAKE_CASE__ : Optional[Any] ={ 'a': 'AAAAA', 'b': 'AAAAB', 'c': 'AAABA', 'd': 'AAABB', 'e': 'AABAA', 'f': 'AABAB', 'g': 'AABBA', 'h': 'AABBB', 'i': 'ABAAA', 'j': 'BBBAA', 'k': 'ABAAB', 'l': 'ABABA', 'm': 'AB...
434
0
"""simple docstring""" import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class __magic_name__ ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , _...
533
"""simple docstring""" def a__ ( snake_case__ ) -> list: if n_term == "": return [] lowerCamelCase = [] for temp in range(int(snake_case__ ) ): series.append(F'1/{temp + 1}' if series else """1""" ) return series if __name__ == "_...
533
1
import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from transformers import Gra...
235
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 @slow class Uppe...
568
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...tes...
31
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def _SCREAMING_SNAKE_CASE ( _lowercase : List[str] ) ->int: ...
31
1
import re import tempfile from pathlib import Path import pytest import yaml from datasets.utils.readme import ReadMe # @pytest.fixture # def example_yaml_structure(): SCREAMING_SNAKE_CASE_ = yaml.safe_load( '\\nname: ""\nallow_empty: false\nallow_empty_text: true\nsubsections:\n - name: "Dataset...
300
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger __lowerCamelCase : str = get_logger(__name__) class a__ ( enum.Enum ): A = 'all_checks' A = 'basic_checks' A ...
216
0
'''simple docstring''' from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class A ( _a ): ...
721
'''simple docstring''' import sys from collections import defaultdict class A : def __init__( self : Optional[Any] ) -> Union[str, Any]: """simple docstring""" _a = [] def ...
377
0
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class A (datasets.BeamBasedBuilder ): '''simple docstring''' def a_ (...
176
def __lowerCamelCase ( __a :str ) -> bool: """simple docstring""" A__ = 0 for ch in input_str: A__ = ord(__a ) A__ = pow(2 , __a ) # If we already turned on bit for current character's unicode if bitmap >>...
176
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCAmelCase_ = { 'configuration_altclip': [ 'ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'AltCLIPConfig', 'AltCLIPTextConf...
596
from pathlib import Path import fire from tqdm import tqdm def snake_case( __magic_name__="ro" , __magic_name__="en" , __magic_name__="wmt16" , __magic_name__=None ) -> None: '''simple docstring''' try: import datasets ...
596
1
def __lowerCamelCase ( UpperCAmelCase_ : str ): """simple docstring""" return "".join(chr(ord(__A ) - 32 ) if '''a''' <= char <= '''z''' else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
445
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor UpperCamelCase__ = logging.get_logger(__name__) class __snake_case ( snake_case__ ): """simple docstring""" def __init__( self , *_UpperCamelCase ...
268
0
'''simple docstring''' import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table import table_ca...
713
'''simple docstring''' from typing import Any class a : '''simple docstring''' def __init__( self , lowerCamelCase_ ) -> Dict: _a : int = data _a : Any = None def __repr__( self ) -> str: return F'''Node({self....
424
0
'''simple docstring''' import argparse import os from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_task_guides.py _SCREAMING_SNAKE_CASE = """src/...
502
'''simple docstring''' import math import qiskit def _a ( lowerCamelCase_ = 1 , lowerCamelCase_ = 1 , lowerCamelCase_ = 1 ): if ( isinstance(lowerCamelCase_ , lowerCamelCase_ ) or isinstance(lowerCamelCase_ , lowerCamelCase_ ) or isinstance(lowerCamelCase_ ,...
349
0
from __future__ import annotations def _a ( UpperCAmelCase = 4 ) -> list[list[int]]: """simple docstring""" lowerCamelCase__ : str = abs(UpperCAmelCase ) or 4 return [[1 + x + y * row_size for x in range(UpperCAmelCase )] for y in range(UpperCAmelCase ...
130
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): _UpperCAmelCase : Any = ["image_processor", "tokenizer"] _UpperCAmelCase : Dict =...
130
1
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging A = logging.get_logger(__name__) def lowerCamelCase ( UpperCamelCase : Dict , UpperCamelCase : Union[str, Any] ) -> Optional[i...
544
import math from datetime import datetime, timedelta def __magic_name__ ( __lowerCAmelCase : int ) -> datetime: __lowerCamelCase = year % 19 __lowerCamelCase = year % 4 __lowerCamelCase = year % 7 __lowerCamelCase = mat...
298
0
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 _lowercase : Dict...
661
import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLICommand if not is_tf_available()...
661
1
import csv from collections import defaultdict from dataclasses import dataclass, field from typing import List, Optional import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import ScalarFormatter from transformers import HfArgumentParser def a_ ( UpperCamelCas...
246
'''simple docstring''' import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on imp...
133
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( Diffus...
480
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
480
1
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from timm import create_model from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transfor...
160
"""simple docstring""" import argparse import torch from transformers import FunnelBaseModel, FunnelConfig, FunnelModel, load_tf_weights_in_funnel from transformers.utils import logging logging.set_verbosity_info() def _snake_case ( UpperCamelCase : List[str] , UpperCamelCase : Any ...
160
1
'''simple docstring''' def _lowerCAmelCase (): """simple docstring""" return [ a * b * (10_00 - a - b) for a in range(1 , 9_99 ) for b in range(_lowercase , 9_99 ) if (a * a + b * b == (10_00 - a - b) ** 2) ...
716
'''simple docstring''' import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single...
394
0
"""simple docstring""" from collections import defaultdict from math import ceil, sqrt def lowercase_ ( __UpperCAmelCase = 100_0000 , __UpperCAmelCase = 10 ) -> int: lowerCAmelCase__ : defaultdict = defaultdict(__UpperCAmelCase ) for outer_width in range(3...
299
# Copyright (c) 2021-, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
170
0
import unittest from transformers.testing_utils import require_bsa from transformers.utils import is_bsa_available from ...test_feature_extraction_common import FeatureExtractionSavingTestMixin if is_bsa_available(): from transformers import MarkupLMFeatureExtractor class _A( unittest.TestCase...
77
from __future__ import annotations import math def _SCREAMING_SNAKE_CASE ( a , a ) -> list: if len(a ) != 2 or len(a[0] ) != 2 or len(a ) != 2 or len(b[0] ) != 2: raise Exception('Matrices are not 2x2' ) __A : Optional[int] ...
77
1
'''simple docstring''' from __future__ import annotations def __snake_case (__UpperCAmelCase ): """simple docstring""" lowerCamelCase_ : Optional[int] = len(__UpperCAmelCase ) # We need to create solution object to save path. lowerCamelCase_ : Optional[int] ...
501
'''simple docstring''' import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def __snake_case (__UpperCAmelCase , __UpperCAmelCase=7 ): """simple docstring""" lowerCamelCase_ : List[Any] = None if tok...
501
1
"""simple docstring""" from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. a : Any = 200 # Number of elements selected in every generation of evolution. The selection takes # place...
85
"""simple docstring""" from __future__ import annotations def lowercase__(A ) ->list[int]: # This function is recursive """simple docstring""" lowercase__ : int= len(A ) # If the array contains only one element, we return it (...
85
1
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from diffusers.utils import ...
428
import functools def UpperCamelCase__ ( lowerCAmelCase__ ,lowerCAmelCase__ ): lowercase = len(lowerCAmelCase__ ) lowercase = len(lowerCAmelCase__ ) @functools.cache def min_distance(lowerCAmelCase__ ,lowerCAmelCase__ ) -> int: # if first word in...
428
1
import unittest from transformers import SPIECE_UNDERLINE from transformers.models.speechta import SpeechTaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.tokenization_utils import AddedToken from ...test_tokenization_common ...
698
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BertTokenizer, Bl...
698
1
from __future__ import annotations import math def lowerCamelCase_ ( UpperCamelCase__ : int ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % ...
469
from __future__ import annotations def lowercase_ ( __snake_case : list ) -> list: '''simple docstring''' if len(__snake_case ) == 0: return [] snake_case__ , snake_case__ :Union[str, Any] = min(__snake_case ), max(_...
241
0
import math class UpperCamelCase__ : """simple docstring""" def snake_case__ ( self , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ) -> int: A__ = 0.0 A__ = 0.0 for i in range(len(SCREAMING_SNAKE_CASE__ ) ): da...
711
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_d...
562
0
# This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for tests from os.path import j...
122
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, PNDMScheduler, StableDiffusionLDMaDPipeline, UNetaDConditionModel, ) from diffusers.utils import nightly, slow...
122
1
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline _UpperCamelCase = logging.get_logger(__name__) # pylint: disable=invalid-name cla...
211
'''simple docstring''' import math def _lowerCAmelCase( UpperCAmelCase_ : int ) -> bool: return math.sqrt(UpperCAmelCase_ ) * math.sqrt(UpperCAmelCase_ ) == num def _lowerCAmelCase( UpperCAmelCase_ : int ) -> bool: lowerCAmelCase__ = 0 ...
211
1
"""simple docstring""" def __magic_name__ ( __snake_case : int ) -> int: if not isinstance(__snake_case , __snake_case ) or number < 0: raise ValueError("Input must be a non-negative integer" ) lowercase : int = 0...
361
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _A : str = logging.get_logger(__name__) _A : Tuple = { """goog...
361
1
from __future__ import annotations def _UpperCamelCase ( lowercase__ , lowercase__ , lowercase__ , lowercase__ ): __SCREAMING_SNAKE_CASE : int = [] __SCREAMING_SNAKE_CASE : Optional[Any] = input_list[low:mid], input_list[mid : high + 1] while left and right: ...
721
def _UpperCamelCase ( lowercase__ , lowercase__ ): return "\n".join( F'''{number} * {i} = {number * i}''' for i in range(1 , number_of_terms + 1 ) ) if __name__ == "__main__": print(multiplication_table(number=5, number_of_terms=1_0))
260
0
"""simple docstring""" import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available from . import BaseDiffusersCLICommand def lowerCamelCase_ (...
142
"""simple docstring""" import importlib.metadata import operator import re import sys from typing import Optional from packaging import version __lowercase : int = { """<""": operator.lt, """<=""": operator.le, """==""": operator.eq, """!=""": operator.ne, """>=""": oper...
142
1
"""simple docstring""" import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...te...
579
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from transformers.utils ...
579
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCamelCase = { "configuration_swiftformer": [ "SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "SwiftFormerConfig", "SwiftFormerOnnxConfig"...
66
"""simple docstring""" import argparse import pathlib import fairseq import torch from fairseq.models.roberta import RobertaModel as FairseqRobertaModel from fairseq.modules import TransformerSentenceEncoderLayer from packaging import version from transformers import XLMRobertaConfig, XLMRobertaXL...
516
0
"""simple docstring""" def __magic_name__ ( __snake_case : int = 10 ) -> str: if not isinstance(__snake_case , __snake_case ) or n < 0: raise ValueError("Invalid input" ) lowercase : Tuple = 10**n lowercase ...
713
"""simple docstring""" # flake8: noqa # Lint as: python3 _A : Dict = [ """VerificationMode""", """Version""", """disable_progress_bar""", """enable_progress_bar""", """is_progress_bar_enabled""", """experimental""", ] from .info_utils import VerificationMode from ...
518
0
'''simple docstring''' from __future__ import annotations from collections import Counter from random import random class _snake_case : def __init__( self ): UpperCAmelCase_ : Union[str, Any] = {} def UpperCamelCase__ ( self ,_snake_cas...
71
import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import FlaxGenerationTesterMixin f...
319
0
'''simple docstring''' from __future__ import annotations def __UpperCamelCase ( UpperCAmelCase , UpperCAmelCase ): lowercase__ , lowercase__ : Tuple = position lowercase__ : int = [ (y + 1, x + 2), (y - 1, x + 2), (y + 1, x - 2), (y ...
428
'''simple docstring''' import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerT...
428
1
'''simple docstring''' import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=UpperCAmelCase_ ) class lowerCAmelCase__ ( UpperCAmelCase_ ): '''simple do...
51
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowerCAmelCase__ ( UpperCAmelCase_ ): '''simple docstring''' _lowerCamelCase =["image_processor", "tokenizer"] _lowerCame...
51
1
'''simple docstring''' import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex _lowercase = logging.getLogger(__name__) class _lowercase : ...
44
'''simple docstring''' import json import os import re import unittest from transformers import CodeGenTokenizer, CodeGenTokenizerFast from transformers.models.codegen.tokenization_codegen import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from...
44
1
def lowerCamelCase__ ( _lowercase , _lowercase , _lowercase ): '''simple docstring''' return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(_lowercase ) ) def lowerCamelCase__ ( _lowercase , _lowercase , _lo...
30
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_rembert impor...
198
0
import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class __a ( __UpperCamelCase ): __lowercase : Unio...
702
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCAmelCase = logging.get_logger(__name__) __lowerCAmelCase = { '''m...
335
0
def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase ): __snake_case : int = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series return total def lowerCAmelCase_...
81
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LDMTextToImagePipeline, UNetaDConditionModel from diffusers.utils.testing_utils import ( enable_full_determinism, load_nump...
269
0
import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_MODEL_FOR_SEQUENCE_CLASS...
284
import collections import inspect import unittest from transformers import SwinvaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import Co...
284
1
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from ...
644
"""simple docstring""" from typing import Optional, Tuple import jax import jax.numpy as jnp from flax import linen as nn from flax.core.frozen_dict import FrozenDict from transformers import CLIPConfig, FlaxPreTrainedModel from transformers.models.clip.modeling_flax_clip import FlaxCLIPVisionModule def ...
644
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _snake_case = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP", "LlamaConfig"], } try: i...
707
import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def A ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): '''simple...
658
0
'''simple docstring''' import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLD...
3
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : int = logging.get_logger(__name__) lowerCAmelCase : Tuple = { 'microsoft/unispeech-sat-base-100h-libri-ft': ( ...
3
1
def __a ( A__ : list[int] , A__ : int ): SCREAMING_SNAKE_CASE = len(A__ ) SCREAMING_SNAKE_CASE = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )] # for each arr value, a sum of zero(0) can be formed by not taking any element # h...
698
from manim import * class _SCREAMING_SNAKE_CASE ( __snake_case ): '''simple docstring''' def _snake_case ( self : List[Any] ): SCREAMING_SNAKE_CASE = Rectangle(height=0.5 , width=0.5 ) SCREAMING_SNAKE_CASE = R...
698
1
'''simple docstring''' def lowerCamelCase ( __lowerCamelCase : int = 6008_5147_5143 ) ->int: try: _SCREAMING_SNAKE_CASE = int(__lowerCamelCase ) except (TypeError, ValueError): raise TypeError("""Parameter n must be int or castable to int.""" ) ...
314
'''simple docstring''' def lowerCamelCase ( __lowerCamelCase : str , __lowerCamelCase : str ) ->float: def get_matched_characters(__lowerCamelCase : str , __lowerCamelCase : str ) -> str: _SCREAMING_SNAKE_CASE = [] _S...
314
1
'''simple docstring''' def __magic_name__( lowerCamelCase, lowerCamelCase): __lowerCAmelCase = len(snake_case_) __lowerCAmelCase = [] for i in range(len(snake_case_) - pat_len + 1): __lowerCAmelCase = True ...
719
'''simple docstring''' from __future__ import annotations def __magic_name__( lowerCamelCase, lowerCamelCase): __lowerCAmelCase = sorted(numsa + numsa) __lowerCAmelCase , __lowerCAmelCase = divmod(len(lowerCamelCase), 2) if mod...
474
0