code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
286
"""simple docstring""" from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' lowercase_ : List[str] = CustomTokenizer pass
286
1
"""simple docstring""" lowerCamelCase_ : List[str] = tuple[float, float, float] lowerCamelCase_ : Optional[int] = tuple[float, float, float] def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : ...
286
"""simple docstring""" from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils impor...
286
1
"""simple docstring""" import os import pytest from attr import dataclass lowerCamelCase_ : List[Any] = 'us-east-1' # defaults region @dataclass class _UpperCAmelCase : '''simple docstring''' lowercase_ : str lowercase_ : Tuple = """arn:aws:iam::55...
286
"""simple docstring""" import copy import random from transformers import CLIPTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *snake_case_ , **snake_case_ ): """simple docstring""" super().__init_...
286
1
"""simple docstring""" import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOC...
286
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : List[str] = hex_num.strip() if not hex_num: raise ValueError('No value was passed to the function' ) A_ : Any = hex_num[0] == '-' if is_ne...
286
1
"""simple docstring""" # limitations under the License. # 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 .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401 from .ut...
286
"""simple docstring""" import qiskit def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : Tuple = qiskit.Aer.get_backend('aer_simulator' ) A_ : str = qiskit.QuantumCircuit(4 , 2 ) # enc...
286
1
"""simple docstring""" import unittest from transformers import BertGenerationConfig, 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_mode...
286
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ : str = logging.get_logger(__name__) lowerCamelCase_ : Any =...
286
1
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" return abs(_UpperCAmelCase ) if a == 0 else greatest_common_divisor(b % a , _UpperCAmelCase ) def UpperCAmelCase__ ( _UpperCAmelCase , _Up...
286
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _UpperCAmelCase ( U...
286
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Optional[int] = logging.get_logger(__name__) lowerCamelCase_ : List[Any] = { 'google/switch-base-8': 'https://huggingface.co/google/switch-base-8...
286
"""simple docstring""" from copy import deepcopy class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ = None , snake_case_ = None ): """simple docstring""" if arr is None and size is not None: A_ : Union[st...
286
1
"""simple docstring""" import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging lowerCamelCase_ : Optional[int] = '\\n\n' lowerCamelCase_ : List[str] = ...
286
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class _UpperCAmelCase ( UpperCAmelCase__ , UpperCAmelCase__ ): '''simple docstring...
286
1
"""simple docstring""" from queue import PriorityQueue from typing import Any import numpy as np def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ...
286
"""simple docstring""" from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration lowerCamelCase_ : Any = HfArgumentParser(InitializationArguments) lowerCamelCase_ : Union[str, Any] ...
286
1
"""simple docstring""" from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu...
286
"""simple docstring""" import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset ...
286
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor lowerCamelCase_ : Optional[int] = logging.get_logger(__name__) class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__(...
286
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ...
286
1
"""simple docstring""" import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _Upp...
286
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" if isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(_UpperCAmelCase , _UpperCAmelCas...
286
1
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" _validate_point(_UpperCAmelCase ) _validate_point(_UpperCAmelCase ) if len(_UpperCAmelCase ) != len(_UpperCAmelCase ): raise ValueError('Both poin...
286
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCamelCase_ : int = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDepend...
286
1
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase = 10 , _UpperCAmelCase = 1000 , _UpperCAmelCase = True ): """simple docstring""" assert ( isinstance(_UpperCAmelCase , _UpperCAmelCase ) and isinstance(_UpperCAmelCase , _UpperCAmelCase ...
286
"""simple docstring""" import os # Precomputes a list of the 100 first triangular numbers lowerCamelCase_ : List[str] = [int(0.5 * n * (n + 1)) for n in range(1, 1_01)] def UpperCAmelCase__ ( ): """simple docstring""" A_ : Union[str, Any] = os...
286
1
"""simple docstring""" import random def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase = False ): """simple docstring""" A_ : dict = {i: [] for i in range(_UpperCAmelCase )} # if probability is greater or equal than 1,...
286
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : List[str] = {'configuration_xln...
286
1
"""simple docstring""" import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class _UpperCAmelCase ( UpperCAmelCase__ ): ...
286
"""simple docstring""" import torch from diffusers import DiffusionPipeline class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , snake_case_ , snake_case_ ): """simple docstring""" super().__init__() se...
286
1
"""simple docstring""" import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase_ : str = logging.get_logger(__name__) l...
286
"""simple docstring""" from heapq import heappop, heappush import numpy as np def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ): """simple docstring""" A_ , A_ : List[str] = grid.shape ...
286
1
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('>=', '4.25.0')): raise OptionalDepen...
286
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Union[str, Any] = logging.get_logger(__name__) lowerCamelCase_ : Optional[Any] = { 'huggingface/informe...
286
1
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _UpperCAmelCase ( U...
286
"""simple docstring""" import os def UpperCAmelCase__ ( ): """simple docstring""" A_ : Any = os.path.join(os.path.dirname(_UpperCAmelCase ) , 'num.txt' ) with open(_UpperCAmelCase ) as file_hand: return str(sum(int(_UpperCAmelCase ) for...
286
1
"""simple docstring""" import random import unittest import torch from diffusers import IFInpaintingSuperResolutionPipeline 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 ..pipeli...
286
"""simple docstring""" import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger lowerCamelCase_ : Dict = get_logger(__name__) lowerCamelCase_ : List[str] = r'\n Args:\n ...
286
1
"""simple docstring""" from __future__ import annotations from collections.abc import Generator def UpperCAmelCase__ ( ): """simple docstring""" A_ : dict[int, int] = {} A_ : Optional[Any] = 2 while True: A_ : Union[str, Any] ...
286
"""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 lowerCamelCase_ : Tuple = logging.get_logger(__name__) def UpperCAmelCase__ ( _UpperCAmelCase ...
286
1
"""simple docstring""" import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_av...
286
"""simple docstring""" from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' lowercase_ : List[str] = CustomTokenizer pass
286
1
"""simple docstring""" import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase=1 ): """simple docstring""" if n_shave_prefix_segments >= 0: return ".".j...
286
"""simple docstring""" from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils impor...
286
1
"""simple docstring""" import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": lowerCamelCase_ : Tuple = pd.read_csv('sample_data.csv', ...
286
"""simple docstring""" import copy import random from transformers import CLIPTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *snake_case_ , **snake_case_ ): """simple docstring""" super().__init_...
286
1
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" return round(float(moles / volume ) * nfactor ) def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAm...
286
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : List[str] = hex_num.strip() if not hex_num: raise ValueError('No value was passed to the function' ) A_ : Any = hex_num[0] == '-' if is_ne...
286
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase_ : str = { 'configuration_table_transformer': [ 'TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TableTransfor...
286
"""simple docstring""" import qiskit def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : Tuple = qiskit.Aer.get_backend('aer_simulator' ) A_ : str = qiskit.QuantumCircuit(4 , 2 ) # enc...
286
1
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ , A_ : Dict = len(_UpperCAmelCase ), len(grid[0] ) if ( min(_UpperCAmelCase , ...
286
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ : str = logging.get_logger(__name__) lowerCamelCase_ : Any =...
286
1
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : List[str] = hex_num.strip() if not hex_num: raise ValueError('No value was passed to the function' ) A_ : Any = hex_num[0] == '-' if is_ne...
286
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _UpperCAmelCase ( U...
286
1
"""simple docstring""" import copy import random from transformers import CLIPTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *snake_case_ , **snake_case_ ): """simple docstring""" super().__init_...
286
"""simple docstring""" from copy import deepcopy class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ = None , snake_case_ = None ): """simple docstring""" if arr is None and size is not None: A_ : Union[st...
286
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteSchedul...
286
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class _UpperCAmelCase ( UpperCAmelCase__ , UpperCAmelCase__ ): '''simple docstring...
286
1
"""simple docstring""" from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature fr...
286
"""simple docstring""" from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration lowerCamelCase_ : Any = HfArgumentParser(InitializationArguments) lowerCamelCase_ : Union[str, Any] ...
286
1
"""simple docstring""" lowerCamelCase_ : int = { 0: '0', 1: '1', 2: '2', 3: '3', 4: '4', 5: '5', 6: '6', 7: '7', 8: '8', 9: '9', 10: 'a', 11: 'b', 12: 'c', 13: 'd', 14: 'e', 15: 'f', } def UpperCAmelCase__ ( _Upp...
286
"""simple docstring""" import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset ...
286
1
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : List[Any] = [1] A_ , A_ , A_ : Tuple = 0, 0, 0 A_ : Dict = ugly_nums[ia] * 2 A_ : Dict = u...
286
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ...
286
1
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : int = len(_UpperCAmelCase ) A_ : int = len(_UpperCAmelCase ) A_ : int = ( first_str_length if fi...
286
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" if isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(_UpperCAmelCase , _UpperCAmelCas...
286
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from diffusers.u...
286
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCamelCase_ : int = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDepend...
286
1
"""simple docstring""" from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils impo...
286
"""simple docstring""" import os # Precomputes a list of the 100 first triangular numbers lowerCamelCase_ : List[str] = [int(0.5 * n * (n + 1)) for n in range(1, 1_01)] def UpperCAmelCase__ ( ): """simple docstring""" A_ : Union[str, Any] = os...
286
1
"""simple docstring""" import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperC...
286
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : List[str] = {'configuration_xln...
286
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase_ : str = {'configuration_wavlm': ['WAVLM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'WavLMConfig']} try: if not is_torch_available(): ...
286
"""simple docstring""" import torch from diffusers import DiffusionPipeline class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , snake_case_ , snake_case_ ): """simple docstring""" super().__init__() se...
286
1
"""simple docstring""" from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time lowerCamelCase_ : List[Any] = Lock() def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ...
286
"""simple docstring""" from heapq import heappop, heappush import numpy as np def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ): """simple docstring""" A_ , A_ : List[str] = grid.shape ...
286
1
"""simple docstring""" class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ ): """simple docstring""" A_ : Optional[Any] = arr.split(',' ) def lowerCamelCase_ ( self ): """simple docstrin...
286
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Union[str, Any] = logging.get_logger(__name__) lowerCamelCase_ : Optional[Any] = { 'huggingface/informe...
286
1
"""simple docstring""" import argparse from collections import defaultdict def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : Optional[int] = f"""{file...
286
"""simple docstring""" import os def UpperCAmelCase__ ( ): """simple docstring""" A_ : Any = os.path.join(os.path.dirname(_UpperCAmelCase ) , 'num.txt' ) with open(_UpperCAmelCase ) as file_hand: return str(sum(int(_UpperCAmelCase ) for...
286
1
"""simple docstring""" import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable,...
286
"""simple docstring""" import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger lowerCamelCase_ : Dict = get_logger(__name__) lowerCamelCase_ : List[str] = r'\n Args:\n ...
286
1
"""simple docstring""" from collections.abc import Sequence from queue import Queue class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ , snake_case_ , snake_case_ , snake_case_=None , snake_case_=None ): ...
286
"""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 lowerCamelCase_ : Tuple = logging.get_logger(__name__) def UpperCAmelCase__ ( _UpperCAmelCase ...
286
1
"""simple docstring""" import math def UpperCAmelCase__ ( ): """simple docstring""" A_ : List[str] = input('Enter message: ' ) A_ : str = int(input(f"""Enter key [2-{len(_UpperCAmelCase ) - 1}]: """ ) ) A_ : Optional[i...
286
"""simple docstring""" from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' lowercase_ : List[str] = CustomTokenizer pass
286
1
"""simple docstring""" import qiskit def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : Tuple = qiskit.Aer.get_backend('aer_simulator' ) A_ : str = qiskit.QuantumCircuit(4 , 2 ) # enc...
286
"""simple docstring""" from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils impor...
286
1
"""simple docstring""" import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import...
286
"""simple docstring""" import copy import random from transformers import CLIPTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *snake_case_ , **snake_case_ ): """simple docstring""" super().__init_...
286
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : List[str] = {'configuration_xln...
286
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : List[str] = hex_num.strip() if not hex_num: raise ValueError('No value was passed to the function' ) A_ : Any = hex_num[0] == '-' if is_ne...
286
1
"""simple docstring""" from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" if not is_accelerate_available(): return method ...
286
"""simple docstring""" import qiskit def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : Tuple = qiskit.Aer.get_backend('aer_simulator' ) A_ : str = qiskit.QuantumCircuit(4 , 2 ) # enc...
286
1
"""simple docstring""" from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import T...
286
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ : str = logging.get_logger(__name__) lowerCamelCase_ : Any =...
286
1
"""simple docstring""" from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configura...
286
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _UpperCAmelCase ( U...
286
1
"""simple docstring""" from __future__ import annotations def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" if days_between_payments <= 0: raise ValueError('days_between_payments must be > 0' ) if daily_int...
286
"""simple docstring""" from copy import deepcopy class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ = None , snake_case_ = None ): """simple docstring""" if arr is None and size is not None: A_ : Union[st...
286
1
"""simple docstring""" from __future__ import annotations from math import gcd def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase = 2 , _UpperCAmelCase = 1 , _UpperCAmelCase = 3 , ): """simple docstring""" if num < 2: raise ValueError('The input value ...
286
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class _UpperCAmelCase ( UpperCAmelCase__ , UpperCAmelCase__ ): '''simple docstring...
286
1
"""simple docstring""" # Copyright (c) 2021-, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
286
"""simple docstring""" from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration lowerCamelCase_ : Any = HfArgumentParser(InitializationArguments) lowerCamelCase_ : Union[str, Any] ...
286
1
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers impor...
286
"""simple docstring""" import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset ...
286
1
"""simple docstring""" from collections.abc import Iterable from typing import Any class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ = None ): """simple docstring""" A_ : Optional[Any] = value A_ : ...
286
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ...
286
1
"""simple docstring""" def UpperCAmelCase__ ( ): """simple docstring""" return 1 def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" return 0 if x < 0 else two_pence(x - 2 ) + one_pence() def UpperCAmelCase__ ( _Uppe...
286
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" if isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(_UpperCAmelCase , _UpperCAmelCas...
286
1
"""simple docstring""" lowerCamelCase_ : Union[str, Any] = range(2, 20 + 1) lowerCamelCase_ : Dict = [10**k for k in range(ks[-1] + 1)] lowerCamelCase_ : dict[int, dict[int, list[list[int]]]] = {} def UpperCAmelCase__ ( _UpperCAmelCase , ...
286
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCamelCase_ : int = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDepend...
286
1
"""simple docstring""" import os def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : int = len(grid[0] ) A_ : str = len(_UpperCAmelCase ) A_ : int = 0 A_ : int = 0 A_ : ...
286
"""simple docstring""" import os # Precomputes a list of the 100 first triangular numbers lowerCamelCase_ : List[str] = [int(0.5 * n * (n + 1)) for n in range(1, 1_01)] def UpperCAmelCase__ ( ): """simple docstring""" A_ : Union[str, Any] = os...
286
1
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision fr...
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : List[str] = {'configuration_xln...
286
0
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def lowerCAmelCase_ ( snake_case_ : int ) -> List[str]: '''simple docstring''' if "img_encoder.pos_embed" in...
1
"""simple docstring""" import torch from diffusers import DiffusionPipeline class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , snake_case_ , snake_case_ ): """simple docstring""" super().__init__() se...
286
0
'''simple docstring''' from __future__ import annotations def _SCREAMING_SNAKE_CASE (A , A , A ) -> float: """simple docstring""" if days_between_payments <= 0: raise ValueError('''days_between_payments must be > 0''' ) if daily_interes...
2
"""simple docstring""" from heapq import heappop, heappush import numpy as np def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ): """simple docstring""" A_ , A_ : List[str] = grid.shape ...
286
0
'''simple docstring''' lowercase : Optional[int] = {str(digit): digit**5 for digit in range(10)} def lowerCAmelCase_ ( snake_case__ ): '''simple docstring''' return sum(DIGITS_FIFTH_POWER[digit] for digit in str(snake_case__ ) ) ...
3
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Union[str, Any] = logging.get_logger(__name__) lowerCamelCase_ : Optional[Any] = { 'huggingface/informe...
286
0
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lice...
4
"""simple docstring""" import os def UpperCAmelCase__ ( ): """simple docstring""" A_ : Any = os.path.join(os.path.dirname(_UpperCAmelCase ) , 'num.txt' ) with open(_UpperCAmelCase ) as file_hand: return str(sum(int(_UpperCAmelCase ) for...
286
0
import argparse 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, DistributedT...
5
"""simple docstring""" import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger lowerCamelCase_ : Dict = get_logger(__name__) lowerCamelCase_ : List[str] = r'\n Args:\n ...
286
0
from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __A( a ): def __init__( self , _snake_case , _snake_case ) -> O...
6
"""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 lowerCamelCase_ : Tuple = logging.get_logger(__name__) def UpperCAmelCase__ ( _UpperCAmelCase ...
286
0
import math import os import unittest from transformers import MegatronBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import...
7
"""simple docstring""" from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' lowercase_ : List[str] = CustomTokenizer pass
286
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { '''google/vivit-b-16x2-kinetics400''': ( '''https://huggingface.co/google/vivit-b-16x2-kinetics400/resolve/main/config.json''' ...
8
"""simple docstring""" from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils impor...
286
0
from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split __lowerCAmelCase : List[Any] =datasets.load_iris() __lowerCAmelCase : Tuple =np.array(data['data']) __lowerCAmelCase : Dict =np.array(data['target']) __lowerCAmelCase...
9
"""simple docstring""" import copy import random from transformers import CLIPTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *snake_case_ , **snake_case_ ): """simple docstring""" super().__init_...
286
0
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.set_verbosity_info() __A ...
10
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : List[str] = hex_num.strip() if not hex_num: raise ValueError('No value was passed to the function' ) A_ : Any = hex_num[0] == '-' if is_ne...
286
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available, ) lowerCAmelCase__ = { 'configuration_speecht5': [ 'SPEECHT5_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SPEECHT5_PRETRAINED_HIFIGAN_...
11
"""simple docstring""" import qiskit def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : Tuple = qiskit.Aer.get_backend('aer_simulator' ) A_ : str = qiskit.QuantumCircuit(4 , 2 ) # enc...
286
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCAmelCase_ = { 'configuration_maskformer': ['MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MaskFormerConfig'], 'configuration_maskformer_swin': ['MaskForm...
12
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ : str = logging.get_logger(__name__) lowerCamelCase_ : Any =...
286
0
def A_ ( _UpperCAmelCase = 10_00 ): return sum(e for e in range(3 , _UpperCAmelCase ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(f'''{solution() = }''')
13
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _UpperCAmelCase ( U...
286
0
from dataclasses import dataclass from typing import Optional import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .modeling_utils import ModelMixin @dataclass class UpperCamelCas...
14
"""simple docstring""" from copy import deepcopy class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ = None , snake_case_ = None ): """simple docstring""" if arr is None and size is not None: A_ : Union[st...
286
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 required by applicab...
15
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class _UpperCAmelCase ( UpperCAmelCase__ , UpperCAmelCase__ ): '''simple docstring...
286
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule lowerCAmelCase_ = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer el...
16
"""simple docstring""" from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration lowerCamelCase_ : Any = HfArgumentParser(InitializationArguments) lowerCamelCase_ : Union[str, Any] ...
286
0
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @r...
17
"""simple docstring""" import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset ...
286
0
import csv import tweepy # Twitter API credentials __lowerCamelCase : Dict = '''''' __lowerCamelCase : Union[str, Any] = '''''' __lowerCamelCase : Dict = '''''' __lowerCamelCase : List[Any] = '''''' def _snake_case ( lowerCAmelCase : str ): """simple d...
18
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ...
286
0
import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, ...
19
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" if isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(_UpperCAmelCase , _UpperCAmelCas...
286
0
import numpy as np lowercase : List[Any] = [ ["""a""", """b""", """c""", """d""", """e"""], ["""f""", """g""", """h""", """i""", """k"""], ["""l""", """m""", """n""", """o""", """p"""], ["""q""", """r""", """s""", """t""", """u"""], ["""v""", """w""", """x""", """y""", """z"""]...
20
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCamelCase_ : int = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDepend...
286
0
from __future__ import annotations from collections.abc import Generator def UpperCamelCase_( ) -> Generator[int, None, None]: _lowercase : dict[int, int] = {} _lowercase : Optional[int] = 2 while True: _lowercase : List[Any...
21
"""simple docstring""" import os # Precomputes a list of the 100 first triangular numbers lowerCamelCase_ : List[str] = [int(0.5 * n * (n + 1)) for n in range(1, 1_01)] def UpperCAmelCase__ ( ): """simple docstring""" A_ : Union[str, Any] = os...
286
0
'''simple docstring''' import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging __SCREAMING_SNAKE_CASE :Optional[int] = logging.get_logger(__name__) __SCREAMING_SNAKE_CASE :str = { '''facebook...
22
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : List[str] = {'configuration_xln...
286
0
'''simple docstring''' import copy from collections import OrderedDict from typing import Dict, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING Upp...
23
"""simple docstring""" import torch from diffusers import DiffusionPipeline class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , snake_case_ , snake_case_ ): """simple docstring""" super().__init__() se...
286
0
import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_available, is_torch_available,...
24
"""simple docstring""" from heapq import heappop, heappush import numpy as np def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ): """simple docstring""" A_ , A_ : List[str] = grid.shape ...
286
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) UpperCAmelCase__ : Optional[Any] = {'configuration_beit': ['BEIT_PRETRA...
25
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Union[str, Any] = logging.get_logger(__name__) lowerCamelCase_ : Optional[Any] = { 'huggingface/informe...
286
0
from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class lowercase ( ...
26
"""simple docstring""" import os def UpperCAmelCase__ ( ): """simple docstring""" A_ : Any = os.path.join(os.path.dirname(_UpperCAmelCase ) , 'num.txt' ) with open(_UpperCAmelCase ) as file_hand: return str(sum(int(_UpperCAmelCase ) for...
286
0
'''simple docstring''' from __future__ import annotations def lowerCamelCase (_SCREAMING_SNAKE_CASE : str , _SCREAMING_SNAKE_CASE : list[str] | None = None , _SCREAMING_SNAKE_CASE : dict[str, float] | None = None , _SCREAMING_SNAKE_CASE : boo...
27
"""simple docstring""" import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger lowerCamelCase_ : Dict = get_logger(__name__) lowerCamelCase_ : List[str] = r'\n Args:\n ...
286
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor _lowerCamelCase : str = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE ( _a ): """simple docstring""" def __init__( ...
28
"""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 lowerCamelCase_ : Tuple = logging.get_logger(__name__) def UpperCAmelCase__ ( _UpperCAmelCase ...
286
0
import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create simlink # import classes from...
29
"""simple docstring""" from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' lowercase_ : List[str] = CustomTokenizer pass
286
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __a = { 'configuration_xlm': ['XLM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XLMConfig', 'XLMOnnxConfig'], 'tokenization_xlm': ['XLMTokenizer'], } try: if ...
30
"""simple docstring""" from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils impor...
286
0
'''simple docstring''' from __future__ import annotations __SCREAMING_SNAKE_CASE : Optional[int] = list[list[int]] # assigning initial values to the grid __SCREAMING_SNAKE_CASE : Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3,...
31
"""simple docstring""" import copy import random from transformers import CLIPTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *snake_case_ , **snake_case_ ): """simple docstring""" super().__init_...
286
0
def SCREAMING_SNAKE_CASE_ ( __A : list[int] , __A : str ) -> list[int]: """simple docstring""" a_ : Any = int(__A ) # Initialize Result a_ : Tuple = [] # Traverse through all denomination for denomination ...
32
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : List[str] = hex_num.strip() if not hex_num: raise ValueError('No value was passed to the function' ) A_ : Any = hex_num[0] == '-' if is_ne...
286
0
"""simple docstring""" import os # Precomputes a list of the 100 first triangular numbers __A : int = [int(0.5 * n * (n + 1)) for n in range(1, 101)] def lowercase ( ): lowercase_ : Optional[Any] = os.path.dirname(os.path.realpath(__snake_case )...
33
"""simple docstring""" import qiskit def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : Tuple = qiskit.Aer.get_backend('aer_simulator' ) A_ : str = qiskit.QuantumCircuit(4 , 2 ) # enc...
286
0
'''simple docstring''' import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.ja...
34
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ : str = logging.get_logger(__name__) lowerCamelCase_ : Any =...
286
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __a = {"configuration_glpn": ["GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP", "GLPNConfig"]} try: if not is_vision_available(): ...
35
"""simple docstring""" import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _UpperCAmelCase ( U...
286
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _snake_case = logging.get_logger(__name__) _snake_case = { "asapp/sew-d-tiny-100k": "https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json", # See all SEW-D models at htt...
36
"""simple docstring""" from copy import deepcopy class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ = None , snake_case_ = None ): """simple docstring""" if arr is None and size is not None: A_ : Union[st...
286
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _lowerCAmelCase = { '''configuration_convnext''': ['''CONVNEXT_PRETRAINED_CONFIG_ARCHIVE_...
37
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class _UpperCAmelCase ( UpperCAmelCase__ , UpperCAmelCase__ ): '''simple docstring...
286
0
import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _SCREAM...
38
"""simple docstring""" from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration lowerCamelCase_ : Any = HfArgumentParser(InitializationArguments) lowerCamelCase_ : Union[str, Any] ...
286
0
import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table import table_cast fr...
39
"""simple docstring""" import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset ...
286
0
"""simple docstring""" import unittest from knapsack import knapsack as k class _A ( unittest.TestCase ): """simple docstring""" def __snake_case ( self : List[Any]): a : str = 0 a : Op...
40
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ...
286
0