code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy _UpperCAmelCase = logging.get_logger(__name__) class ...
699
from __future__ import annotations import math def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int, lowerCAmelCase : bool, lowerCAmelCase : list[int], lowerCAmelCase : float ) -> int: if depth < 0: raise ValueError('Depth can...
699
1
from copy import deepcopy class _UpperCAmelCase : '''simple docstring''' def __init__( self : List[str] , UpperCamelCase__ : list[int] | None = None , UpperCamelCase__ : int | None = None ): if arr is None and size is not None: A = ...
699
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, TFAutoModelForSequenceCl...
699
1
from .data_collator import ( DataCollatorForLanguageModeling, DataCollatorForPermutationLanguageModeling, DataCollatorForSeqaSeq, DataCollatorForSOP, DataCollatorForTokenClassification, DataCollatorForWholeWordMask, DataCollatorWithPadding, DefaultDataCollator, default_data_collato...
699
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, ) _UpperCAmelCase = {"configuration_xglm": ["XGLM_PRETRAINED_C...
699
1
from typing import Dict from .base import GenericTensor, Pipeline class _UpperCAmelCase ( __lowercase ): '''simple docstring''' def UpperCamelCase ( self : Any , UpperCamelCase__ : Tuple=None , UpperCamelCase__ : Dict=None , UpperCamelCase__ ...
699
def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int ) -> Optional[int]: if b == 0: return 1 if (b % 2) == 0: return actual_power(lowerCAmelCase, int(b / 2 ) ) * actual_power(lowerCAmelCase, int(b / 2 ) ) else: r...
699
1
from __future__ import annotations import pandas as pd def __UpperCamelCase (lowerCAmelCase : list[int], lowerCAmelCase : list[int], lowerCAmelCase : int ) -> list[int]: A = [0] * no_of_processes A = [0] * no_of_processes # Copy the burst time i...
699
def __UpperCamelCase (lowerCAmelCase : list[int] ) -> int: if not numbers: return 0 if not isinstance(lowerCAmelCase, (list, tuple) ) or not all( isinstance(lowerCAmelCase, lowerCAmelCase ) for number in numbers ): raise ValueError('numbers m...
699
1
from math import isqrt def __UpperCamelCase (lowerCAmelCase : int ) -> bool: return all(number % divisor != 0 for divisor in range(2, isqrt(lowerCAmelCase ) + 1 ) ) def __UpperCamelCase (lowerCAmelCase : int = 10**6 ) -> int: A = 0 A = 1 ...
699
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassificat...
699
1
class _UpperCAmelCase : '''simple docstring''' def __init__( self : Optional[Any] , UpperCamelCase__ : list[int] ): A = len(UpperCamelCase__ ) A = [0] * len_array if len_array > 0: A = array[0] for i in ra...
699
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://huggin...
699
1
from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor, ...
699
import sys def __UpperCamelCase (lowerCAmelCase : Dict ) -> Dict: A = len(lowerCAmelCase ) A = [[0 for x in range(lowerCAmelCase )] for x in range(lowerCAmelCase )] A = [[0 for x in range(lowerCAmelCase )] for x in range(lowerCAmelCase )] for chai...
699
1
# This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for tests from os.path import join ...
699
from math import isqrt def __UpperCamelCase (lowerCAmelCase : int ) -> bool: return all(number % divisor != 0 for divisor in range(2, isqrt(lowerCAmelCase ) + 1 ) ) def __UpperCamelCase (lowerCAmelCase : int = 10**6 ) -> int: A = 0 A = 1 ...
699
1
from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common im...
699
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor _UpperCAmelCase = logging.get_logger(__name__) class _UpperCAmelCase ( __lowercase ): '''simple docstring''' def __init__( self : List[str] , *UpperCame...
699
1
def __UpperCamelCase (lowerCAmelCase : int ) -> list[int]: if length <= 0 or not isinstance(lowerCAmelCase, lowerCAmelCase ): raise ValueError('Length must be a positive integer.' ) return [n * (2 * n - 1) for n in range(lowerCAmelCase )] if __name__ == "__main__": ...
699
from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddings @maybe_allow_in_graph class ...
699
1
import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel _UpperCAmelCase = logging.getLogger(__name...
699
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "vocab_file": "vocab.json", "tokenizer_config_file": "to...
699
1
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 accelerate import Acce...
699
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
699
1
import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __UpperCamelCase (lowerCA...
699
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging _UpperCAmelCase = logging.get_logger(__name__) def __UpperCamelCase (lowerCAmelCase : List[str] ) -> Dict: A = r'...
699
1
import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, AutoencoderKL, DDIMS...
699
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class _UpperCAmelCase : '''simple docstring''' def __init__( self : List[Any] , UpperCamelCase__ : Collection[float] | None = None ): if...
699
1
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel _UpperCAmelCase = { "text_branch": "text_model", "audio_branch": "audio_model.audio_encoder", "attn": "attention.self", "self.proj": "output.dens...
699
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.uti...
699
1
from math import factorial _UpperCAmelCase = {str(digit): factorial(digit) for digit in range(10)} def __UpperCamelCase (lowerCAmelCase : int ) -> int: if not isinstance(lowerCAmelCase, lowerCAmelCase ): raise TypeError('Parameter number must be int' ) ...
699
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 _UpperCAmelCase ( __lowercase ): '''simple docstring...
699
1
import json import os import pickle import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers import is_faiss_available from transformers.models.bart.configuration_bart import BartConfig from transformers.models.bart...
699
def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int ) -> str: return "\n".join( f'''{number} * {i} = {number * i}''' for i in range(1, number_of_terms + 1 ) ) if __name__ == "__main__": print(multiplication_table(number=5, number_of_terms=10))
699
1
import os def __UpperCamelCase () -> Optional[int]: A = os.path.join(os.path.dirname(lowerCAmelCase ), 'num.txt' ) with open(lowerCAmelCase ) as file_hand: return str(sum(int(lowerCAmelCase ) for line in file_hand ) )[:10] if __name__ == "__main__": print(solu...
699
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 _UpperCAmelCase ( __lowercase , __lowercase ): ...
699
1
import os import jsonlines import numpy as np from tqdm import tqdm _UpperCAmelCase = 2_048 _UpperCAmelCase = 4_096 _UpperCAmelCase = 42 _UpperCAmelCase = os.environ.pop("PROCESS_TRAIN", "false") _UpperCAmelCase = {"null": 0, "short": 1, "l...
699
import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 _UpperCAmelCase = 0b10_11_00_11_11_10_11_00_10_01_00_00_01_11_10_11_10_11_00_01_...
699
1
# NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline # noqa: F401 deprecate( ...
699
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "post_extract_proj": "feature_projecti...
699
1
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(...
699
from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar _UpperCAmelCase = TypeVar("T") class _UpperCAmelCase ( Generic[T] ): '''simple docstring''' def __init__( self : Tuple , UpperCamelCase__ : T )...
699
1
class _UpperCAmelCase : '''simple docstring''' def __init__( self : Tuple ): A = {} def UpperCamelCase ( self : List[Any] ): print(self.vertex ) for i in self.vertex: print(UpperCamelCase__ , ' -> ' , ...
699
from __future__ import annotations import math def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int, lowerCAmelCase : bool, lowerCAmelCase : list[int], lowerCAmelCase : float ) -> int: if depth < 0: raise ValueError('Depth can...
699
1
from __future__ import annotations def __UpperCamelCase (lowerCAmelCase : list, lowerCAmelCase : int, lowerCAmelCase : int, lowerCAmelCase : int ) -> list: A = [] A , A = input_list[low:mid], input_list[mid : high + 1] while left...
699
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, TFAutoModelForSequenceCl...
699
1
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder _UpperCAmelCase = datasets.utils.logging.get_logger(__name__) class _UpperCAmelCase ( folder_based_builder.FolderBasedBuilderConfig ): ''...
699
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, ) _UpperCAmelCase = {"configuration_xglm": ["XGLM_PRETRAINED_C...
699
1
import unittest from transformers import AutoTokenizer, FalconConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Model...
699
def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int ) -> Optional[int]: if b == 0: return 1 if (b % 2) == 0: return actual_power(lowerCAmelCase, int(b / 2 ) ) * actual_power(lowerCAmelCase, int(b / 2 ) ) else: r...
699
1
import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCLIPTextConfig, XCLIPVisionConfig, ) def __U...
699
def __UpperCamelCase (lowerCAmelCase : list[int] ) -> int: if not numbers: return 0 if not isinstance(lowerCAmelCase, (list, tuple) ) or not all( isinstance(lowerCAmelCase, lowerCAmelCase ) for number in numbers ): raise ValueError('numbers m...
699
1
from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline _UpperCAmelCase = logging.get_logger(__name__) class _UpperCAmelCase ...
699
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassificat...
699
1
import numpy as np import qiskit def __UpperCamelCase (lowerCAmelCase : int = 8, lowerCAmelCase : int | None = None ) -> str: A = np.random.default_rng(seed=lowerCAmelCase ) # Roughly 25% of the qubits will contribute to the key. # So we take more than we need....
699
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://huggin...
699
1
import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate from flax.training.common_utils import sha...
699
import sys def __UpperCamelCase (lowerCAmelCase : Dict ) -> Dict: A = len(lowerCAmelCase ) A = [[0 for x in range(lowerCAmelCase )] for x in range(lowerCAmelCase )] A = [[0 for x in range(lowerCAmelCase )] for x in range(lowerCAmelCase )] for chai...
699
1
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging _UpperCAmelCase = ...
699
from math import isqrt def __UpperCamelCase (lowerCAmelCase : int ) -> bool: return all(number % divisor != 0 for divisor in range(2, isqrt(lowerCAmelCase ) + 1 ) ) def __UpperCamelCase (lowerCAmelCase : int = 10**6 ) -> int: A = 0 A = 1 ...
699
1
import math from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import SchedulerMixin, SchedulerOutput class _UpperCAmelCase ( __lowercase , __lowercase ): '''simple docstring...
699
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor _UpperCAmelCase = logging.get_logger(__name__) class _UpperCAmelCase ( __lowercase ): '''simple docstring''' def __init__( self : List[str] , *UpperCame...
699
1
# 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 required by applica...
699
from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddings @maybe_allow_in_graph class ...
699
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_camembert import ...
699
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "vocab_file": "vocab.json", "tokenizer_config_file": "to...
699
1
import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( TEXT_GUIDED_IMAGE_INPAI...
699
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
699
1
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class _UpperCAmelCase : '''simple docstring''' def __init__( self : List[Any] , UpperCamelCase__ : Collection[float] | None = None ): if...
699
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging _UpperCAmelCase = logging.get_logger(__name__) def __UpperCamelCase (lowerCAmelCase : List[str] ) -> Dict: A = r'...
699
1
import argparse import math import os from copy import deepcopy import torch from audio_diffusion.models import DiffusionAttnUnetaD from diffusion import sampling from torch import nn from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel _UpperCAmelCase = { "gwf-440k": { ...
699
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class _UpperCAmelCase : '''simple docstring''' def __init__( self : List[Any] , UpperCamelCase__ : Collection[float] | None = None ): if...
699
1
from __future__ import annotations from random import random class _UpperCAmelCase : '''simple docstring''' def __init__( self : List[Any] , UpperCamelCase__ : int | None = None ): A = value A = random() A = None A =...
699
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.uti...
699
1
import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) class _UpperCAmelCase ( __lowercase ): '''simple docstring''' ...
699
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 _UpperCAmelCase ( __lowercase ): '''simple docstring...
699
1
# 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 required by applica...
699
def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int ) -> str: return "\n".join( f'''{number} * {i} = {number * i}''' for i in range(1, number_of_terms + 1 ) ) if __name__ == "__main__": print(multiplication_table(number=5, number_of_terms=10))
699
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch ...
699
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 _UpperCAmelCase ( __lowercase , __lowercase ): ...
699
1
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start_docstrings_t...
699
import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 _UpperCAmelCase = 0b10_11_00_11_11_10_11_00_10_01_00_00_01_11_10_11_10_11_00_01_...
699
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = "▁" _UpperCAmelC...
699
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "post_extract_proj": "feature_projecti...
699
1
def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int ) -> str: return "\n".join( f'''{number} * {i} = {number * i}''' for i in range(1, number_of_terms + 1 ) ) if __name__ == "__main__": print(multiplication_table(number=5, number_of_terms=10))
699
from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar _UpperCAmelCase = TypeVar("T") class _UpperCAmelCase ( Generic[T] ): '''simple docstring''' def __init__( self : Tuple , UpperCamelCase__ : T )...
699
1
import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _UpperCAmelCase = get_tests_dir("fixtures/spiece.mod...
699
from __future__ import annotations import math def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int, lowerCAmelCase : bool, lowerCAmelCase : list[int], lowerCAmelCase : float ) -> int: if depth < 0: raise ValueError('Depth can...
699
1
import json import os import unittest from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES, XLMTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class _UpperCAmelCase ( __lowercase , unittest.TestCase ): '''si...
699
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, TFAutoModelForSequenceCl...
699
1
class _UpperCAmelCase : '''simple docstring''' def __init__( self : List[str] ): A = 0 A = 0 A = {} def UpperCamelCase ( self : Any , UpperCamelCase__ : List[Any] ): if vertex not in self.adj...
699
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, ) _UpperCAmelCase = {"configuration_xglm": ["XGLM_PRETRAINED_C...
699
1
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "vocab_file": "vocab.json", "tokenizer_config_file": "to...
699
def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int ) -> Optional[int]: if b == 0: return 1 if (b % 2) == 0: return actual_power(lowerCAmelCase, int(b / 2 ) ) * actual_power(lowerCAmelCase, int(b / 2 ) ) else: r...
699
1
import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_t...
699
def __UpperCamelCase (lowerCAmelCase : list[int] ) -> int: if not numbers: return 0 if not isinstance(lowerCAmelCase, (list, tuple) ) or not all( isinstance(lowerCAmelCase, lowerCAmelCase ) for number in numbers ): raise ValueError('numbers m...
699
1
from .testing import ( are_the_same_tensors, execute_subprocess_async, require_bnb, require_cpu, require_cuda, require_huggingface_suite, require_mps, require_multi_gpu, require_multi_xpu, require_safetensors, require_single_gpu, require_single_xpu, require_torch_mi...
699
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassificat...
699
1
def __UpperCamelCase (lowerCAmelCase : int = 50 ) -> int: A = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2, 5 ): for tile_start in range(row_length - tile_length + 1 ): ...
699
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://huggin...
699
1
from __future__ import annotations def __UpperCamelCase (lowerCAmelCase : dict, lowerCAmelCase : str ) -> set[str]: A , A = set(lowerCAmelCase ), [start] while stack: A = stack.pop() explored.add(lowerCAmelCase ) # D...
699
import sys def __UpperCamelCase (lowerCAmelCase : Dict ) -> Dict: A = len(lowerCAmelCase ) A = [[0 for x in range(lowerCAmelCase )] for x in range(lowerCAmelCase )] A = [[0 for x in range(lowerCAmelCase )] for x in range(lowerCAmelCase )] for chai...
699
1
# 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 required by applica...
699
from math import isqrt def __UpperCamelCase (lowerCAmelCase : int ) -> bool: return all(number % divisor != 0 for divisor in range(2, isqrt(lowerCAmelCase ) + 1 ) ) def __UpperCamelCase (lowerCAmelCase : int = 10**6 ) -> int: A = 0 A = 1 ...
699
1
import random from typing import Any def __UpperCamelCase (lowerCAmelCase : list ) -> list[Any]: for _ in range(len(lowerCAmelCase ) ): A = random.randint(0, len(lowerCAmelCase ) - 1 ) A = random.randint(0, len(lowerCAmelCase ) - 1 ) ...
699
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor _UpperCAmelCase = logging.get_logger(__name__) class _UpperCAmelCase ( __lowercase ): '''simple docstring''' def __init__( self : List[str] , *UpperCame...
699
1
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "post_extract_proj": "feature_projecti...
699
from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddings @maybe_allow_in_graph class ...
699
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 ...
699
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "vocab_file": "vocab.json", "tokenizer_config_file": "to...
699
1
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 _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = R"\n Args:\n input_ids (`torch.LongTensor`...
699
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
699
1
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching between checkout...
699
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging _UpperCAmelCase = logging.get_logger(__name__) def __UpperCamelCase (lowerCAmelCase : List[str] ) -> Dict: A = r'...
699
1
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 _UpperCAmelCase ( __lowercase , __lowercase ): ...
699
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class _UpperCAmelCase : '''simple docstring''' def __init__( self : List[Any] , UpperCamelCase__ : Collection[float] | None = None ): if...
699
1
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class _UpperCAmelCase ( unittest.TestCase ): '''simple docstring''' SCREAMING_SNAKE_CASE : Dict = JukeboxTokenizer SCREAMING_SNAKE_CASE : Optional[An...
699
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.uti...
699
1
import operator as op _UpperCAmelCase = "scaler.pt" _UpperCAmelCase = "pytorch_model" _UpperCAmelCase = "random_states" _UpperCAmelCase = "optimizer" _UpperCAmelCase = "scheduler" _UpperCAmelCase = "pytorch_model.bin" _UpperCA...
699
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 _UpperCAmelCase ( __lowercase ): '''simple docstring...
699
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _UpperCAmelCase = { "configuration_roberta": ["ROBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP", "...
699
def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int ) -> str: return "\n".join( f'''{number} * {i} = {number * i}''' for i in range(1, number_of_terms + 1 ) ) if __name__ == "__main__": print(multiplication_table(number=5, number_of_terms=10))
699
1
from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def __UpperCamelCase (lowerCAmelCase : str, lowerCAmelCase : float | Decimal, lowerCAmelCase : float = 10**-10 ) -> float: A = a while Tru...
699
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 _UpperCAmelCase ( __lowercase , __lowercase ): ...
699
1
import unittest from queue import Empty from threading import Thread from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available from transformers.testing_utils import CaptureStdout, require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(...
699
import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 _UpperCAmelCase = 0b10_11_00_11_11_10_11_00_10_01_00_00_01_11_10_11_10_11_00_01_...
699
1
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, ) if is_sentencepiece_available(): from ..ta.tokenization_ta import TaToken...
699
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "post_extract_proj": "feature_projecti...
699
1
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils import...
699
from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar _UpperCAmelCase = TypeVar("T") class _UpperCAmelCase ( Generic[T] ): '''simple docstring''' def __init__( self : Tuple , UpperCamelCase__ : T )...
699
1
from collections.abc import Generator from math import sin def __UpperCamelCase (lowerCAmelCase : bytes ) -> bytes: if len(lowerCAmelCase ) != 32: raise ValueError('Input must be of length 32' ) A = b'' for i in [3, 2, 1, 0]: little_endian += str...
699
from __future__ import annotations import math def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int, lowerCAmelCase : bool, lowerCAmelCase : list[int], lowerCAmelCase : float ) -> int: if depth < 0: raise ValueError('Depth can...
699
1
import sys def __UpperCamelCase (lowerCAmelCase : Dict ) -> Dict: A = len(lowerCAmelCase ) A = [[0 for x in range(lowerCAmelCase )] for x in range(lowerCAmelCase )] A = [[0 for x in range(lowerCAmelCase )] for x in range(lowerCAmelCase )] for chai...
699
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, TFAutoModelForSequenceCl...
699
1
import warnings from ...utils import logging from .image_processing_segformer import SegformerImageProcessor _UpperCAmelCase = logging.get_logger(__name__) class _UpperCAmelCase ( __lowercase ): '''simple docstring''' def __init__( self : Optional[int] , *Upp...
699
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, ) _UpperCAmelCase = {"configuration_xglm": ["XGLM_PRETRAINED_C...
699
1
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mobilebert import MobileBertTokenizer _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCas...
699
def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int ) -> Optional[int]: if b == 0: return 1 if (b % 2) == 0: return actual_power(lowerCAmelCase, int(b / 2 ) ) * actual_power(lowerCAmelCase, int(b / 2 ) ) else: r...
699
1
from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar _UpperCAmelCase = TypeVar("T") class _UpperCAmelCase ( Generic[T] ): '''simple docstring''' def __init__( self : Tuple , UpperCamelCase__ : T )...
699
def __UpperCamelCase (lowerCAmelCase : list[int] ) -> int: if not numbers: return 0 if not isinstance(lowerCAmelCase, (list, tuple) ) or not all( isinstance(lowerCAmelCase, lowerCAmelCase ) for number in numbers ): raise ValueError('numbers m...
699
1
import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow _UpperCAmelCase = False class _UpperCAmelCase ( unittest.TestCase ): '''simple docstring''' ...
699
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassificat...
699
1
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging _UpperCAmelCase = logging.get_logger(__name__) def __UpperCamelCase (lowerCAmelCase : List[str] ) -> Dict: A = r'...
699
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://huggin...
699
1
def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int ) -> str: if a < 0 or b < 0: raise ValueError('the value of both inputs must be positive' ) A = str(bin(lowerCAmelCase ) )[2:] # remove the leading "0b" A = str(bin(lowerCAmelCa...
699
import sys def __UpperCamelCase (lowerCAmelCase : Dict ) -> Dict: A = len(lowerCAmelCase ) A = [[0 for x in range(lowerCAmelCase )] for x in range(lowerCAmelCase )] A = [[0 for x in range(lowerCAmelCase )] for x in range(lowerCAmelCase )] for chai...
699
1
from cva import destroyAllWindows, imread, imshow, waitKey def __UpperCamelCase (lowerCAmelCase : Optional[int] ) -> Union[str, Any]: # getting number of pixels in the image A , A = img.shape[0], img.shape[1] # converting each pixel's color to its negative fo...
699
from math import isqrt def __UpperCamelCase (lowerCAmelCase : int ) -> bool: return all(number % divisor != 0 for divisor in range(2, isqrt(lowerCAmelCase ) + 1 ) ) def __UpperCamelCase (lowerCAmelCase : int = 10**6 ) -> int: A = 0 A = 1 ...
699
1
import unittest from transformers import BertGenerationTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin _UpperCAmelCase = "▁" _Upper...
699
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor _UpperCAmelCase = logging.get_logger(__name__) class _UpperCAmelCase ( __lowercase ): '''simple docstring''' def __init__( self : List[str] , *UpperCame...
699
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _UpperCAmelCase = { "configuration_distilbert": [ "DISTILBERT_PRETRAINED_CONFIG_...
699
from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddings @maybe_allow_in_graph class ...
699
1
import numpy class _UpperCAmelCase : '''simple docstring''' def __init__( self : Optional[int] , UpperCamelCase__ : numpy.ndarray , UpperCamelCase__ : numpy.ndarray ): A = input_array # Random initial weights are assigned where first argu...
699
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "vocab_file": "vocab.json", "tokenizer_config_file": "to...
699
1
from __future__ import annotations def __UpperCamelCase (lowerCAmelCase : str, lowerCAmelCase : str ) -> bool: A = get_failure_array(lowerCAmelCase ) # 2) Step through text searching for pattern A , A = 0, 0 # index into text, pattern while...
699
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
699
1
import csv from collections import defaultdict from dataclasses import dataclass, field from typing import List, Optional import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import ScalarFormatter from transformers import HfArgumentParser def __UpperCamelCase (lowerCAmelCase ...
699
import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging _UpperCAmelCase = logging.get_logger(__name__) def __UpperCamelCase (lowerCAmelCase : List[str] ) -> Dict: A = r'...
699
1
from torch import nn class _UpperCAmelCase ( nn.Module ): '''simple docstring''' def __init__( self : Optional[int] , UpperCamelCase__ : Optional[Any] , UpperCamelCase__ : Tuple ): super().__init__() A = class_size A = ...
699
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class _UpperCAmelCase : '''simple docstring''' def __init__( self : List[Any] , UpperCamelCase__ : Collection[float] | None = None ): if...
699
1
from typing import Dict, List, Optional, Tuple, Union import torch from ...models import AutoencoderKL, TransformeraDModel from ...schedulers import KarrasDiffusionSchedulers from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class _UpperCAmelCase ( __l...
699
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.uti...
699
1
import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils impor...
699
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 _UpperCAmelCase ( __lowercase ): '''simple docstring...
699
1
from typing import Dict, Optional import numpy as np import datasets _UpperCAmelCase = "\nIoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union\nbetween the predicted segmentation and the ground truth. For binary (two classes) or multi-class...
699
def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int ) -> str: return "\n".join( f'''{number} * {i} = {number * i}''' for i in range(1, number_of_terms + 1 ) ) if __name__ == "__main__": print(multiplication_table(number=5, number_of_terms=10))
699
1
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 from ...tokenization_ut...
699
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 _UpperCAmelCase ( __lowercase , __lowercase ): ...
699
1
import os import re import shutil import sys import tempfile import unittest import black _UpperCAmelCase = 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_copies # noqa: E402 # This is the reference ...
699
import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 _UpperCAmelCase = 0b10_11_00_11_11_10_11_00_10_01_00_00_01_11_10_11_10_11_00_01_...
699
1
from __future__ import annotations import math from collections.abc import Callable def __UpperCamelCase (lowerCAmelCase : Callable[[int | float], int | float], lowerCAmelCase : int | float, lowerCAmelCase : int | float, lowerCAmelCase : int = 100, ) -> float: ...
699
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "post_extract_proj": "feature_projecti...
699
1
def __UpperCamelCase (lowerCAmelCase : str, lowerCAmelCase : str ) -> str: if not (isinstance(lowerCAmelCase, lowerCAmelCase ) and isinstance(lowerCAmelCase, lowerCAmelCase )): raise ValueError('longest_common_substring() takes two strings for inputs' ) ...
699
from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar _UpperCAmelCase = TypeVar("T") class _UpperCAmelCase ( Generic[T] ): '''simple docstring''' def __init__( self : Tuple , UpperCamelCase__ : T )...
699
1
from timeit import timeit def __UpperCamelCase (lowerCAmelCase : int ) -> int: if number < 0: raise ValueError('the value of input must not be negative' ) A = 0 while number: number &= number - 1 result += 1 return result def ...
699
from __future__ import annotations import math def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int, lowerCAmelCase : bool, lowerCAmelCase : list[int], lowerCAmelCase : float ) -> int: if depth < 0: raise ValueError('Depth can...
699
1
def __UpperCamelCase (lowerCAmelCase : int = 1_000 ) -> int: return sum(e for e in range(3, lowerCAmelCase ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F'''{solution() = }''')
699
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, TFAutoModelForSequenceCl...
699
1
def __UpperCamelCase (lowerCAmelCase : list[int] ) -> int: if not numbers: return 0 if not isinstance(lowerCAmelCase, (list, tuple) ) or not all( isinstance(lowerCAmelCase, lowerCAmelCase ) for number in numbers ): raise ValueError('numbers m...
699
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, ) _UpperCAmelCase = {"configuration_xglm": ["XGLM_PRETRAINED_C...
699
1
from ..utils import DummyObject, requires_backends class _UpperCAmelCase ( metaclass=__lowercase ): '''simple docstring''' SCREAMING_SNAKE_CASE : Optional[Any] = ['''sentencepiece'''] def __init__( self : Optional[Any] , *UpperCamelCase__ : ...
699
def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : int ) -> Optional[int]: if b == 0: return 1 if (b % 2) == 0: return actual_power(lowerCAmelCase, int(b / 2 ) ) * actual_power(lowerCAmelCase, int(b / 2 ) ) else: r...
699
1
import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import Config...
699
def __UpperCamelCase (lowerCAmelCase : list[int] ) -> int: if not numbers: return 0 if not isinstance(lowerCAmelCase, (list, tuple) ) or not all( isinstance(lowerCAmelCase, lowerCAmelCase ) for number in numbers ): raise ValueError('numbers m...
699
1
from math import isqrt def __UpperCamelCase (lowerCAmelCase : int ) -> list[int]: A = [True] * max_number for i in range(2, isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2, lowerCAmelCase, lowerCAmelCase ): ...
699
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassificat...
699
1
import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print("Googling.....") _UpperCAmelCase = "https://www.google.com/search?q=" + " ".join(sys.argv[1:]) _UpperCAmelCase = requests.get(url, head...
699
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://huggin...
699
1
def __UpperCamelCase (lowerCAmelCase : int, lowerCAmelCase : list[int], lowerCAmelCase : int ) -> int: def count_of_possible_combinations(lowerCAmelCase : int ) -> int: if target < 0: return 0 if target == 0: ...
699
import sys def __UpperCamelCase (lowerCAmelCase : Dict ) -> Dict: A = len(lowerCAmelCase ) A = [[0 for x in range(lowerCAmelCase )] for x in range(lowerCAmelCase )] A = [[0 for x in range(lowerCAmelCase )] for x in range(lowerCAmelCase )] for chai...
699
1
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_numpy, slow, t...
699
from math import isqrt def __UpperCamelCase (lowerCAmelCase : int ) -> bool: return all(number % divisor != 0 for divisor in range(2, isqrt(lowerCAmelCase ) + 1 ) ) def __UpperCamelCase (lowerCAmelCase : int = 10**6 ) -> int: A = 0 A = 1 ...
699
1
def __UpperCamelCase (lowerCAmelCase : int ) -> list: # bit count represents no. of bits in the gray code if bit_count < 0: raise ValueError('The given input must be positive' ) # get the generated string sequence A = gray_code_sequence_string(lowerCAmel...
699
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor _UpperCAmelCase = logging.get_logger(__name__) class _UpperCAmelCase ( __lowercase ): '''simple docstring''' def __init__( self : List[str] , *UpperCame...
699
1
def __UpperCamelCase () -> int: return [ a * b * (1_000 - a - b) for a in range(1, 999 ) for b in range(lowerCAmelCase, 999 ) if (a * a + b * b == (1_000 - a - b) ** 2) ][0] if __name__ == "__main__": print(F'''{solution() = }''')
699
from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddings @maybe_allow_in_graph class ...
699
1
from collections.abc import Sequence from queue import Queue class _UpperCAmelCase : '''simple docstring''' def __init__( self : Optional[Any] , UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : Optional[Any] , UpperCamelCase__ : Tuple , Upper...
699
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { "vocab_file": "vocab.json", "tokenizer_config_file": "to...
699
1