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
'''simple docstring''' 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_tens...
210
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
0
from math import sqrt def _lowercase ( UpperCamelCase_ ) -> bool: '''simple docstring''' assert isinstance(UpperCamelCase_ , UpperCamelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" SCREAMING_SNAKE_CASE__ = True ...
472
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
0
"""simple docstring""" from __future__ import annotations import pandas as pd def snake_case__ ( _lowerCamelCase, _lowerCamelCase, _lowerCamelCase ) ->list[int]: """simple docstring""" __lowercase : int = [0] * no_of_processes __lowercase : Optio...
575
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
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : Dict = logging.get_logger(__name__) _lowerCAmelCase : int = { '''microsoft/biogpt''': '''https://huggingface.co/microsoft/biogpt/resolve/main/config.json''', # ...
454
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
0
"""simple docstring""" from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _lowerCAmelCase ( __lowercase ...
178
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
0
'''simple docstring''' 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 fro...
501
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
0
import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from torch.utils.data import DataL...
632
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
0
def UpperCAmelCase_ ( __lowerCAmelCase ) -> "list[int]": if upper_limit < 0: raise ValueError('''Limit for the Catalan sequence must be ≥ 0''' ) __lowercase : List[Any] = [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 __lowercase : ...
509
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
0
"""simple docstring""" import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem lowercase_ = importlib.util.find_spec("s3fs") is not None if _has_safs: from ...
470
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
0
'''simple docstring''' from itertools import product def UpperCamelCase ( _lowerCamelCase : int , _lowerCamelCase : int ): A__ = sides_number A__ = max_face_number * dice_number A__ = [0] * (max_total + 1) A__ = 1 A__ ...
440
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
0
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(...
61
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
0
'''simple docstring''' import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging _lowercase : Dict = logging.get_logger(__name__) def lowerCamelCase__ ( A : List[str] ): '''simple ...
210
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
0
import dataclasses import re import string from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple import numpy as np from . import residue_constants __snake_case = Mapping[str, np.ndarray] __snake_case = Mapping[str, Any] # Is a nested dict. __snake_case ...
472
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
0
"""simple docstring""" from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. __A : Optional[Any] = 2_0_0 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst...
575
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
0
def __snake_case ( _lowerCAmelCase : int , _lowerCAmelCase : list[int] , _lowerCAmelCase : int ) -> int: def count_of_possible_combinations(_lowerCAmelCase : int ) -> int: if target < 0: return 0 if target == 0: return 1 ...
454
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
0
"""simple docstring""" 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 __snake_case = get_tests_dir...
178
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
0
'''simple docstring''' import os def __snake_case (): """simple docstring""" lowerCamelCase_ : int = os.path.join(os.path.dirname(__UpperCAmelCase ) , '''num.txt''' ) with open(__UpperCAmelCase ) as file_hand: return str(sum(int(__UpperCAmelCase ) for ...
501
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
0
import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Ac...
632
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
0
from __future__ import annotations def UpperCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase ) -> bool: __lowercase : List[Any] = get_failure_array(__lowerCAmelCase ) # 2) Step through text searching for pattern __lowercase , __lowerc...
509
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
0
"""simple docstring""" 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, lo...
470
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
0
'''simple docstring''' # 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 tes...
440
# 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
0
import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterMix...
61
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
0
'''simple docstring''' def lowerCamelCase__ ( A : int ): '''simple docstring''' UpperCAmelCase = n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(27)) print(perfect_cube(4))
210
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
0
from math import isqrt def _lowercase ( UpperCamelCase_ ) -> bool: '''simple docstring''' return all(number % divisor != 0 for divisor in range(2 , isqrt(UpperCamelCase_ ) + 1 ) ) def _lowercase ( UpperCamelCase_ = 10**6 ) -> ...
472
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
0
"""simple docstring""" import math import os import sys def snake_case__ ( _lowerCamelCase ) ->str: """simple docstring""" __lowercase : Any = "" try: with open(_lowerCamelCase, "rb" ) as binary_file: __lowercase : Tuple = ...
575
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
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
454
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
0
"""simple docstring""" import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def __lowerCAmelCase ( ) -> None: """simple docstring""" print("Making key files..." ) make_key_f...
178
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
0
'''simple docstring''' import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel __lowerCamelCase : Dict = HfApi() __lowerCamelCase : str = {} # fmt: off __lowerCamelCase : List[str] = torch.tensor([ -0.7_5_1_5,...
501
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
0
# Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def lowerCAmelCase__ ( UpperCamelCase_ : Union[str, Any] , UpperCamelCase_ : Union[str, Any] , UpperCamelCase_ : Dict , UpperCamelCase_ : Dict )-> Dict: ...
632
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
0
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, ConditionalDetrForSegm...
509
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
0
"""simple docstring""" def A_ ( lowercase ) -> list: """simple docstring""" if bit_count < 0: raise ValueError("""The given input must be positive""" ) # get the generated string sequence UpperCAmelCase_ : Union[str, Any] = gray_...
470
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
0
'''simple docstring''' import operator as op __lowerCAmelCase : List[str] ="scaler.pt" __lowerCAmelCase : int ="pytorch_model" __lowerCAmelCase : Tuple ="random_states" __lowerCAmelCase : Dict ="optimizer" __lowerCAmelCase : Tu...
440
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
0
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
61
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
0
'''simple docstring''' import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def lowerCamelCase__ ( ): '''simple docstring''' with offline(OfflineSimul...
210
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
0
import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin __snake_ca...
472
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
0
"""simple docstring""" import random import unittest import numpy as np from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionImgaImgPipeline, PNDMScheduler, ) from diffusers.utils impo...
575
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
0
import datasets _lowerCAmelCase : Optional[Any] = '''\\n@InProceedings{conneau2018xnli,\n author = \"Conneau, Alexis\n and Rinott, Ruty\n and Lample, Guillaume\n and Williams, Adina\n and Bowman, Samuel R.\n a...
454
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
0
"""simple docstring""" from __future__ import annotations from collections.abc import MutableSequence class _lowerCAmelCase : def __init__( self , UpperCamelCase__ , UpperCamelCase__ ) -> Dict: '''simple docstring''' if len(UpperCamelCase__ )...
178
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
0
'''simple docstring''' from math import isqrt def __snake_case (__UpperCAmelCase ): """simple docstring""" lowerCamelCase_ : Dict = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , __Upper...
501
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
0
import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from transformers.models.switch_transformers.convert_switch...
632
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
0
import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def UpperCAmelCase_ ( __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase=5 ) -> List[Any]: # Adapted from https://github.com/pytorch/fairseq/blob/master...
509
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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase_ = { "configuration_funnel": ["FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP", "Fu...
470
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
0
'''simple docstring''' import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, pre...
440
# 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
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase = {'configuration_fnet': ['FNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FNetConfig']}...
61
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
0
'''simple docstring''' 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, ...
210
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
0
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder __snake_case = datasets.utils.logging.get_logger(__name__) class lowercase__ ( folder_based_builder.FolderBasedBuilderConfig ): A__ : bool ...
472
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
0
"""simple docstring""" 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 snake_case__ ...
575
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
0
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_availabl...
454
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
0
"""simple docstring""" import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, requir...
178
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
0
'''simple docstring''' import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert_fast import BertTokenizerFast from .tokenization_dpr impor...
501
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
0
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer _lowercase = logging.get_logger(__name__) _lowercase = ...
632
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
0
from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets __lowerCAmelCase : int = "\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding},\n author={Wang...
509
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
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = ...
470
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
0
'''simple docstring''' from ....configuration_utils import PretrainedConfig from ....utils import logging __lowerCAmelCase : Any =logging.get_logger(__name__) __lowerCAmelCase : str ={ "Visual-Attention-Network/van-base": ( "https://huggingface.co/Visual-Atten...
440
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
0
def _A ( lowerCAmelCase_ : str , lowerCAmelCase_ : str ): """simple docstring""" if not (isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) and isinstance(lowerCAmelCase_ , lowerCAmelCase_ )): raise ValueError("longest_common_substring() takes tw...
61
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
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCamelCase__( metaclass=__lowercase ): __magic_name__ : Any = ['''torch''', '''scipy'''] def __init__( self : int , *lowerCAmelCase : str , **lowerCAmelCase...
210
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
0
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_warmup, set_seed from accelerate import Accelerator, Dist...
472
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
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __A : Dict = { 'configuration_blip': [ 'BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
575
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
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCAmelCase : List[str] = { '''configuration_distilbert''': [ '''...
454
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
0
"""simple docstring""" def __lowerCAmelCase ( lowercase : int , lowercase : int ) -> Optional[int]: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(lowercase , int(b / 2 ) ) * actual_power(lowercase , ...
178
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
0
'''simple docstring''' from dataclasses import dataclass from typing import Optional import numpy as np import torch import torch.nn as nn from ..utils import BaseOutput, is_torch_version, randn_tensor from .attention_processor import SpatialNorm from .unet_ad_blocks import UNetMidBlockaD, get_down_block,...
501
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
0
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 _lowercase = logging.get_logger(__name__) _lowercase = R"\n Args:\n input_ids (`torch.LongTensor` of shape `(batch_size, sequ...
632
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
0
from __future__ import annotations from random import random class __lowerCAmelCase : """simple docstring""" def __init__( self : List[Any] , _snake_case : int | None = None ): __lowercase : List[str] = v...
509
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
0
"""simple docstring""" class UpperCAmelCase_ : """simple docstring""" def __init__( self : Tuple )-> str: """simple docstring""" UpperCAmelCase_ : Optional[int] = {} def a ( self : List[Any] )-> Any: """simple do...
470
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
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testi...
440
# 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
0
def _A ( lowerCAmelCase_ : int ): """simple docstring""" 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...
61
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
0
'''simple docstring''' def lowerCamelCase__ ( A : str , A : list[str] ): '''simple docstring''' UpperCAmelCase = '''''' for word_or_phrase in separated: if not isinstance(A , A ): raise Exception('''join() accepts only strings to...
210
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
0
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_to...
472
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
0
"""simple docstring""" import argparse import math import os import torch from neural_compressor.utils.pytorch import load from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, StableDiffusionPipeline, UNetaDConditionModel def snake_case__ ...
575
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
0
# Copyright 2022 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 app...
454
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
0
"""simple docstring""" from __future__ import annotations import math from collections.abc import Callable def __lowerCAmelCase ( lowercase : Callable[[int | float], int | float] , lowercase : int | float , lowercase : int | float , lowercase : int = 100 , ) ...
178
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
0
'''simple docstring''' from timeit import timeit def __snake_case (__UpperCAmelCase ): """simple docstring""" if number < 0: raise ValueError('''the value of input must not be negative''' ) lowerCamelCase_ : Optional[int] = 0 while number: number &= number - 1 ...
501
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
0
from collections.abc import Sequence from queue import Queue class _UpperCAmelCase : def __init__( self , a__ , a__ , a__ , a__=None , a__=None): A__ = start A__ = end A__ = val A__ = (star...
632
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
0
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 __lowerCAmelCase ( __...
509
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
0
"""simple docstring""" def A_ ( lowercase = 1000 ) -> int: """simple docstring""" UpperCAmelCase_ ,UpperCAmelCase_ : Optional[Any] = 1, 1 UpperCAmelCase_ : List[Any] = 2 while True: UpperCAmelCase_ : U...
470
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
0
'''simple docstring''' import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class UpperCAmelCase ( pl.LightningModule ): def __init__( self :List[str] , lowercase_ :str )-> ...
440
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
0
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 __lowerCamelCase ( __lowercase , __lower...
61
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
0
'''simple docstring''' 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 _lowercase : int ...
210
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
0
import warnings from ...utils import logging from .image_processing_segformer import SegformerImageProcessor __snake_case = logging.get_logger(__name__) class lowercase__ ( __lowercase ): def __init__( self : Optional[int] , *UpperCAmelCase_ : List[str] , **UpperCAmelCase...
472
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
0
"""simple docstring""" import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow __A : List[str] = False class lowerCAmelCase__ ( unittest.TestCase ...
575
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
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _lowerCAmelCase : List[Any] = { '''configuration_swiftformer''': [ '''SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SwiftFormerConf...
454
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
0
"""simple docstring""" 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_singl...
178
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
0
'''simple docstring''' 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 lowerCAmelCase__ ( __lowercase ...
501
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
0
from __future__ import annotations def lowerCAmelCase__ ( UpperCamelCase_ : dict , UpperCamelCase_ : str )-> set[str]: A__ , A__ = set(UpperCamelCase_ ), [start] while stack: A__ = stack.pop() explored.add(Upper...
632
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
0
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(): impo...
509
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
0
"""simple docstring""" import sys def A_ ( lowercase ) -> Dict: """simple docstring""" UpperCAmelCase_ : Dict = len(lowercase ) UpperCAmelCase_ : Dict = [[0 for x in range(lowercase )] for x in range(lowercase )] U...
470
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
0
'''simple docstring''' import requests from bsa import BeautifulSoup def UpperCamelCase ( _lowerCamelCase : str , _lowerCamelCase : dict ): A__ = BeautifulSoup(requests.get(_lowerCamelCase , params=_lowerCamelCase ).content , "html.parser" ) A__ = ...
440
# 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
0
from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class __lowerCamelCase ( yaml.SafeLoader ): """simple docstring""" def a ( self : Tuple , SCREAMING_SNAKE_CASE__ : Optional[int] ) -> int:...
61
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
0
'''simple docstring''' 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 ( ...
210
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
0
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 __snake_case = logging.get_logger(__name__) __snake_case = """▁""" __snake_case ...
472
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
0
"""simple docstring""" 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 cl...
575
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
0
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_...
454
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
0
"""simple docstring""" 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_configu...
178
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
0
'''simple docstring''' import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() __lowerCamelCase : Any = logging.get_logger(__name__) __lowerCamelCase : Union[st...
501
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
0
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 lowerCAmelCase__ ( U...
632
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
0
import numpy as np import qiskit def UpperCAmelCase_ ( __lowerCAmelCase = 8 , __lowerCAmelCase = None ) -> str: __lowercase : Union[str, Any] = np.random.default_rng(seed=__lowerCAmelCase ) # Roughly 25% of the qubits will contribute to the key...
509
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
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowercase_ = logging.get_logger(__name__) lowercase_ = { "shi-labs/nat-mi...
470
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
0
'''simple docstring''' import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust...
440
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
0
from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse('3.8'): import importlib_metadata else: import importlib.metadata as importlib_metadata UpperCam...
61
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
0
'''simple docstring''' import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, ...
210
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
0