code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
import math import qiskit def lowerCAmelCase_ (lowercase__ : int = 1 , lowercase__ : int = 1 , lowercase__ : int = 1 ) -> qiskit.result.counts.Counts: '''simple docstring''' if ( isinstance(lowerCamelCase__ , lowerCamel...
668
"""simple docstring""" 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_...
572
0
"""simple docstring""" from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 _UpperCamelCase = { # 1536-bit 5: { "pr...
717
"""simple docstring""" def _a ( _snake_case = 10 , _snake_case = 22 ): """simple docstring""" UpperCAmelCase = range(1 , _snake_case ) UpperCAmelCase = range(1 , _snake_case ) return sum( 1 for power in powers fo...
74
0
'''simple docstring''' import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class SCREAMING_SNAKE_CASE ( __a ): '''simple docstring''' __UpperCamelCase = (DDPMParallelScheduler,) def _UpperCamelCa...
329
'''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_ava...
451
0
def SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ , lowercase_ = 0 , lowercase_ = 0 ) -> Union[str, Any]: """simple docstring""" A__ = right or len(lowercase_ ) - 1 if left > right: return -1 elif list_dat...
721
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, AutoModelForSequenceClassification, Au...
177
0
"""simple docstring""" import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import BatchEncoding, PreTrainedTokenizer from ...utils import logging a :Any = logging.get_log...
680
"""simple docstring""" # DISCLAIMER: This code is strongly influenced by https://github.com/pesser/pytorch_diffusion # and https://github.com/hojonathanho/diffusion import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch from diffusers.configur...
680
1
"""simple docstring""" import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipelin...
359
"""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: List[An...
359
1
'''simple docstring''' from __future__ import annotations from cmath import sqrt def UpperCamelCase ( lowercase_ : Any , lowercase_ : Optional[Any] , lowercase_ : Optional[int] ) -> tuple[complex, complex]: '''simple docstring''' if a == 0: raise V...
72
"""simple docstring""" import os import pytest from attr import dataclass __UpperCAmelCase ="""us-east-1""" # defaults region @dataclass class lowerCAmelCase__ : lowercase__ : str lowercase__ : List[Any] = """arn:aws:iam::558105141721:role/sagemaker_execution_role""" lower...
337
0
'''simple docstring''' import datasets from .evaluate import evaluate snake_case_ : Union[str, Any] = '\\n@article{hendrycks2021cuad,\n title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review},\n author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball},\n ...
350
'''simple docstring''' def __snake_case ( _UpperCAmelCase : list[list[float]]): UpperCamelCase = [] for data in source_data: for i, el in enumerate(_UpperCAmelCase): if len(_UpperCAmelCase) < i + 1: data_lists.append([]) data_lists[i].appen...
350
1
'''simple docstring''' import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging UpperCAmelCase_ : Union[str, Any] = '''\ ''' UpperCAmelCase_ : int = ''' Perplexity ...
24
'''simple docstring''' class UpperCAmelCase : def __init__( self : List[str] , __snake_case : str ) -> Union[str, Any]: _lowerCAmelCase = val _lowerCAmelCase = None _lowerCAmelCase ...
207
0
'''simple docstring''' import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class SCREAMING_SNAKE_CASE__ ( SCREAMING_SNAKE_CASE__ ): __SCREAMING_SNAKE_CASE = """""" __SCREAMING_S...
721
'''simple docstring''' import inspect import unittest from transformers import DPTConfig from transformers.file_utils import is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_devic...
680
0
"""simple docstring""" def lowerCamelCase_ (UpperCamelCase__ : Any ): stooge(UpperCamelCase__ , 0 , len(UpperCamelCase__ ) - 1 ) return arr def lowerCamelCase_ (UpperCamelCase__ : List[Any] , UpperCamelCase__ : List[Any] , UpperCamelCase__ ...
506
"""simple docstring""" import qiskit def lowerCamelCase_ (UpperCamelCase__ : int , UpperCamelCase__ : int ): _UpperCAmelCase : Any = qiskit.Aer.get_backend('''aer_simulator''' ) # Create a Quantum Circuit acting on the q register _UpperCAmelC...
506
1
"""simple docstring""" import numpy as np def UpperCAmelCase ( snake_case : np.ndarray ): return 1 / (1 + np.exp(-vector )) def UpperCAmelCase ( snake_case : np.ndarray ): return vector * sigmoid(snake_case ) if __name__ == "__main__": impor...
700
"""simple docstring""" from typing import List, Union import numpy as np from ..utils import add_end_docstrings, 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 i...
439
0
"""simple docstring""" import os from pathlib import Path def __A () ->List[str]: """simple docstring""" from torch.utils.cpp_extension import load lowerCAmelCase__ :List[Any] = Path(_SCREAMING_SNAKE_CASE ).resolve().parent.parent.parent / 'kernels' / 'deformable_de...
93
import qiskit def lowercase ( SCREAMING_SNAKE_CASE = 2 ) -> qiskit.result.counts.Counts: '''simple docstring''' SCREAMING_SNAKE_CASE_ = qubits # Using Aer's simulator SCREAMING_SNAKE_CASE_ = qiskit.Aer.get_backend('aer_simulator' ) # Creating a Quantum...
205
0
import warnings from ...utils import logging from .image_processing_segformer import SegformerImageProcessor SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class __UpperCAmelCase ( __A ): """simple docstring""" def __init__( self ...
209
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available SCREAMING_SNAKE_CASE = {'configuration_yolos': ['YOLOS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'YolosConfig', 'YolosOnnxConfig']} try: if not is_vision...
209
1
"""simple docstring""" def lowerCAmelCase ( __UpperCamelCase ): '''simple docstring''' UpperCAmelCase__ : List[str] = len(A__ ) UpperCAmelCase__ : Union[str, Any] = len(matrix[0] ) UpperCAmelCase__ : Optional[int] = ...
65
'''simple docstring''' from __future__ import annotations def UpperCamelCase_ ( A__ : list , A__ : int , A__ : int , A__ : int ): '''simple docstring''' lowerCAmelCase_ : int = [] lowerCAmelCase_, ...
275
0
'''simple docstring''' import io import json import unittest from parameterized import parameterized from transformers import FSMTForConditionalGeneration, FSMTTokenizer from transformers.testing_utils import get_tests_dir, require_torch, slow, torch_device from utils import calculate_bleu lower...
471
'''simple docstring''' import argparse import torch from safetensors.torch import load_file from diffusers import StableDiffusionPipeline def SCREAMING_SNAKE_CASE( UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,UpperCamelCase ) -> Tuple: # load bas...
471
1
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def lowerCAmelCase__(__snake_case ,__snake_case ) -> np.array: '''simple docstring''' lowerCamelCase__ = F'{sampling_rate}' lowerCamelCase__ ...
481
from math import factorial _a = {str(digit): factorial(digit) for digit in range(10)} def lowerCAmelCase__(__snake_case ) -> int: '''simple docstring''' if not isinstance(__snake_case ,__snake_case ): raise TypeError('''Parameter number must be int''' ) if number <...
481
1
from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize('repo_id' , ['canonical_dataset_name', 'org-name/dataset-name'] ) @pytest.mark.parametrize('path' , ['filename.csv', 'filename with blanks.csv'] ) @pytest....
676
from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize('repo_id' , ['canonical_dataset_name', 'org-name/dataset-name'] ) @pytest.mark.parametrize('path' , ['filename.csv', 'filename with blanks.csv'] ) @pytest....
676
1
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class ...
571
"""simple docstring""" import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __snake_case : ...
571
1
"""simple docstring""" 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.t...
227
"""simple docstring""" 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...
227
1
'''simple docstring''' import math def UpperCAmelCase ( A : int ): SCREAMING_SNAKE_CASE : Tuple = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(A ) def UpperCAmelCase ( A : float = 1...
527
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase_ : Dict = { 'configuration_encodec': [ 'ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
527
1
"""simple docstring""" 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 GradientAcc...
614
"""simple docstring""" from __future__ import annotations from dataclasses import dataclass @dataclass class __magic_name__ : _SCREAMING_SNAKE_CASE : float _SCREAMING_SNAKE_CASE : TreeNode | None = None _SCREAMING_SNAKE_CASE : TreeNode...
614
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __A = { '''configuration_graphormer''': ['''GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GraphormerConfig'''], } try: if not is_torch_available(): ...
593
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCAmelCase = { """configuration_ro...
259
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, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, )...
710
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 ...
154
0
from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ...
39
import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_...
385
0
import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def __UpperCAmelCase( lowercase_ ): return (data["data"],...
613
import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from ...
613
1
'''simple docstring''' from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def lowercase_ ( __A : str ) -> None: """simple docstring""" lowercase , lowercase : Any =analyze_text(__A ) l...
94
from typing import TYPE_CHECKING from ..utils import _LazyModule _snake_case = { "config": [ "EXTERNAL_DATA_FORMAT_SIZE_LIMIT", "OnnxConfig", "OnnxConfigWithPast", "OnnxSeq2SeqConfigWithPast", "PatchingSpec", ], "convert": ["export", "validate_model_out...
500
0
def lowercase ( a = 1000 ): '''simple docstring''' SCREAMING_SNAKE_CASE_ :Union[str, Any] = 2**power SCREAMING_SNAKE_CASE_ :Optional[int] = str(a ) SCREAMING_SNAKE_CASE_ :Union[str, Any] = list(a ) SCREAMING_SNAKE_CASE_ :List[An...
720
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_albert": ["ALBERT_PRE...
140
0
'''simple docstring''' from math import pi def UpperCamelCase__ ( __magic_name__ : int , __magic_name__ : int ) -> float: '''simple docstring''' return 2 * pi * radius * (angle / 3_60) if __name__ == "__main__": print(arc_length(90, 10))
38
import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis from lavis.models import load_model_and_preprocess from PIL import Image from transformers import ( ...
556
0
'''simple docstring''' from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline ...
711
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A__: Optional[int] = { '''configuration_megatron_bert''': ['''MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MegatronBertConfig...
506
0
'''simple docstring''' import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets lowerCAmelCase : Optional[int] = datasets.logging.get_logger(__name__) lowerCAmelCase : List[str] = """\ @inprocee...
444
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCamelCase__ ( metaclass=SCREAMING_SNAKE_CASE_ ): """simple docstring""" __magic_name__ = ["torch", "torchsde"] def __init__( sel...
444
1
'''simple docstring''' def a ( __a ) -> bool: '''simple docstring''' UpperCamelCase__ :set[int] = set() # To detect a back edge, keep track of vertices currently in the recursion stack UpperCamelCase__ :set[int] = set() ret...
718
'''simple docstring''' import json import sys def a ( __a , __a ) -> str: '''simple docstring''' with open(__a , encoding='''utf-8''' ) as f: UpperCamelCase__ :List[str] = json.load(__a ) UpperCamelCase__ :int ...
280
0
import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def UpperCamelCase_( lowerCamelCase_ ) -> Dict: _lowercase : List[...
89
import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import numpy as np import pandas as pd from datasets import load_dataset import transformers from transformers import ( AutoConfig, BartForSequenceClassification, DataC...
89
1
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 lowerCAmelCase__( __lower...
381
def lowerCamelCase__ (__lowerCamelCase = 10**9 ): _SCREAMING_SNAKE_CASE : List[str] = 1 _SCREAMING_SNAKE_CASE : Any = 2 _SCREAMING_SNAKE_CASE : List[Any] = 0 _SCREAMING_SNAKE_CASE : Dict = 0 _SCREAM...
381
1
# limitations under the License. from typing import Optional, Tuple, Union import torch from diffusers import DiffusionPipeline, ImagePipelineOutput class UpperCAmelCase_ ( _SCREAMING_SNAKE_CASE ): def __init__( self ,__snake_case ,__snake_case ): """simple docstring""" ...
188
from __future__ import annotations def UpperCAmelCase_ ( _UpperCAmelCase :list[float] , _UpperCAmelCase :list[float] ) -> float: '''simple docstring''' A_ = sorted(numsa + numsa ) A_ , A_ = divmod(len(_UpperCAmelCase ) ...
188
1
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer __lowerCAmelCase : Optional[Any] ...
704
"""simple docstring""" import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def __snake_case ( UpperCamelCase ) -> float: """simple docstring""" return np.dot(UpperCamelCase , UpperCamelCase ) class SCREAMING_SNAKE_CASE ...
158
0
from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging UpperCamelCase__ = logging.get_logger(__name__) def _UpperCamelCase (a__ :Union[tf.Tensor, np.ndarray] ): """simple docstring""" if isinstance(lo...
619
"""simple docstring""" from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging __UpperCAmelCase = logging.get_logger(__name__) def lowercase__ ( lowerCAmelCase__ : Union[tf.Tensor, np.ndarray] ) -> List[int]: '...
642
0
import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class UpperCAmelCase ( nn.Module ): lowercase = 42 lowercase = 42 lowercase = 0.0...
181
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 import loggin...
181
1
'''simple docstring''' import copy import tempfile import unittest from transformers import MaMaaaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from transformers.utils import cached_property from ...generation.test_ut...
370
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowercase = { '''configuration_chinese_clip''': [ '''CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ChineseCLIPConfi...
370
1
import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import fl...
705
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __lowercase = logging.get_logger(__name__) __lowercase = { '''microsoft/wavlm-base''': '''https://huggingface.co/microsoft/wavlm-base/resolve/main/config.json''', #...
452
0
import math import unittest from transformers import BioGptConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common impor...
291
# Copyright 2021 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 requ...
291
1
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, RegNet...
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
"""simple docstring""" import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common...
580
"""simple docstring""" __lowerCamelCase = {"a": ["c", "b"], "b": ["d", "e"], "c": [], "d": [], "e": []} __lowerCamelCase = ["a", "b", "c", "d", "e"] def lowercase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ) -> int: __magic_name__ = start # add curren...
490
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { "google/canine-s": "https://huggingface.co/google/canine-s/resolve/main/config.json", # See all CANINE models at https://huggingface.co/models?filter=canine }...
706
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _A = "▁" _A = {"vocab_file": "spiece.model"} _A = { ...
294
0
import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) ...
283
from __future__ import annotations def _lowerCAmelCase ( lowerCAmelCase_ :int , lowerCAmelCase_ :int )->list[str]: '''simple docstring''' if partitions <= 0: raise ValueError("partitions must be a positive number!" ) if partitions > number_of_bytes...
283
1
'''simple docstring''' from math import factorial def lowerCAmelCase ( UpperCAmelCase, UpperCAmelCase, UpperCAmelCase ) ->float: """simple docstring""" if successes > trials: raise ValueError('''successes must be lowe...
703
import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze, transpose, ) ...
336
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { '''asapp/sew-d-tiny-100k''': '''https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json''', # ...
84
from __future__ import annotations def UpperCAmelCase_ ( __SCREAMING_SNAKE_CASE ): lowercase = str(__SCREAMING_SNAKE_CASE ) return n == n[::-1] def UpperCAmelCase_ ( __SCREAMING_SNAKE_CASE = 100_0000 ): lowercase = 0 for i in range(1 , __SCRE...
84
1
"""simple docstring""" from __future__ import annotations import pandas as pd def _lowerCAmelCase ( lowerCAmelCase , lowerCAmelCase , lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [0] * no_of_processes UpperCAmelCase = ...
378
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = 0 UpperCAmelCase = len(lowerCAmelCase ) for i in range(n - 1 ): for j in range(i + 1 , lowerCAmelCase ): ...
378
1
from PIL import Image def _snake_case ( lowerCAmelCase : Image ): """simple docstring""" SCREAMING_SNAKE_CASE_ : List[Any] = image.size SCREAMING_SNAKE_CASE_ : Optional[Any] = 0 SCREAMING_SNAKE_CASE_ : Union[str, Any] = im...
216
"""simple docstring""" 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 _UpperCAmelCase ( datasets.BeamBasedBuilder): ...
238
0
'''simple docstring''' from manim import * class SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE ): '''simple docstring''' def snake_case__ ( self : Any ) ->Optional[Any]: '''simple docstring''' _Up...
204
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : Optional[int] = logging.get_logger(__name__) lowerCAmelCase_ : Tuple = { """huggingface/time-series-transformer-tou...
204
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_C...
523
'''simple docstring''' lowerCAmelCase : Optional[Any] = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } def A_( A : dict , A : str , A :...
3
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __lowerCamelCase : str = { """configuration_groupvit""": [ """GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GroupViTConfig""", """Gro...
712
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ...utils.du...
25
0
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_devi...
314
'''simple docstring''' import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor lowercase_ = logging.get_logger(__name__) class a_ ( snake_case_ ): '''simple docstring''' def __init__( self , *A , **A ) ...
314
1
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_full_determin...
709
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { "YituTech/conv-bert-base": "https...
276
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMix...
435
import warnings 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 A...
486
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, ...
720
"""simple docstring""" import numpy as np def lowerCAmelCase_( lowercase_ : np.ndarray , lowercase_ : np.ndarray , lowercase_ : float = 1e-12 , lowercase_ : int = 1_00 , ) -> tuple[float, np.ndarray]: assert np.shape(lowercase...
623
0
'''simple docstring''' from collections.abc import Sequence def lowerCAmelCase_ ( snake_case_ : Sequence[int] | None = None ) -> int: '''simple docstring''' if nums is None or not nums: raise ValueError("Input sequence should not be empty" ) Up...
78
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase__ = { '''configuration_git''': ['''GIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GitConfig''', '''GitVisionConfig'''], '''processing_git'''...
227
0
'''simple docstring''' from collections import UserDict 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_av...
9
'''simple docstring''' import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokenizers.proces...
9
1
"""simple docstring""" import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def lowerCamelCase_( _lowe...
46
"""simple docstring""" _UpperCamelCase = { """meter""": """m""", """kilometer""": """km""", """megametre""": """Mm""", """gigametre""": """Gm""", """terametre""": """Tm""", """petametre""": """Pm""", """exametre""": """Em""", """zettametre""": """Zm""", """yotta...
341
0
'''simple docstring''' import sys from collections.abc import Mapping from typing import TYPE_CHECKING import numpy as np import pyarrow as pa from .. import config from ..utils.py_utils import map_nested from .formatting import TensorFormatter if TYPE_CHECKING: import torch class UpperCamelCase ...
708
'''simple docstring''' import os def SCREAMING_SNAKE_CASE__ ( ) -> List[Any]: """simple docstring""" a : List[str] = os.path.join(os.path.dirname(snake_case ) , 'num.txt' ) with open(snake_case ) as file_hand: return str...
610
0
'''simple docstring''' from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase :Optional[int] = logging.get_logger(__name__) lowerCamelCase :str = { '''nielsr/canine-s''': 2...
667
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( Aut...
667
1
import inspect import unittest from datasets import load_dataset from packaging import version from transformers import BeitConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device fr...
714
"""simple docstring""" def lowercase__(A ) ->list[int]: """simple docstring""" lowercase__ : List[str]= len(A ) for i in range(A ): for j in range(i + 1 , A ): if numbers[j] < numbers[i]: ...
85
0
from maths.prime_factors import prime_factors def snake_case__ ( __SCREAMING_SNAKE_CASE ) -> List[Any]: if not isinstance(UpperCamelCase__ , UpperCamelCase__ ): UpperCAmelCase_ = f'''Input value of [number={number}] must be an integer''' raise TypeError(UpperCamel...
579
"""simple docstring""" import numpy as np import pandas as pd from sklearn.preprocessing import Normalizer from sklearn.svm import SVR from statsmodels.tsa.statespace.sarimax import SARIMAX def lowerCamelCase_ (UpperCamelCase__ : list , UpperCamelCase__ : list , UpperCamelCase__ ...
506
0
import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class low...
713
"""simple docstring""" import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torc...
22
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert } class SCREAMING_SNAKE_CASE ( _lowerCamelCase )...
225
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A_ : str = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechC...
265
0
from random import shuffle import tensorflow as tf from numpy import array def UpperCamelCase__( UpperCamelCase__ : int , UpperCamelCase__ : str )->Optional[Any]: A__ = int(UpperCamelCase__ ) assert noofclusters < len(UpperCamelCase__ ) ...
714
def UpperCamelCase__( UpperCamelCase__ : Optional[int] , UpperCamelCase__ : List[Any] )->List[str]: A__ = [1] for i in range(2 , UpperCamelCase__ ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k ou...
212
0
from __future__ import annotations def __UpperCamelCase ( A ): # This function is recursive UpperCamelCase__ = len(A ) # If the array contains only one element, we return it (it's the stop condition of # recursion) if array_length <= 1: return...
415
import time import warnings from abc import ABC from copy import deepcopy from typing import Optional import torch from ..utils import add_start_docstrings, logging __magic_name__ =logging.get_logger(__name__) __magic_name__ =r''' Args: input_ids (`torch.LongTensor` of shape `(...
415
1
import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class lowerCamelCase (unittest.TestCase ): """simple docstring""" def __A ( sel...
707
import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionTextToImagePipeline from diffusers.utils.testing_utils import nightly, require_torch_gpu, torch_device A : List[str] = False class lowerCamelCase (unittest.TestCase ): ...
356
0
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, Wav...
293
import pytest import datasets # Import fixture modules as plugins __snake_case = ['''tests.fixtures.files''', '''tests.fixtures.hub''', '''tests.fixtures.fsspec'''] def _A ( _lowercase , _lowercase ) -> Tuple: """simple docstring""" for item in ...
1
0
"""simple docstring""" import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def snake_case__ ( _SCREAMING_SNAKE_CASE = 3 ) ->qiskit.result.counts.Counts: if isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_...
713
"""simple docstring""" from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accele...
422
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase =logging.get_logger(__name__) _lowerCamelCase ={ """facebook/wav2vec2-base-960h""": """https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/config.json""", # ...
681
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase =logging.get_logger(__name__) _lowerCamelCase ={ """edbeeching/decision-transformer-gym-hopper-medium""": ( """https://huggingface.co/edbeeching/decision-transformer-gym-hopper-medium/resolve/main/co...
681
1
'''simple docstring''' import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def lowerCAmelCase_ ( lowerCamelCase , lowerCamelCase=7 ): __magic_name__ : List[Any] =None if token is not None: ...
715
from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance UpperCAmelCase_ : Dict = 637_8137.0 UpperCAmelCase_ : List[Any] = 635_6752.31_4245 UpperCAmelCase_ : List[str] = 6378137 def lowerCAmelCase_ ( l...
367
0
import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_available, is_torch_available, ) from . import Ba...
100
"""simple docstring""" from typing import TYPE_CHECKING from ..utils import _LazyModule a = { '''config''': [ '''EXTERNAL_DATA_FORMAT_SIZE_LIMIT''', '''OnnxConfig''', '''OnnxConfigWithPast''', '''OnnxSeq2SeqConfigWithPast''', '''PatchingSpec''', ]...
7
0
"""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, bigbird_pegasus, ...
712
"""simple docstring""" import random from .binary_exp_mod import bin_exp_mod def UpperCamelCase_ ( SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_=1_0_0_0 ): if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd SCREAMING...
406
0
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from ..image_utils import load_image if is_torch_available(): import torch ...
68
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params import...
303
0
'''simple docstring''' from __future__ import annotations from cmath import sqrt def _SCREAMING_SNAKE_CASE ( lowercase : Dict , lowercase : Optional[Any] , lowercase : Optional[Any] ): '''simple docstring''' if a == 0: r...
717
import argparse import json import logging import os import sys from unittest.mock import patch from transformers.testing_utils import TestCasePlus, get_gpu_count, slow lowerCamelCase : List[Any] = [ os.path.join(os.path.dirname(__file__), dirname) for dirname in [ ...
651
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor _UpperCAmelCase : Any = logging.get_logger(__name__) class lowercase_ ( _UpperCamelCase ): """simple docstring""" def __init__( sel...
107
'''simple docstring''' from __future__ import annotations def _SCREAMING_SNAKE_CASE ( __snake_case : int | str ): _A = str(__snake_case ) return n == n[::-1] def _SCREAMING_SNAKE_CASE ( __snake_case : int = 1_0_0_0_0_0_0 ): _A = 0 f...
107
1
from __future__ import annotations _lowercase : Tuple =1.6_0_2_1E-1_9 # units = C def A__ ( lowercase: float, lowercase: float, lowercase: float, ) -> tuple[str, float]: if (conductivity, electron_conc, mobility).count(0 ) != 1: raise Va...
661
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 import cached_property from ...test...
661
1
'''simple docstring''' from typing import Optional from .. import Features, NamedSplit from ..packaged_modules.text.text import Text from ..utils.typing import NestedDataStructureLike, PathLike from .abc import AbstractDatasetReader class SCREAMING_SNAKE_CASE__ ( _UpperCamelCase ): ...
69
'''simple docstring''' import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from tr...
536
0
'''simple docstring''' from importlib import import_module from .logging import get_logger __UpperCAmelCase :int = get_logger(__name__) class a : """simple docstring""" def __init__( self : Optional[int] , snake_case : Tu...
266
'''simple docstring''' from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def _a ( _lowercase : int ): '''simple docstring''' __UpperCAmelCase : int = int(number**0.5 ) ...
266
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule __magic_name__ : Any = {"""processing_wav2vec2_with_lm""": ["""Wav2Vec2ProcessorWithLM"""]} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else:...
102
"""simple docstring""" import argparse a = '''docs/source/_static/js/custom.js''' def _snake_case ( _snake_case : Dict ) -> Any: '''simple docstring''' with open(_snake_case , encoding='utf-8' , newline='\n' ) as f: _...
7
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { 'kssteven/i...
201
'''simple docstring''' 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', 'BridgeTowerConf...
201
1
'''simple docstring''' import unittest from transformers import DebertaVaConfig, 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 impo...
168
'''simple docstring''' import os import sys import unittest _a : Optional[int] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import get_test_info # noqa: E402 from get_test_info import ( # noqa: E402...
168
1
import os import re from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging A : str = logging.get_logger(__name__) A : Union[str, Any] = { "vocab_file": "vocab.txt", "merg...
700
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, ...
5
0
from __future__ import annotations def lowerCAmelCase_ (lowerCAmelCase__: int | str ): """simple docstring""" UpperCAmelCase_: Optional[int] = str(lowerCAmelCase__ ) return n == n[::-1] def lowerCAmelCase_ (lowerCAmelCase__: int = 1_...
556
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_mas...
556
1
def A_ ( lowercase_ ) ->Union[str, Any]: """simple docstring""" assert column_title.isupper() SCREAMING_SNAKE_CASE = 0 SCREAMING_SNAKE_CASE = len(_lowerCAmelCase ) - 1 SCREAMING_SNAKE_CASE = 0 while index >= 0: SCREAMING_SNAKE_CASE = (o...
711
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __UpperCAmelCase = {} try: if not is_sentencepiece_available(): raise OptionalDepen...
259
0
'''simple docstring''' import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Value from .base import TaskTemplate @dataclass(frozen=lowercase ) class lowercase__ ( lowercase ): # `task` is not a ClassVar since we wan...
195
'''simple docstring''' def A__ ( UpperCAmelCase_ , UpperCAmelCase_ ): return int((input_a, input_a).count(0 ) != 0 ) def A__ ( ): assert nand_gate(0 , 0 ) == 1 assert nand_gate(0 , 1 ) == 1 assert nand_gate(1 , 0 ) == 1 assert...
195
1
import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class _A ( pl.LightningModule ): def __init__( self , _SCREAMING_SNAKE_CASE ): super().__init__() _UpperCA...
711
from dataclasses import dataclass from typing import Optional import numpy as np import torch import torch.nn as nn from ..utils import BaseOutput, is_torch_version, randn_tensor from .attention_processor import SpatialNorm from .unet_ad_blocks import UNetMidBlockaD, get_down_block, get_up_block ...
175
0
"""simple docstring""" def lowercase_ ( _lowercase : int , _lowercase : Tuple ): '''simple docstring''' if b == 0: return 1 if (b % 2) == 0: return actual_power(A__ , int(b / 2 ) ) * actual_power(A__ , int(b / 2 ...
595
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils im...
426
0
'''simple docstring''' from __future__ import annotations def __lowerCamelCase ( __lowerCAmelCase : list[int] ) -> int: snake_case = len(__lowerCAmelCase ) // 2 # choose the middle 3 elements snake_case = lst[m - 1 : m + 2] # if mi...
517
'''simple docstring''' import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class _lowerCAmelCase ( ctypes.Structure ): """simple docstring""" snake_case_ = [(...
517
1
from __future__ import annotations def _a ( UpperCamelCase_ : list , UpperCamelCase_ : int , UpperCamelCase_ : int , UpperCamelCase_ : int ) -> list: """simple docstring""" lowerCAmelCase__ = [] lowerCAmelCase__ , ...
339
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a_ = logging.get_logger(__name__) a_ = { '''YituTech/conv-bert-base''': '''https://huggingface.co/YituTech/conv-bert...
339
1
'''simple docstring''' def A__ ( __lowerCAmelCase : int ): if not isinstance(__lowerCAmelCase , __lowerCAmelCase ) or number < 0: raise ValueError("""Input must be a non-negative integer""" ) lowerCamelCase__ = 0 while number: ...
9
'''simple docstring''' import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def A__ ( __lowerCAmelCase : Union[str, Any] ): lowerCamelCase__ = [ """encoder.version""", """decoder.vers...
9
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowercase = logging.get_logger(__name__) _lowercase = { '''xlm-roberta-base''': '''https://huggingface.co/xlm-robert...
157
"""simple docstring""" import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters A_ = (7_20, 12_80) # Height, Width A_ = (0.4, 0.6) # if height or width lower than this scale, drop it. A_ =...
609
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 imp...
521
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase_ : Dict = logging.get_logger(__name__) lowerCAmelCase_ : Any ...
521
1
"""simple docstring""" import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def lowercase ( lowerCAmelCase__ : Any , lowerCAmelCase__ : List[str]=7 ) -> Union[str, Any]: __a = None if toke...
695
import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloyd_if import IFWatermarker from di...
253
0
'''simple docstring''' def __A ( _SCREAMING_SNAKE_CASE : Any ): """simple docstring""" return [ { 0: [1, 2], 1: [0, 2], 2: [0, 1, 3, 5], 3: [2, 4], 4: [3], ...
564
'''simple docstring''' import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base impo...
564
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diff...
516
'''simple docstring''' import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor snake_case_ = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ): def __init__( self ,...
421
0
"""simple docstring""" import requests from bsa import BeautifulSoup def _a ( _SCREAMING_SNAKE_CASE = "AAPL" ) -> str: snake_case_ = f"""https://in.finance.yahoo.com/quote/{symbol}?s={symbol}""" snake_case_ = BeautifulSoup(requests.get(_SCREAMING_SNAK...
2
"""simple docstring""" import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, ...
2
1
a__: Tuple = 256 # Modulus to hash a string a__: Dict = 1_000_003 def UpperCamelCase__( UpperCamelCase__ : str , UpperCamelCase__ : List[str] )->Optional[Any]: A__ = len(__lowercase ) A__ = len(__lowercase ) ...
190
"""simple docstring""" def _A ( __lowercase , __lowercase ): """simple docstring""" while second != 0: lowerCamelCase__ = first & second first ^= second lowerCamelCase__ = c << 1 return first ...
129
0
import dataclasses import re import string from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple import numpy as np from . import residue_constants lowerCamelCase : List[str] = Mapping[str, np.ndarray] lowerCamelCase : Any = Mapping[str, Any] # Is a nes...
704
from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, 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_ten...
649
0