code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" def _snake_case ( UpperCamelCase : int = 4000000 ): UpperCAmelCase : Optional[int] = [0, 1] UpperCAmelCase : List[str] = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: break i += 1 UpperCAmelCase ...
360
"""simple docstring""" from __future__ import annotations from decimal import Decimal from numpy import array def _snake_case ( UpperCamelCase : list[list[float]] ): UpperCAmelCase : int = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implem...
76
0
"""simple docstring""" def _snake_case ( UpperCamelCase : list[int] , UpperCamelCase : list[int] ): # Check if the input is valid if not len(UpperCamelCase ) == len(UpperCamelCase ) == 3: raise ValueError("""Please enter a valid equation.""" ) if equationa[0...
361
"""simple docstring""" import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class SCREAMING_SNAKE_CASE__ : def __init__( self , _SCREAMING_SNAK...
76
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor...
362
"""simple docstring""" import math import sys def _snake_case ( UpperCamelCase : str ): UpperCAmelCase : Dict = """""" try: with open(UpperCamelCase , """rb""" ) as binary_file: UpperCAmelCase : str = binary_file.read() for dat in data: UpperC...
76
0
"""simple docstring""" A: int = {str(digit): digit**5 for digit in range(1_0)} def _snake_case ( UpperCamelCase : int ): return sum(DIGITS_FIFTH_POWER[digit] for digit in str(UpperCamelCase ) ) def _snake_case ( ): return sum( number f...
363
"""simple docstring""" import argparse import os import re import tensorflow as tf import torch from transformers import BertConfig, BertModel from transformers.utils import logging logging.set_verbosity_info() A: Optional[Any] = logging.get_logger(__name__) def _snake_case ( Up...
76
0
"""simple docstring""" import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipeline...
364
"""simple docstring""" import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class SCREAMING_SNAKE_CASE__ ( UpperCAmelCase__ ): def __init__...
76
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available A: str = { "configuration_gpt_neo": ["GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTNeoConfig", "GPTNeoOnnxConfig"], } try: if...
365
"""simple docstring""" import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format="%(message)s") def _snake_case ( UpperCamelCase : np.ndarray ): return input_array.reshape((input_array.size, 1) ) def _snake_cas...
76
0
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionSAGPipeline, UNetaDConditionModel, ) from diffusers.utils import slow, torch_d...
366
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer A: int = logging.get_logger(__name__) ...
76
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils impo...
367
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze, transpose, ...
76
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_download, hf_hub_url from PIL import Image from transformers import DetaConfig, DetaForObjectDetection, DetaImageProcessor, SwinConfig from transformers.util...
368
"""simple docstring""" import baseaa def _snake_case ( UpperCamelCase : str ): return baseaa.aaaencode(string.encode("""utf-8""" ) ) def _snake_case ( UpperCamelCase : bytes ): return baseaa.aaadecode(UpperCamelCase ).decode("""utf-8""" ) i...
76
0
"""simple docstring""" import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .utils import lo...
369
"""simple docstring""" import os from collections.abc import Iterator def _snake_case ( UpperCamelCase : str = "." ): for dir_path, dir_names, filenames in os.walk(UpperCamelCase ): UpperCAmelCase : List[Any] = [d for d in dir_names if d != """scripts""" and d[0] not in...
76
0
"""simple docstring""" from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def _snake_case ( ): UpperCAmelCase : Any = HfArgumentParser(UpperCamelCase ) UpperCAmelCase : Tuple = parser.parse_args_into_dataclasses()[0] ...
370
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import loggi...
76
0
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .t...
371
"""simple docstring""" from __future__ import annotations from typing import Any class SCREAMING_SNAKE_CASE__ : def __init__( self , _SCREAMING_SNAKE_CASE = 6 ) -> None: '''simple docstring''' UpperCAmelCase : Node | None = None UpperCAmelCase ...
76
0
"""simple docstring""" import os def _snake_case ( ): with open(os.path.dirname(UpperCamelCase ) + """/p022_names.txt""" ) as file: UpperCAmelCase : str = str(file.readlines()[0] ) UpperCAmelCase : Optional[int] = names.replace("""\"""" , """""" ...
350
"""simple docstring""" from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class ...
76
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) A: int = { "configuration_gpt_bigcode": ["GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTBigCodeConfig"], } try: ...
351
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, loggin...
76
0
"""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 versi...
352
"""simple docstring""" import math from typing import Callable, List, Optional, Union import numpy as np import PIL import torch from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion.pi...
76
0
"""simple docstring""" import numpy as np from PIL import Image def _snake_case ( UpperCamelCase : np.ndarray , UpperCamelCase : int , UpperCamelCase : int ): UpperCAmelCase : int = np.array(UpperCamelCase ) if arr.shape[0] != arr.shape[1]: rais...
353
"""simple docstring""" def _snake_case ( UpperCamelCase : dict ): UpperCAmelCase : set[int] = set() # To detect a back edge, keep track of vertices currently in the recursion stack UpperCAmelCase : set[int] = set() return any( node not in visited and depth_f...
76
0
def _snake_case ( UpperCamelCase : list , UpperCamelCase : list ): _validate_point(UpperCamelCase ) _validate_point(UpperCamelCase ) if len(UpperCamelCase ) != len(UpperCamelCase ): raise ValueError("""Both points must be in the same n-dimensional space"...
354
"""simple docstring""" from typing import List from .keymap import KEYMAP, get_character def _snake_case ( UpperCamelCase : str ): def decorator(UpperCamelCase : Optional[int] ): UpperCAmelCase : List[Any] = getattr(UpperCamelCase , """handle_key""" ,...
76
0
"""simple docstring""" from typing import List from .keymap import KEYMAP, get_character def _snake_case ( UpperCamelCase : str ): def decorator(UpperCamelCase : Optional[int] ): UpperCAmelCase : List[Any] = getattr(UpperCamelCase , """handle_key""" ,...
355
"""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/licenses/LICENSE-2.0 ...
76
0
"""simple docstring""" import argparse import logging import os import sys import numpy as np import onnxruntime import torch from bart_onnx.generation_onnx import BARTBeamSearchGenerator from bart_onnx.reduce_onnx_size import remove_dup_initializers import transformers from transformers import BartForConditional...
356
"""simple docstring""" def _snake_case ( UpperCamelCase : int , UpperCamelCase : int ): return number | (1 << position) def _snake_case ( UpperCamelCase : int , UpperCamelCase : int ): return number & ~(1 << position) def _snake_case ...
76
0
"""simple docstring""" def _snake_case ( UpperCamelCase : list ): UpperCAmelCase : Any = len(UpperCamelCase ) for i in range(1 , UpperCamelCase ): UpperCAmelCase : Dict = collection[i] UpperCAmelCase : Optional[int] = 0 UpperCAmelC...
357
"""simple docstring""" def _snake_case ( UpperCamelCase : Tuple , UpperCamelCase : Tuple , UpperCamelCase : Tuple=False ): if isinstance(UpperCamelCase , UpperCamelCase ) and isinstance(UpperCamelCase , UpperCamelCase ): UpperCAmelCase :...
76
0
from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, slow from ..test_modeling...
358
"""simple docstring""" import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger A: List[Any] = get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( enum.Enum ): __lowerCAmelCase : Dict = 'all_...
76
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A: List[str] = { "configuration_roberta": ["ROBERTA_PRETRAIN...
359
"""simple docstring""" def _snake_case ( UpperCamelCase : list , UpperCamelCase : list ): _validate_point(UpperCamelCase ) _validate_point(UpperCamelCase ) if len(UpperCamelCase ) != len(UpperCamelCase ): raise ValueError("""Both points must be in the sa...
76
0
"""simple docstring""" from __future__ import annotations A: Optional[int] = list[tuple[int, int]] A: str = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0...
360
"""simple docstring""" from __future__ import annotations from decimal import Decimal from numpy import array def _snake_case ( UpperCamelCase : list[list[float]] ): UpperCAmelCase : int = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implem...
76
0
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokeni...
361
"""simple docstring""" import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class SCREAMING_SNAKE_CASE__ : def __init__( self , _SCREAMING_SNAK...
76
0
"""simple docstring""" def _snake_case ( UpperCamelCase : int , UpperCamelCase : int ): return int(input_a == input_a == 0 ) def _snake_case ( ): print("""Truth Table of NOR Gate:""" ) print("""| Input 1 | Input 2 | Output |""" ) print(F"...
362
"""simple docstring""" import math import sys def _snake_case ( UpperCamelCase : str ): UpperCAmelCase : Dict = """""" try: with open(UpperCamelCase , """rb""" ) as binary_file: UpperCAmelCase : str = binary_file.read() for dat in data: UpperC...
76
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) A: Optional[Any] = { "configuration_perceiver": ["PERCEIVER_PRETRAINED_CONFIG_A...
363
"""simple docstring""" import argparse import os import re import tensorflow as tf import torch from transformers import BertConfig, BertModel from transformers.utils import logging logging.set_verbosity_info() A: Optional[Any] = logging.get_logger(__name__) def _snake_case ( Up...
76
0
"""simple docstring""" class SCREAMING_SNAKE_CASE__ : def __init__( self ) -> Tuple: '''simple docstring''' UpperCAmelCase : Dict = 0 UpperCAmelCase : Any = 0 UpperCAmelCase : Tuple = {} def SCREAMING_SNAKE_CASE ( ...
364
"""simple docstring""" import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class SCREAMING_SNAKE_CASE__ ( UpperCAmelCase__ ): def __init__...
76
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A: Any = { "configuration_roformer": ["ROFORMER_PRETRAINED_C...
365
"""simple docstring""" import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format="%(message)s") def _snake_case ( UpperCamelCase : np.ndarray ): return input_array.reshape((input_array.size, 1) ) def _snake_cas...
76
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_configura...
366
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer A: int = logging.get_logger(__name__) ...
76
0
"""simple docstring""" import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging.INFO) A: ...
367
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze, transpose, ...
76
0
"""simple docstring""" import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unordered...
368
"""simple docstring""" import baseaa def _snake_case ( UpperCamelCase : str ): return baseaa.aaaencode(string.encode("""utf-8""" ) ) def _snake_case ( UpperCamelCase : bytes ): return baseaa.aaadecode(UpperCamelCase ).decode("""utf-8""" ) i...
76
0
"""simple docstring""" import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size ...
369
"""simple docstring""" import os from collections.abc import Iterator def _snake_case ( UpperCamelCase : str = "." ): for dir_path, dir_names, filenames in os.walk(UpperCamelCase ): UpperCAmelCase : List[Any] = [d for d in dir_names if d != """scripts""" and d[0] not in...
76
0
"""simple docstring""" 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 SCREAMING_SNAKE_CASE__ ( UpperCAmelCase__...
370
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import loggi...
76
0
"""simple docstring""" from datetime import datetime as dt import os from github import Github A = [ "good first issue", "good second issue", "good difficult issue", "feature request", "new model", "wip", ] def _snake_case ( ): UpperCAmelCase : int = ...
371
"""simple docstring""" from __future__ import annotations from typing import Any class SCREAMING_SNAKE_CASE__ : def __init__( self , _SCREAMING_SNAKE_CASE = 6 ) -> None: '''simple docstring''' UpperCAmelCase : Node | None = None UpperCAmelCase ...
76
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( ...
350
"""simple docstring""" from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class ...
76
0
"""simple docstring""" def _snake_case ( UpperCamelCase : dict ): UpperCAmelCase : set[int] = set() # To detect a back edge, keep track of vertices currently in the recursion stack UpperCAmelCase : set[int] = set() return any( node not in visited a...
351
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, loggin...
76
0
"""simple docstring""" import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def _snake_case ( UpperCamelCase : bytes , UpperCamelCase : int ): UpperCAmelCase : int = F"{sampling_rate}" UpperCAmelCase :...
352
"""simple docstring""" import math from typing import Callable, List, Optional, Union import numpy as np import PIL import torch from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion.pi...
76
0
"""simple docstring""" from math import factorial A: dict[str, int] = {str(digit): factorial(digit) for digit in range(1_0)} def _snake_case ( UpperCamelCase : int ): if not isinstance(UpperCamelCase , UpperCamelCase ): raise TypeError("""Parameter number m...
353
"""simple docstring""" def _snake_case ( UpperCamelCase : dict ): UpperCAmelCase : set[int] = set() # To detect a back edge, keep track of vertices currently in the recursion stack UpperCAmelCase : set[int] = set() return any( node not in visited and depth_f...
76
0
import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import TensorType...
354
"""simple docstring""" from typing import List from .keymap import KEYMAP, get_character def _snake_case ( UpperCamelCase : str ): def decorator(UpperCamelCase : Optional[int] ): UpperCAmelCase : List[Any] = getattr(UpperCamelCase , """handle_key""" ,...
76
0
"""simple docstring""" import unittest import torch from torch import nn from diffusers.models.activations import get_activation class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): def SCREAMING_SNAKE_CASE ( self ) -> Tuple: '''simple docstring''' UpperCAmelC...
355
"""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/licenses/LICENSE-2.0 ...
76
0
"""simple docstring""" def _snake_case ( UpperCamelCase : int = 100 ): UpperCAmelCase : Optional[Any] = set() UpperCAmelCase : Union[str, Any] = 0 UpperCAmelCase : List[Any] = n + 1 # maximum limit for a in range(2 , UpperCamelCase ): ...
356
"""simple docstring""" def _snake_case ( UpperCamelCase : int , UpperCamelCase : int ): return number | (1 << position) def _snake_case ( UpperCamelCase : int , UpperCamelCase : int ): return number & ~(1 << position) def _snake_case ...
76
0
"""simple docstring""" from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A: Dict = logging.get_logger(__name__) A: Optional[in...
357
"""simple docstring""" def _snake_case ( UpperCamelCase : Tuple , UpperCamelCase : Tuple , UpperCamelCase : Tuple=False ): if isinstance(UpperCamelCase , UpperCamelCase ) and isinstance(UpperCamelCase , UpperCamelCase ): UpperCAmelCase :...
76
0
from unittest.mock import patch import pyspark from datasets.packaged_modules.spark.spark import ( Spark, SparkExamplesIterable, _generate_iterable_examples, ) from ..utils import ( require_dill_gt_0_3_2, require_not_windows, ) def _snake_case ( UpperCamelCase : Optional[...
358
"""simple docstring""" import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger A: List[Any] = get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( enum.Enum ): __lowerCAmelCase : Dict = 'all_...
76
0
"""simple docstring""" def _snake_case ( UpperCamelCase : int ): UpperCAmelCase : Tuple = int(UpperCamelCase ) if n_element < 1: UpperCAmelCase : Tuple = ValueError("""a should be a positive number""" ) raise my_error UpperCAmelCase : Tuple ...
359
"""simple docstring""" def _snake_case ( UpperCamelCase : list , UpperCamelCase : list ): _validate_point(UpperCamelCase ) _validate_point(UpperCamelCase ) if len(UpperCamelCase ) != len(UpperCamelCase ): raise ValueError("""Both points must be in the sa...
76
0
"""simple docstring""" import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class SCREAMING_SNAKE_CASE__ ( UpperCAmelCase__ ): __lowerCAmelCase : List[Any] = (UnCLIPScheduler,) def SCREAMING_SNAKE_CASE ( self , ...
360
"""simple docstring""" from __future__ import annotations from decimal import Decimal from numpy import array def _snake_case ( UpperCamelCase : list[list[float]] ): UpperCAmelCase : int = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implem...
76
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( Diffusion...
361
"""simple docstring""" import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class SCREAMING_SNAKE_CASE__ : def __init__( self , _SCREAMING_SNAK...
76
0
"""simple docstring""" import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching between checkouts and running tests. A: Dict = abspath(join(dirname(dirname(__f...
362
"""simple docstring""" import math import sys def _snake_case ( UpperCamelCase : str ): UpperCAmelCase : Dict = """""" try: with open(UpperCamelCase , """rb""" ) as binary_file: UpperCAmelCase : str = binary_file.read() for dat in data: UpperC...
76
0
"""simple docstring""" import json import os import tempfile import unittest import numpy as np from datasets import load_dataset 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 ...
363
"""simple docstring""" import argparse import os import re import tensorflow as tf import torch from transformers import BertConfig, BertModel from transformers.utils import logging logging.set_verbosity_info() A: Optional[Any] = logging.get_logger(__name__) def _snake_case ( Up...
76
0
"""simple docstring""" from functools import lru_cache def _snake_case ( UpperCamelCase : int ): UpperCAmelCase : Tuple = 2 UpperCAmelCase : Dict = set() while i * i <= n: if n % i: i += 1 else: n //= i factors.add(UpperCamelCase ) if n > 1: ...
364
"""simple docstring""" import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class SCREAMING_SNAKE_CASE__ ( UpperCAmelCase__ ): def __init__...
76
0
"""simple docstring""" def _snake_case ( UpperCamelCase : int , UpperCamelCase : int ): return int((input_a, input_a).count(1 ) != 0 ) def _snake_case ( ): assert or_gate(0 , 0 ) == 0 assert or_gate(0 , 1 ) == 1 assert or_gate(1...
365
"""simple docstring""" import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format="%(message)s") def _snake_case ( UpperCamelCase : np.ndarray ): return input_array.reshape((input_array.size, 1) ) def _snake_cas...
76
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_...
366
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer A: int = logging.get_logger(__name__) ...
76
0
"""simple docstring""" import unittest from transformers import XLMConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common impor...
367
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze, transpose, ...
76
0
"""simple docstring""" import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def _lowerCAmelCase ( ): raise RuntimeError("""CUDA out of memory.""" ) class SCREAMING...
368
"""simple docstring""" import baseaa def _snake_case ( UpperCamelCase : str ): return baseaa.aaaencode(string.encode("""utf-8""" ) ) def _snake_case ( UpperCamelCase : bytes ): return baseaa.aaadecode(UpperCamelCase ).decode("""utf-8""" ) i...
76
0
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def _snake_case ( UpperCamelCase : str ): UpperCAmelCase : Any = ...
369
"""simple docstring""" import os from collections.abc import Iterator def _snake_case ( UpperCamelCase : str = "." ): for dir_path, dir_names, filenames in os.walk(UpperCamelCase ): UpperCAmelCase : List[Any] = [d for d in dir_names if d != """scripts""" and d[0] not in...
76
0
"""simple docstring""" import absl # noqa: F401 # Here to have a nice missing dependency error message early on import nltk # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import six # ...
370
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import loggi...
76
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available A = { "configuration_canine": ["CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP", "CanineConfig"], "tokenization_canine": ["CanineTokenize...
371
"""simple docstring""" from __future__ import annotations from typing import Any class SCREAMING_SNAKE_CASE__ : def __init__( self , _SCREAMING_SNAKE_CASE = 6 ) -> None: '''simple docstring''' UpperCAmelCase : Node | None = None UpperCAmelCase ...
76
0
"""simple docstring""" from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder A: Union[str, Any] = datasets.utils.logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( folder_based_builder.Fol...
350
"""simple docstring""" from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class ...
76
0
"""simple docstring""" import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger A: List[Any] = get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( enum.Enum ): __lowerCAmelCase : Dic...
351
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, loggin...
76
0
"""simple docstring""" from __future__ import annotations def _snake_case ( UpperCamelCase : tuple[int, int] , UpperCamelCase : int ): UpperCAmelCase : Optional[int] = position UpperCAmelCase : str = [ (y + 1, x + 2), (y - 1, x + 2), (y ...
352
"""simple docstring""" import math from typing import Callable, List, Optional, Union import numpy as np import PIL import torch from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion.pi...
76
0
"""simple docstring""" import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from pathlib ...
353
"""simple docstring""" def _snake_case ( UpperCamelCase : dict ): UpperCAmelCase : set[int] = set() # To detect a back edge, keep track of vertices currently in the recursion stack UpperCAmelCase : set[int] = set() return any( node not in visited and depth_f...
76
0
import collections import os import re from pathlib import Path A: Optional[int] = "src/transformers" # Matches is_xxx_available() A: int = re.compile(R"is\_([a-z_]*)_available()") # Catches a one-line _import_struct = {xxx} A: int = re.compile(R"^_import_st...
354
"""simple docstring""" from typing import List from .keymap import KEYMAP, get_character def _snake_case ( UpperCamelCase : str ): def decorator(UpperCamelCase : Optional[int] ): UpperCAmelCase : List[Any] = getattr(UpperCamelCase , """handle_key""" ,...
76
0
"""simple docstring""" import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def _snake_case ( UpperCamelCase : Dict , ...
355
"""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/licenses/LICENSE-2.0 ...
76
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor A: Any = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( UpperCAmelCase__ ): def __init__( self , *_SCREAMING_SNAKE_CASE , **_S...
356
"""simple docstring""" def _snake_case ( UpperCamelCase : int , UpperCamelCase : int ): return number | (1 << position) def _snake_case ( UpperCamelCase : int , UpperCamelCase : int ): return number & ~(1 << position) def _snake_case ...
76
0
"""simple docstring""" 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_avai...
357
"""simple docstring""" def _snake_case ( UpperCamelCase : Tuple , UpperCamelCase : Tuple , UpperCamelCase : Tuple=False ): if isinstance(UpperCamelCase , UpperCamelCase ) and isinstance(UpperCamelCase , UpperCamelCase ): UpperCAmelCase :...
76
0
import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets A: Dict = "\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n and Saurav Kadavath\n and Akul Aro...
358
"""simple docstring""" import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger A: List[Any] = get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( enum.Enum ): __lowerCAmelCase : Dict = 'all_...
76
0
"""simple docstring""" from __future__ import annotations def _snake_case ( UpperCamelCase : str , UpperCamelCase : str ): UpperCAmelCase : Union[str, Any] = get_failure_array(UpperCamelCase ) # 2) Step through text searching for pattern UpperCAmelCase ...
359
"""simple docstring""" def _snake_case ( UpperCamelCase : list , UpperCamelCase : list ): _validate_point(UpperCamelCase ) _validate_point(UpperCamelCase ) if len(UpperCamelCase ) != len(UpperCamelCase ): raise ValueError("""Both points must be in the sa...
76
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A: Tuple = { "configuration_clipseg": [ "CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP", "CLIPSegConfig", "CLIPSegTextConfig", ...
360
"""simple docstring""" from __future__ import annotations from decimal import Decimal from numpy import array def _snake_case ( UpperCamelCase : list[list[float]] ): UpperCAmelCase : int = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this implem...
76
0
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer A: Tuple...
361
"""simple docstring""" import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class SCREAMING_SNAKE_CASE__ : def __init__( self , _SCREAMING_SNAK...
76
0
"""simple docstring""" import argparse import os import shutil from pathlib import Path import onnx import torch from packaging import version from torch.onnx import export from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, StableDiffusionPipeline A: Optional[Any] = version....
362
"""simple docstring""" import math import sys def _snake_case ( UpperCamelCase : str ): UpperCAmelCase : Dict = """""" try: with open(UpperCamelCase , """rb""" ) as binary_file: UpperCAmelCase : str = binary_file.read() for dat in data: UpperC...
76
0
"""simple docstring""" from __future__ import annotations import math def _snake_case ( UpperCamelCase : int ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are n...
363
"""simple docstring""" import argparse import os import re import tensorflow as tf import torch from transformers import BertConfig, BertModel from transformers.utils import logging logging.set_verbosity_info() A: Optional[Any] = logging.get_logger(__name__) def _snake_case ( Up...
76
0
"""simple docstring""" from packaging import version from .. import __version__ from .constants import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, IMAGENET_STANDARD_MEAN, IMAGENET_STANDARD_STD from .doc import ( add_code_sample_docstrings, add_end_docstrings, add_start_docstrings, add_start_docstr...
364
"""simple docstring""" import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class SCREAMING_SNAKE_CASE__ ( UpperCAmelCase__ ): def __init__...
76
0
"""simple docstring""" def _snake_case ( UpperCamelCase : Tuple , UpperCamelCase : Tuple , UpperCamelCase : Tuple=False ): if isinstance(UpperCamelCase , UpperCamelCase ) and isinstance(UpperCamelCase , UpperCamelCase ): UpperCAmelCase :...
365
"""simple docstring""" import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format="%(message)s") def _snake_case ( UpperCamelCase : np.ndarray ): return input_array.reshape((input_array.size, 1) ) def _snake_cas...
76
0
"""simple docstring""" from math import acos, sin from typing import List, Tuple, Union import numpy as np import torch from PIL import Image from ...models import AutoencoderKL, UNetaDConditionModel from ...schedulers import DDIMScheduler, DDPMScheduler from ...utils import randn_tensor from ..pipeline_utils imp...
366
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer A: int = logging.get_logger(__name__) ...
76
0
"""simple docstring""" import json import logging import os import socket import git import numpy as np import torch logging.basicConfig( format="%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s", datefmt="%m/%d/%Y %H:%M:%S", level=logging.INFO, ) A: List[Any] ...
367
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze, transpose, ...
76
0
"""simple docstring""" import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home A: int = HUGGINGFACE_HUB_CACHE A: Optional[Any] = "config.json" A: Union[str, Any] = "diffusion_pytorch_model.bin" A: List[str] = "...
368
"""simple docstring""" import baseaa def _snake_case ( UpperCamelCase : str ): return baseaa.aaaencode(string.encode("""utf-8""" ) ) def _snake_case ( UpperCamelCase : bytes ): return baseaa.aaadecode(UpperCamelCase ).decode("""utf-8""" ) i...
76
0
"""simple docstring""" import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): def SCREAMING_SNAKE_CASE ( self ) -> List[str]: ...
369
"""simple docstring""" import os from collections.abc import Iterator def _snake_case ( UpperCamelCase : str = "." ): for dir_path, dir_names, filenames in os.walk(UpperCamelCase ): UpperCAmelCase : List[Any] = [d for d in dir_names if d != """scripts""" and d[0] not in...
76
0
"""simple docstring""" import unittest from transformers import TrOCRConfig from transformers.testing_utils import is_torch_available, require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_comm...
370
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import loggi...
76
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_single_...
371
"""simple docstring""" from __future__ import annotations from typing import Any class SCREAMING_SNAKE_CASE__ : def __init__( self , _SCREAMING_SNAKE_CASE = 6 ) -> None: '''simple docstring''' UpperCAmelCase : Node | None = None UpperCAmelCase ...
76
0
"""simple docstring""" import random def _A ( _a : list , _a : Any ): """simple docstring""" A , A , A = [], [], [] for element in data: if element < pivot: less.append(...
77
"""simple docstring""" def _A ( ): """simple docstring""" return [list(range(1_0_0_0 - i , -1_0_0_0 - i , -1 ) ) for i in range(1_0_0_0 )] UpperCAmelCase =generate_large_matrix() UpperCAmelCase =( [[4, 3, 2, -1], [3, ...
77
1
"""simple docstring""" import math class lowerCamelCase__ : '''simple docstring''' def UpperCamelCase__ ( self ,lowerCamelCase_ ,lowerCamelCase_ ) -> int: A = 0.0 A = 0.0 for i in range(l...
77
"""simple docstring""" import pytest UpperCAmelCase ="__dummy_dataset1__" UpperCAmelCase ="\nimport json\nimport os\n\nimport datasets\n\n\nREPO_URL = \"https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/\"\nURLS = {\"train\": REPO_URL + \"wikiann-bn-train.jsonl\", \...
77
1
"""simple docstring""" UpperCAmelCase =[ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def _A ( _a : Dict , _a : Optional[int] , _a : List[str] ...
77
"""simple docstring""" class lowerCamelCase__ : '''simple docstring''' def __init__( self ) -> Any: A = 0 A = 0 A = {} def UpperCamelCase__ ( self ,lowerCamelCase_ ) ...
77
1
"""simple docstring""" import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( SCREAMING_SNAKE_CASE ): '''simple docstring''' _lowerCamelCase = (DDPMScheduler,) def UpperCamelCase__...
77
"""simple docstring""" def _A ( _a : str , _a : str ): """simple docstring""" A = len(_a ) + 1 A = len(_a ) + 1 # dp is a 2d matrix where dp[i][j] denotes whether prefix string of ...
77
1
"""simple docstring""" import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( SCREAMING_SNAKE_CASE ): '''simple docstring''' _lowerCamelCase = (IPNDMScheduler,) _lowerC...
77
"""simple docstring""" from math import factorial def _A ( _a : int = 1_0_0 ): """simple docstring""" return sum(map(_a , str(factorial(_a ) ) ) ) if __name__ == "__main__": print(solution(int(input("Enter the N...
77
1
"""simple docstring""" import logging import os from .state import PartialState class lowerCamelCase__ ( logging.LoggerAdapter ): '''simple docstring''' @staticmethod def UpperCamelCase__ ( lowerCamelCase_ ) -> str: A = ...
77
"""simple docstring""" from typing import Dict, Iterable, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, ...
77
1
"""simple docstring""" from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState ...
77
"""simple docstring""" from collections.abc import Callable import numpy as np def _A ( _a : Callable , _a : float , _a : float , _a : float , _a : float ): """simple docstring""" A = int...
77
1
"""simple docstring""" from typing import Dict, Iterable, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, ...
77
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import ConfigTester from ....
77
1
"""simple docstring""" 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__ ( SCREAMING_SNAKE_C...
77
"""simple docstring""" from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL im...
77
1
"""simple docstring""" from math import sqrt def _A ( _a : int ): """simple docstring""" assert isinstance(_a , _a ) and ( number >= 0 ), "'number' must been an int and positive" A = True ...
77
"""simple docstring""" import torch from transformers import AutoModel class lowerCamelCase__ ( torch.nn.Module ): '''simple docstring''' def __init__( self ,lowerCamelCase_="sayef/fsner-bert-base-uncased" ) -> Tuple: super(lowerCamelCase_ ...
77
1
"""simple docstring""" import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch fro...
77
"""simple docstring""" import random def _A ( _a : list , _a : Any ): """simple docstring""" A , A , A = [], [], [] for element in data: if element < pivot: less.append(...
77
1
"""simple docstring""" from __future__ import annotations def _A ( _a : list[int] ): # This function is recursive """simple docstring""" A = len(_a ) # If the array contains only one element, we return it (it's the s...
77
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms...
77
1
"""simple docstring""" import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.gene...
77
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase =logging.get_logger(__name__) UpperCAmelCase ={ "distilbert-base-unca...
77
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor UpperCAmelCase =logging.get_logger(__name__) class lowerCamelCase__ ( SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__( s...
77
"""simple docstring""" import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class lowerCamelCase__ ( SC...
77
1
"""simple docstring""" def _A ( _a : int = 1_0_0_0 ): """simple docstring""" A = 2**power A = str(_a ) A = list(_a ) A = 0 for i in list_num:...
77
"""simple docstring""" def _A ( _a : Optional[int] ): """simple docstring""" A = [] A = set({"""(""", """[""", """{"""} ) A = set({""")""", """]""", """}"""} ) A ...
77
1
"""simple docstring""" from math import loga def _A ( _a : int ): """simple docstring""" if a < 0: raise ValueError("""Input value must be a positive integer""" ) elif isinstance(_a , _a ): raise Ty...
77
"""simple docstring""" import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py UpperCAmelCase ="\\n@INPROCEEDINGS{Papineni02bleu:a,\n author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu},\n title = {...
77
1
"""simple docstring""" from math import acos, sin from typing import List, Tuple, Union import numpy as np import torch from PIL import Image from ...models import AutoencoderKL, UNetaDConditionModel from ...schedulers import DDIMScheduler, DDPMScheduler from ...utils import randn_tensor from ..pip...
77
"""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 UpperCAmelCase =logging.get_logger(__name__) UpperCAmelCase ...
77
1
"""simple docstring""" import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup...
77
"""simple docstring""" from __future__ import annotations import math from collections.abc import Callable def _A ( _a : Callable[[int | float], int | float] , _a : int | float , _a : int | float , _a : int = 1_0_0 , ): """simple docs...
77
1
"""simple docstring""" import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration UpperCAmelCase =50_000 UpperCAmelCase =5_000 UpperCAmelCase , UpperCAmelCase =os.path.split(__file__) UpperCAmelCase =os.path.join(RESULTS...
77
"""simple docstring""" import math from numpy import inf from scipy.integrate import quad def _A ( _a : float ): """simple docstring""" if num <= 0: raise ValueError("""math domain error""" ) return quad(_a , 0 ...
77
1
"""simple docstring""" def _A ( _a : int ): """simple docstring""" A = [[0 for _ in range(_a )] for _ in range(m + 1 )] for i in range(m + 1 ): A = 1 for n in range(m + 1 ...
77
"""simple docstring""" import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Value from .base import TaskTemplate @dataclass(frozen=SCREAMING_SNAKE_CASE ) class lowerCamelCase__ ( SCREAMING_SNAKE_CASE ): ...
77
1
"""simple docstring""" import collections import os import re from pathlib import Path UpperCAmelCase ="src/transformers" # Matches is_xxx_available() UpperCAmelCase =re.compile(R"is\_([a-z_]*)_available()") # Catches a one-line _import_struct = {xxx} UpperCAmelCase =re.compile(R...
77
"""simple docstring""" def _A ( _a : int ): """simple docstring""" A = abs(_a ) A = 0 while n > 0: res += n % 1_0 n //= 1_0 return res def _A ( _a...
77
1
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging UpperCAmelCase =logging.get_logger(__name...
77
"""simple docstring""" import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": UpperCAmelCase =argparse.ArgumentParser() parser.add_argument("--dump_path", de...
77
1