code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_co...
77
"""simple docstring""" import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate import ...
77
1
import numpy as np class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : List[Any] ): SCREAMING_SNAKE_CASE = (0, 0) SCREAMING_SNAKE_CASE = None SCREAMING_SNAKE_CASE = 0 SCREAMIN...
698
import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identified_filename, ...
698
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 ...
19
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 ): __snake_case : int __snake_case : ...
206
0
"""simple docstring""" import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def __lowerCAmelCase( __UpperCAmelCase ,__UpperCAmelCase ): """simple docstring""" ...
283
"""simple docstring""" from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature from ...
283
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_retribert import RetriBertTokenizer A_ = logging.get_logger(__name__)...
391
"""simple docstring""" from manim import * class __lowerCAmelCase ( UpperCAmelCase ): '''simple docstring''' def UpperCamelCase__ ( self: int ): UpperCamelCase_ =Rectangle(height=0.5 , width=0.5 ) UpperCamelCase_ =Rectangle(...
391
1
import math from collections.abc import Callable def snake_case( __magic_name__ , __magic_name__ , __magic_name__ ) -> float: '''simple docstring''' lowercase : float = xa lowercase : float ...
708
import copy import os import cva import numpy as np from matplotlib import pyplot as plt class _A : def __init__( self : int ) -> Any: """simple docstring""" lowercase : List[Any] = '''''' lowercas...
596
0
from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline A = logging.get_logger(__name__) # pylint: disable=invalid-name class SCREAMING_SNAKE_CASE ( __snake_case ): """simpl...
187
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, TensorType lowe...
645
0
import ast import os import re import shutil import tempfile import unittest from unittest import mock import torch from accelerate.test_utils.examples import compare_against_test from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command, slow from accelerate.utils import write_basi...
720
import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFAutoModel, is_tensorflow_text_available, is_tf_available from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.testing_utils import require_tensorflow_text, requi...
519
0
from sklearn.metrics import fa_score import datasets snake_case : Optional[int] = '\nThe F1 score is the harmonic mean of the precision and recall. It can be computed with the equation:\nF1 = 2 * (precision * recall) / (precision + recall)\n' snake_case : Dict = '\nArgs:\n ...
605
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_commo...
605
1
"""simple docstring""" import re import string import numpy as np import datasets lowerCamelCase_ : Any = '\nReturns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list.\n' lowerCamelCase_ : Tuple ...
302
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_...
302
1
'''simple docstring''' def __UpperCAmelCase ( SCREAMING_SNAKE_CASE__: int, SCREAMING_SNAKE_CASE__: int ) -> list: """simple docstring""" __a = word.split() def justify(SCREAMING_SNAKE_CASE__: Optional[int], SCREAMING_SNAKE_CASE...
448
from __future__ import annotations def UpperCAmelCase__ ( __snake_case , __snake_case ) -> bool: _A = get_failure_array(__snake_case ) # 2) Step through text searching for pattern _A , _A = 0, 0 # index into text, pattern while i < len(__snake...
317
0
from ....utils import logging __a : int = logging.get_logger(__name__) class _UpperCamelCase ( _UpperCAmelCase ): """simple docstring""" def __init__( self , lowerCAmelCase__ , lowerCAmelCase__=None , lowerCAmelCase__=20_48 ) -> Optional[An...
522
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ) from ....
522
1
"""simple docstring""" import asyncio import os import re import sys import tempfile import unittest from contextlib import contextmanager from copy import deepcopy from distutils.util import strtobool from enum import Enum from importlib.util import find_spec from pathlib import Path f...
293
'''simple docstring''' from __future__ import annotations from typing import Any def snake_case_ ( __snake_case : list[Any]) -> None: create_state_space_tree(__snake_case , [] , 0) def snake_case_ ( __snake_case : list[Any] , __snake_case : list...
274
0
"""simple docstring""" def __lowerCamelCase ( lowerCAmelCase__ ): if not grid or not grid[0]: raise TypeError('The grid does not contain the appropriate information' ) for cell_n in range(1 ,len(grid[0] ) ): grid[0][cell_n] += grid[0]...
554
"""simple docstring""" print((lambda quine: quine % quine)('''print((lambda quine: quine %% quine)(%r))'''))
554
1
from collections import defaultdict def lowercase ( __A : int ) -> int: '''simple docstring''' snake_case : Union[str, Any] = 1 snake_case : str = True for v in tree[start]: if v not in visited: ret += dfs(__A ) ...
36
from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_...
333
0
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")): raise OptionalDependencyNotA...
12
"""simple docstring""" # Copyright (c) 2021-, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
12
1
import torch from diffusers import DiffusionPipeline class __A ( snake_case__ ): '''simple docstring''' def __init__( self , _snake_case , _snake_case ): super().__init__() self.register_modules(unet=_snake_case , scheduler=_snake_case ) d...
424
snake_case = [ "Audio", "Array2D", "Array3D", "Array4D", "Array5D", "ClassLabel", "Features", "Sequence", "Value", "Image", "Translation", "TranslationVariableLanguages", ] from .audio import Audio from .features import ArrayaD, ArrayaD, ArrayaD, ArrayaD, ClassLab...
424
1
'''simple docstring''' from __future__ import annotations def lowercase_ ( _lowercase ) -> list[int]: # This function is recursive '''simple docstring''' lowerCamelCase_ : int = len(__snake_case ) # If the array contains only one element, we return it (it's the st...
712
'''simple docstring''' import importlib.util import json import os import warnings from dataclasses import dataclass, field import torch from ..training_args import TrainingArguments from ..utils import cached_property, is_sagemaker_dp_enabled, logging __lowercase : Union[str, Any] = logging.get_...
357
0
"""simple docstring""" import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments __UpperCAmelCase = logging.getLogger(__name__) @dataclass class __lowercase...
65
"""simple docstring""" from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchF...
65
1
"""simple docstring""" from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _UpperCAmelCase ( SCREAMING_SNAKE_CASE_ ): __SCREAMING_SNAKE_CASE : Optional[int] = ["image_processor", "tokenizer"] __SCREAMING_SNA...
183
"""simple docstring""" from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class ...
183
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import tensorflow as tf from transformers import AutoTokenizer, TF...
78
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __a ( ) -> List[Any]: '''simple docstring''' UpperCAmelCase_= { """repo_name""": ["""test_repo1""", """test_repo2""", """test...
593
0
import unittest from typing import Tuple import torch from diffusers.utils import floats_tensor, randn_tensor, torch_all_close, torch_device from diffusers.utils.testing_utils import require_torch @require_torch class lowerCAmelCase_ : @property def __a ( self ): return s...
677
import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def __magic_name__ ( SCREAMING_SNAKE_CASE ) -> Optional[Any]: _lowercase : Tuple ...
677
1
"""simple docstring""" import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokeni...
96
"""simple docstring""" from random import randint from tempfile import TemporaryFile import numpy as np def a ( __UpperCAmelCase : Optional[Any] , __UpperCAmelCase : Optional[int] , __UpperCAmelCase : Optional[int] ) -> int: ...
96
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) snake_case = { """configuration_gpt_bigcode""": ["""GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTBigCodeConfig"""], } try: if...
706
'''simple docstring''' import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor snake_case = logging.getLogger(__name__) snake_case = ...
568
0
"""simple docstring""" import mpmath # for roots of unity import numpy as np class lowercase__ : def __init__( self , SCREAMING_SNAKE_CASE=None , SCREAMING_SNAKE_CASE=None) -> Tuple: # Input as list _lowerCamelCase : Any = list(poly_a or [0]...
88
"""simple docstring""" def UpperCamelCase ( _A , _A ) -> int: lowercase : int = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): lowercase : List[Any] = n - k # Calculate C(n,k) for i in range(_A ...
264
0
class SCREAMING_SNAKE_CASE_ : """simple docstring""" def __init__( self :Any , __lowercase :Dict ): __lowerCamelCase : List[Any] =arr.split(''',''' ) def __lowercase ( self :int ): __lowerCamelCas...
703
"""simple docstring""" from pickle import UnpicklingError import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict from ..utils import logging _UpperCamelCase = logging.get_logger(__name__...
363
0
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 SCREAMING_SNAKE_CASE_ ( _UpperCamelC...
279
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
279
1
import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class UpperCAmelCase_ ( unittest.TestCase ): """...
578
import os def __UpperCAmelCase ( ) -> Union[str, Any]: """simple docstring""" with open(os.path.dirname(__a ) + '''/grid.txt''' ) as f: _a : str = [] # noqa: E741 for _ in range(20 ): l.append([int(__a ) for x in f.read...
578
1
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 = { '''facebook/data2vec-text-base''': '''...
579
"""simple docstring""" import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class snake_case_ : """simple docstring""" def __init__( self , ...
260
0
'''simple docstring''' def lowerCAmelCase_ ( snake_case__ , snake_case__ ): '''simple docstring''' A : Optional[Any] = '''''' for i in table: res += inp[i - 1] return res def lowerCAmelCase_ ( snake_case__ ): ...
343
'''simple docstring''' def lowerCAmelCase_ ( snake_case__ ): '''simple docstring''' if len(snake_case__ ) <= 1: return [tuple(snake_case__ )] A : Dict = [] def generate(snake_case__ , snake_case__ ): if k == 1: ...
343
1
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_device from diffusers.utils.testin...
271
"""simple docstring""" import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate import Accelerator from ...
674
0
'''simple docstring''' from __future__ import annotations def a ( UpperCamelCase_ : list[int] , UpperCamelCase_ : list[int] , UpperCamelCase_ : list[int] , UpperCamelCase_ : list[list[str]] , UpperCamelCase_ : int , ) ...
712
'''simple docstring''' import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def a ( UpperCamelCase_ : str , UpperCamelCase_ : List[Any] , UpperCam...
581
0
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 1_0 ) -> str: '''simple docstring''' if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ) or n < 0: raise ValueError("Invalid input" ) A__ = 1_0**n A__ = ...
514
from datetime import datetime import requests def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str ) -> bytes: '''simple docstring''' A__ = "https://downloadgram.net/wp-json/wppress/video-downloader/video?url=" A__ = requests.get(base_url + ...
514
1
'''simple docstring''' def lowerCAmelCase ( UpperCamelCase__ : int = 1_0 , UpperCamelCase__ : int = 2_2 ): """simple docstring""" __UpperCAmelCase = range(1 , UpperCamelCase__ ) __UpperCAmelCase = range(1 , UpperCamelCase__ ) r...
654
'''simple docstring''' def lowerCAmelCase ( UpperCamelCase__ : int ): """simple docstring""" if not isinstance(UpperCamelCase__ , UpperCamelCase__ ): __UpperCAmelCase = f"""Input value of [number={number}] must be an integer""" raise TypeError(UpperCamelCa...
654
1
"""simple docstring""" from ..utils import ( OptionalDependencyNotAvailable, is_flax_available, is_scipy_available, is_torch_available, is_torchsde_available, ) try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependenc...
76
"""simple docstring""" import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase_ ( lowercase_ : int ,...
674
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING __SCREAMING_SNAKE_CASE = logging.get_logger(__name_...
709
from sklearn.metrics import recall_score import datasets __SCREAMING_SNAKE_CASE = """ Recall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation: Recall = TP / (TP + FN) Where TP is the true positives and FN is th...
17
0
'''simple docstring''' import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speec...
26
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCamelCase : Dict ={"configuration_focalnet": ["FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "FocalNetConfig"]} t...
316
0
"""simple docstring""" from __future__ import annotations def UpperCamelCase ( _A , _A , _A , _A ) -> List[Any]: # noqa: E741 while r - l > 1: lowercase : List[str] = (l + r) // 2 if v[m] >= key: lowercase ...
348
"""simple docstring""" from __future__ import annotations _lowerCAmelCase = [True] * 1_00_00_01 _lowerCAmelCase = 2 while i * i <= 1_00_00_00: if seive[i]: for j in range(i * i, 1_00_00_01, i): _lowerCAmelCase = False i += 1 def UpperCamelCase ...
348
1
'''simple docstring''' import inspect import os import re from transformers.configuration_utils import PretrainedConfig 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 # pytho...
489
'''simple docstring''' 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, Dist...
489
1
'''simple docstring''' import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTeste...
464
'''simple docstring''' import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def UpperCAmelCase ( A : Union[str, Any] , A : Optional[int] ...
464
1
def lowercase_ (A : int , A : Optional[Any] , A : Union[str, Any] ): return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(__A ) ) def lowercase_ (A : List[str] , A : Tuple ...
478
from pathlib import PurePosixPath from typing import Optional import fsspec from fsspec import AbstractFileSystem from huggingface_hub.hf_api import DatasetInfo from ..utils.file_utils import get_authentication_headers_for_url from ..utils.hub import hf_hub_url class lowercase__ ( __SCRE...
475
0
'''simple docstring''' def _snake_case ( lowercase ) -> Dict: for i in range(0 , lowercase ): for _ in range(0 , n - i - 1 ): # printing spaces print(""" """ , end="""""" ) for _ in range(0 , i + 1 ): # printing stars ...
715
'''simple docstring''' import qiskit def _snake_case ( lowercase , lowercase ) -> qiskit.result.counts.Counts: __a : Any = qiskit.Aer.get_backend("""aer_simulator""" ) # Create a Quantum Circuit acting on the q register __a : str ...
697
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCamelCase = logging.get_logger(__name__) _UpperCamelCase = { ...
459
'''simple docstring''' import argparse from collections import defaultdict import yaml _UpperCamelCase = 'docs/source/en/_toctree.yml' def a_ ( _lowerCAmelCase ) -> Any: __lowerCamelCase : Optional[int] = defaultdict(_lowerCAmelCase ) __lowerCam...
459
1
import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, req...
713
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def SCREAMING_SNAKE_CASE( __UpperCamelCase ) -> int: a__ : List[Any] = prime_factors(__UpperCamelCase ) if is_square_free(__UpperCamelCase ): return -1 if len(__UpperCamelCa...
207
0
import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format="%(message)s") def lowercase ( SCREAMING_SNAKE_CASE ) -> np.ndarray: '''simple docstring''' return input_array.reshape((input_array.size, 1) ) def lowercase ...
205
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 SCREAMING_SNAKE_CASE__ : Dict = logging.get_logger(__name__) SCREA...
205
1
'''simple docstring''' import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import List import timm import torch import torch.nn as nn from huggingface_hub import hf_hub_download from torch import Tensor from transformers import...
700
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCamelCase = { """configuration_mask2former""": [ """MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Mask2FormerConf...
454
0
'''simple docstring''' import os import pytest from attr import dataclass lowercase_ = """us-east-1""" # defaults region @dataclass class a_ : '''simple docstring''' UpperCamelCase = 42 UpperCamelCase = '''arn:aws:iam::558105141721:role/sagemake...
314
'''simple docstring''' from __future__ import annotations from collections.abc import Sequence from typing import Literal def lowerCamelCase ( __lowerCamelCase : str , __lowerCamelCase : str ) ->str | Literal[False]: _SCREAMING_SNAKE_CASE = list(__lowerCamel...
314
1
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 TFModelTesterMixin, ids_tensor, random_attention_mask ...
709
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...
306
0
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 logging loggin...
130
from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def __a ( ) -> int: '''simple docstring''' UpperCAmelCase_, UpperCAmelCase_= 9, 14 # noqa: F841 UpperCAmelCase_= [ [0, 1, 4], [0, 7, 8], ...
593
0
import os import sys import unittest lowercase_ = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, find_backend, r...
586
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.import_uti...
586
1
def A ( lowercase__ : int , lowercase__ : float , lowercase__ : float ) -> float: return round(float(moles / volume ) * nfactor ) def A ( lowercase__ : float , lowercase__ : float , lowercase__ : float ) -> float: return round(float((moles * 0.0821 * temperature) / (...
45
import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampler, SkipDataLoader, sk...
612
0
'''simple docstring''' from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time SCREAMING_SNAKE_CASE__ = Lock() def lowerCamelCase ( _snake_case : Any ,_snake_case : List[str] ...
539
'''simple docstring''' from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer SCREAMING_SNAKE_CASE__ ...
539
1
import logging import os from .state import PartialState class A ( logging.LoggerAdapter ): @staticmethod def lowercase_ (__UpperCAmelCase : Optional[int] ) -> Union[str, Any]: """simple docstring""" UpperCAmelCase__ = PartialSta...
486
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = '▁' Up...
486
1
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils import logging logging.set...
403
import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): import jax...
403
1
'''simple docstring''' import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' __lowercase : Optional[Any] = (DDIMParallelScheduler,) __lowercase : List...
365
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _UpperCAmelCase : Any = { '''configuration_maskformer''': ['''MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MaskFormerConf...
107
0
"""simple docstring""" from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging __A : List[Any] = logging.get_logger(__name__) # TODO Update this __A : Tuple = { "facebook/es...
708
"""simple docstring""" import operator def lowercase ( _SCREAMING_SNAKE_CASE : list , _SCREAMING_SNAKE_CASE : bool = False , _SCREAMING_SNAKE_CASE : list | None = None ): '''simple docstring''' _UpperCAmelCase = ...
95
0
import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase_ ( __a ) -> float: """simple docstring""" return np.dot(__a , __a ) class _SCREAMING_SNAKE_CASE : '''simple docstring'''...
59
from __future__ import annotations from math import pi def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_): """simple docstring""" if (inductance, frequency, reactance).count(0) != 1: raise ValueError("""One and only one argument must be 0""") if...
648
0
from __future__ import annotations UpperCamelCase_ = [] def A ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> bool: '''simple docstring''' for i in range(len(__UpperCAmelCase ) ): if board[row][i] == 1: ...
705
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = ...
561
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __a = logging.get_logger(__name__) class __lowercase ( __snake_case ): UpperCamelCase = '''timm_backbone''' def __init__( self : Optional[int] , ...
377
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def _UpperCamelCase ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ) ->Optional[Any]: UpperCAmelCase = ("""dense.weight""", """attention.self.query"...
377
1
'''simple docstring''' from __future__ import annotations import string from itertools import cycle, product from pathlib import Path UpperCamelCase__ = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) UpperCamelCase__ = [ord(letter) for letter in string.ascii_lowercase...
707
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import D...
640
0
'''simple docstring''' a_ = {'a': ['c', 'b'], 'b': ['d', 'e'], 'c': [], 'd': [], 'e': []} a_ = ['a', 'b', 'c', 'd', 'e'] def _a( UpperCamelCase__ : str, UpperCamelCase__ : str, UpperCamelCase__ : Dict ): '''simple doc...
296
'''simple docstring''' from __future__ import annotations import requests def _a( UpperCamelCase__ : str ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Tuple =f"https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pret...
296
1
'''simple docstring''' from __future__ import annotations from collections import Counter from random import random class UpperCAmelCase: """simple docstring""" def __init__( self ) -> Tuple: """simple docstring""" ...
720
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import PatchingSpec ...
298
0
'''simple docstring''' from __future__ import annotations def _a ( _lowerCamelCase , _lowerCamelCase ) -> bool: """simple docstring""" if len(_snake_case ) == 0: return False __snake_case : int = len(_sna...
26
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = {"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/config.json"""} class lowerCamelCase__ ( _A): """simple ...
2
0
'''simple docstring''' from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance lowercase__ = 6378137.0 lowercase__ = 6356752.314245 lowercase__ = 6_37_81_37 def __snake_case ( lowercase : float , lowe...
420
'''simple docstring''' from __future__ import annotations from numpy import array, cos, cross, floataa, radians, sin from numpy.typing import NDArray def __snake_case ( lowercase : float , lowercase : float , lowercase : bool = False ): if radian_mode...
420
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { "junn...
28
'''simple docstring''' from torch import nn def __lowercase (_lowercase ) -> Union[str, Any]: """simple docstring""" if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU() el...
150
0
def _UpperCamelCase (a__ :int , a__ :int ): """simple docstring""" return 1 if input_a == input_a else 0 def _UpperCamelCase (): """simple docstring""" assert xnor_gate(0 , 0 ) == 1 assert xnor_gate(0 , 1 ...
721
from typing import Any def _UpperCamelCase (a__ :list ): """simple docstring""" if not input_list: return [] UpperCamelCase__ = [input_list.count(a__ ) for value in input_list] UpperCamelCase__ = max(a__ ) #...
548
0
'''simple docstring''' def a_ ( UpperCamelCase_ ): return number & 1 == 0 if __name__ == "__main__": import doctest doctest.testmod()
452
'''simple docstring''' from __future__ import annotations from typing import Any def a_ ( UpperCamelCase_ ): create_state_space_tree(UpperCamelCase_ , [] , 0 ) def a_ ( UpperCamelCase_ , UpperCamelCase_ , UpperCamelCase_ ): if index == len(Upper...
452
1
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(""">=""", """4.25.0""")): raise OptionalDependencyNotA...
37
def __lowerCAmelCase ( SCREAMING_SNAKE_CASE_ ): if upper_limit < 0: raise ValueError("Limit for the Catalan sequence must be ≥ 0" ) lowercase__ = [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 lowercase__ = 1 if upper_limit > 0: lowercase__ = 1 ...
37
1
import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class UpperCAmelCase_ ( _SCREAMING_SNAKE_CASE ): __lowerCAmelCase : Optional[Any] = """""" __lowerCAmelCase : str = ( ...
188
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, ) ...
188
1
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import...
498
"""simple docstring""" import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def _lowerCAmelCase ( UpperCAmelCase__ : Tuple, UpperCAmelCase__ : Union[str, Any]=None ) ->Tuple...
498
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A = logging.get_logger(__name__) A = { """sayakpaul/vit-msn-base""": """https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json""", # See all ViT MSN models at ht...
77
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mvp import M...
505
0
import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class snake_case__ ( U...
709
from __future__ import annotations from math import ceil, floor, sqrt def lowercase__( A = 2_0_0_0_0_0_0 ): snake_case__ : list[int] = [0] snake_case__ : int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ): triangle_numbers.append...
303
0
"""simple docstring""" import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def UpperCAmelCase__ (snake_case__ : BertModel , snake_case__ : str , snake_case__ : str ): """simple docstrin...
609
"""simple docstring""" from scipy.stats import spearmanr import datasets A_ = ''' 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 correlat...
609
1
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFCommand from ....
153
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( lowerCAmelCase_ : str ,lowerCAmelCase_ : str ) -> bool: """simple docstring""" SCREAMING_SNAKE_CASE_ : Optional[int] =get_failure_array(lowerCAmelCase_ ) ...
153
1
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('>=', '4.25.0')): raise OptionalDependencyNotAvailable() ...
408
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingStrategy, logging from .tokenization_realm import RealmToken...
365
0
from dataclasses import dataclass, field from typing import Optional @dataclass class lowercase : _a = field( default="codeparrot/codeparrot",metadata={"help": "Model name or path of model to be trained."} ) _a = field( default="./",metadata={"help":...
54
from __future__ import annotations def lowerCAmelCase_ ( snake_case_,snake_case_ = None ): _A : Tuple = word_bank or [] # create a table _A : int = len(snake_case_ ) + 1 _A : list[list[list[str]]] = [] for _ in range(snake_case_ ):...
54
1
def _SCREAMING_SNAKE_CASE ( __snake_case ) -> int: if not isinstance(__snake_case , __snake_case ): raise ValueError("""multiplicative_persistence() only accepts integral values""" ) if num < 0: raise ValueError("""multiplicative_persistence()...
108
"""simple docstring""" from __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup __magic_name__ = "https://www.indeed.co.in/jobs?q=mobile+app+development&l=" def _lowerCAmelCase ( UpperCamelCase_ = "mumbai" ): __SCREAMI...
155
0
'''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.version""", """model....
162
'''simple docstring''' def A (__lowerCamelCase :str , __lowerCamelCase :str ): assert x is not None assert y is not None _lowerCAmelCase = len(__lowerCamelCase ) _lowerCAmelCase = len(__lowerCamelCase ) # declaring the array for storing the dp values ...
162
1
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmu...
653
"""simple docstring""" 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() A_ : str =logging.get_logger(__name__) A_ : Any ="""...
650
0
import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin c...
706
from __future__ import annotations from collections.abc import Generator def SCREAMING_SNAKE_CASE__ ( ) -> Generator[int, None, None]: _lowercase = {} _lowercase = 2 while True: _lowercase = factor_map.pop(snake_case__ , snake_case__ ...
535
0
'''simple docstring''' 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__ : Tuple =logging.get_logger(__name__) __magic_name__ : Optional[int] ={ "vocab_file": "voc...
664
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase__ : Tuple = logging.get_logger(__name__) lowerCamelCase__ : Any =...
698
0
from __future__ import annotations import matplotlib.pyplot as plt # type: ignore import numpy # initial triangle of Koch snowflake _A : Optional[int] = numpy.array([0, 0]) _A : Union[str, Any] = numpy.array([0.5, 0.8_66_02_54]) _A : List[Any] = numpy.array([1,...
705
from ..utils import ( OptionalDependencyNotAvailable, is_flax_available, is_scipy_available, is_torch_available, is_torchsde_available, ) try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ..utils.dummy_pt_objects imp...
189
0
'''simple docstring''' import unittest from transformers import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device if is_torch_available(): import torch from transformers import AutoModelForImageClassification if is_vision_av...
566
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_available, is_tf_avai...
566
1
import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAPPING, AutoConfig, Au...
703
'''simple docstring''' import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient _SCREAMING_SNAKE_CASE = WebClient(token=os.environ['''CI_SLACK_BOT_TOKEN''']) ...
56
0
'''simple docstring''' __lowerCAmelCase = '''0.18.2''' from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_available, is_k_diffusion_version, i...
358
'''simple docstring''' def __lowerCamelCase ( ) -> Union[str, Any]: _a : Optional[Any] = [] _a : List[str] = 1 while len(lowerCAmelCase_ ) < 1E6: constant.append(str(lowerCAmelCase_ ) ) i += 1 _a : Optional[Any] = ''.join(lowerCAmelCase_ ) return ...
358
1
'''simple docstring''' import logging import os from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional from tqdm import auto as tqdm_lib __A : int = ...
267
'''simple docstring''' import torch from transformers import AutoModel class __UpperCamelCase ( torch.nn.Module ): def __init__( self :Union[str, Any] ,_UpperCamelCase :Tuple="sayef/fsner-bert-base-uncased" ): super(_UpperCamelCase ,self ).__init__() sn...
267
1
import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_secondary_learner, ) from torch.utils.data import DataLoader, RandomS...
321
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { 'BridgeTower/bridgetower-base': 'https://huggingface.co/BridgeTower/bridgetower-base/blob/main/conf...
321
1
"""simple docstring""" import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class snake_...
374
"""simple docstring""" import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from_s...
374
1
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTokeniz...
661
"""simple docstring""" from __future__ import annotations from math import ceil, floor, sqrt def lowerCAmelCase_( lowercase_ : int = 2_00_00_00 ) -> int: _lowerCamelCase = [0] _lowerCamelCase = 42 for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ...
661
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import Autoencoder...
709
'''simple docstring''' import random def A_ ( snake_case , snake_case , snake_case = False ): SCREAMING_SNAKE_CASE:dict = {i: [] for i in range(snake_case )} # if probability is greater or equal than 1, then generate a complete graph if probability >...
465
0
def _lowercase ( __lowerCamelCase : int ) -> "list[int]": '''simple docstring''' if upper_limit < 0: raise ValueError('''Limit for the Catalan sequence must be ≥ 0''' ) UpperCamelCase__ : Optional[int] = [0] * (upper_limit + 1) # ...
344
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() _SCREAMING_SNAKE_CASE : str = [ """word_embeddings...
344
1
import unittest from transformers import BigBirdConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax from transformers.models.b...
719
import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from tax import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffusers.pipelines.spectrogram_d...
308
0
from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. SCREAMING_SNAKE_CASE_ = 200 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst of that generation and must b...
300
import os def __SCREAMING_SNAKE_CASE ( ) -> int: with open(os.path.dirname(lowerCAmelCase ) + "/grid.txt" ) as f: _UpperCAmelCase : Optional[Any] = [] # noqa: E741 for _ in range(20 ): l.append([int(lowerCAmelCase ) for x in f.readline().split(...
300
1
'''simple docstring''' def __UpperCamelCase ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ): lowercase__ : Tuple = len(UpperCAmelCase ) lowercase__ : Union[str, Any] = [[0] * n for i in range(UpperCAmelCase )] for i in range(UpperCAmelCase ): lowercas...
428
'''simple docstring''' from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __a: Optional[Any] = logging.get_logger(__name__) __a: str =...
428
1
import mpmath # for roots of unity import numpy as np class lowercase : def __init__( self : List[str] , _lowercase : Optional[int]=None , _lowercase : Optional[int]=None ): # Input as list SCREAMING_SNAKE_CASE__ : List[str] ...
35
import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class __lowerCAmelCase ( a , unittest.TestCase ): """simple docstring""" _SCREAMING_...
283
0
'''simple docstring''' import collections import gzip import os import urllib import numpy from tensorflow.python.framework import dtypes, random_seed from tensorflow.python.platform import gfile from tensorflow.python.util.deprecation import deprecated _UpperCamelCase = collecti...
211
'''simple docstring''' import argparse import datetime def _lowerCAmelCase( UpperCAmelCase_ : str ) -> str: lowerCAmelCase__ = { """0""": """Sunday""", """1""": """Monday""", """2""": """Tuesday""", """3""": """Wedne...
211
1
'''simple docstring''' # Lint as: python3 import itertools import os import re a_ : Optional[Any] = re.compile(R"""([A-Z]+)([A-Z][a-z])""") a_ : List[str] = re.compile(R"""([a-z\d])([A-Z])""") a_ : Optional[Any] = re.compile(R"""(?<!_)_(?!_)""") a_ : Optional[int] =...
676
'''simple docstring''' from __future__ import annotations def a_ ( __snake_case : int ) -> list[int]: """simple docstring""" lowerCamelCase_ =[True] * limit lowerCamelCase_ =False lowerCamelCase_ =False lowerCamelCase_ =True for i i...
676
1
import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_secondary_learner, ) from torch.utils.data import...
380
print((lambda quine: quine % quine)('print((lambda quine: quine %% quine)(%r))'))
380
1
"""simple docstring""" from ...processing_utils import ProcessorMixin class _lowerCAmelCase ( a ): """simple docstring""" __magic_name__ :Tuple = """WhisperFeatureExtractor""" __magic_name__ :Dict = """WhisperTokenizer""" def __init__( ...
93
'''simple docstring''' import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class _a ( __a ): """simple docstring""" A_ = (DDPMParallelScheduler,) def lowerCamelCase__ ( self : Optional[Any] , **...
451
0
from __future__ import annotations def A__ ( lowerCamelCase , lowerCamelCase ) -> list[list[int]]: UpperCamelCase_: list[list[int]] = [] UpperCamelCase_: list[int] = [] UpperCamelCase_: int = 0 UpperCamelCase_: Any = sum(lo...
670
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase ) -> Union[str, Any]: # Initialise PyTorc...
670
1