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 lowerCamelCase ( lowerCAmelCase : Any , lowerCAmelCase : str , lowerCAmelCase : List[str] , lowerCAmelCase : str ): """simple docstring""" __magic_name__ : Optional[int] = [False] * len(lowerCAmelCase ) __magic_na...
275
'''simple docstring''' import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _lowerCamelCase ( unittest.TestC...
275
1
'''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 ...
275
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :Any = logging.get_logger(__name__) lowerCAmelCase :int = { '''unc-nlp/lxmert-base-uncased''': '''https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/mai...
275
1
'''simple docstring''' from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class _lowerCamelCase ( lowercase__ ): ...
275
'''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 ...
275
1
'''simple docstring''' import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenizerBa...
275
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaI...
275
1
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int = 50 ): """simple docstring""" __magic_name__ : Optional[Any] = [1] * (length + 1) for row_length in range(3 , length + 1 ): for block_length in range(3 , row_length + 1 ): for block_start in...
275
'''simple docstring''' import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_to...
275
1
'''simple docstring''' from graphs.minimum_spanning_tree_kruskal import kruskal def lowerCamelCase ( ): """simple docstring""" __magic_name__ : Tuple = 9 __magic_name__ : Optional[Any] = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, 8, 7], ...
275
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str ): """simple docstring""" return "".join(chr(ord(lowerCAmelCase ) - 32 ) if 'a' <= char <= 'z' else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
275
1
'''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 ...
275
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel...
275
1
'''simple docstring''' import unittest from transformers import DebertaVaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTes...
275
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): __magic_name__ : int = f'Input value of [number={number}] must be an integer' raise TypeError(lowerCAmelCase ) if nu...
275
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :Dict = logging.get_logger(__name__) lowerCAmelCase :Tuple = { '''google/realm-cc-news-pretrained-embedder''': ( '''https://huggingface.co/google/realm-...
275
'''simple docstring''' import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( ...
275
1
'''simple docstring''' import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": lowerCAmelCase :Optional[int] = argparse.ArgumentParser() parser.add_argument( '''--checkpoint_path'...
275
'''simple docstring''' from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor lowerCAmelCase ...
275
1
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : list , lowerCAmelCase : list ): """simple docstring""" _validate_point(lowerCAmelCase ) _validate_point(lowerCAmelCase ) if len(lowerCAmelCase ) != len(lowerCAmelCase ): raise ValueError('Both points must b...
275
'''simple docstring''' import socket def lowerCamelCase ( ): """simple docstring""" __magic_name__ : List[str] = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) __magic_name__ : Union[str, Any] = socket.gethostname() __magic_name__ : int ...
275
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaI...
275
'''simple docstring''' from __future__ import annotations from sys import maxsize from typing import Generic, TypeVar lowerCAmelCase :Any = TypeVar('''T''') def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" return (position - 1) // 2 def l...
275
1
'''simple docstring''' import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py lowerCAmelCase :Optional[Any] = '''.''' if __name__ == "__main__": lowerCAmelCase :Optional[Any] = ...
350
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow ha...
275
0
'''simple docstring''' import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_ful...
351
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" __magic_name__ : Optional[int] = 1 for i in range(1 , num + 1 ): fact *= i return fact def lowerCamelCase ( lowerCAmelCase : int ): """simple ...
275
0
'''simple docstring''' import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py lowerCAmelCase :Optional[int] = '''.''' if __name__ == "__main__": lowerCAmelCase :str = os.path.jo...
352
'''simple docstring''' from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DD...
275
0
'''simple docstring''' from math import factorial def lowerCamelCase ( lowerCAmelCase : int , lowerCAmelCase : int , lowerCAmelCase : float ): """simple docstring""" if successes > trials: raise ValueError('successes must be lower or equal to trials' ) if t...
353
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logging, ) ...
275
0
'''simple docstring''' import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available, i...
354
'''simple docstring''' import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor lowerCAmelCase :Tuple = logging.get_logger(__name__) class _lowerCamelCase ( lowercase__ ): '''simple docstring''' def __init__( self : Any , ...
275
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta....
355
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCAmelCase :str = { '''configuration_vision_encoder_decoder''': ['''VisionEncoderDecoder...
275
0
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class _lowerCamelCase : '''simple docstring''' def __init__( self : Optional[Any] ) -> int: __magic_name__ : List[str] = {} def __...
356
'''simple docstring''' lowerCAmelCase :Union[str, Any] = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers...
275
0
'''simple docstring''' import inspect import os import re from transformers.configuration_utils import PretrainedConfig from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/...
357
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str , lowerCAmelCase : Any , lowerCAmelCase : Any=False ): """simple docstring""" if isinstance(lowerCAmelCase , lowerCAmelCase ) and isinstance(lowerCAmelCase , lowerCAmelCase ): __magic_name__ : ...
275
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import T...
358
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str ): """simple docstring""" if not all(x.isalpha() for x in string ): raise ValueError('String must only contain alphabetic characters.' ) __magic_name__ : int = sorted(string.lower() ) return len(l...
275
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class _lowerCamelCase ( metaclass=__A ): '''simple docstring''' A_ : int = ['torch', 'scipy'] def __init__( self : Union[str, Any] , *_A : Optional[int] , **_A : ...
359
'''simple docstring''' import math def lowerCamelCase ( lowerCAmelCase : float , lowerCAmelCase : float ): """simple docstring""" return math.pow(lowerCAmelCase , 2 ) - a def lowerCamelCase ( lowerCAmelCase : float ): """simple docstring"...
275
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class _lowerCamelCase ( metaclass=A_ ): '''simple docstring''' A_ : Optional[Any] = ["torch", "transformers", "onnx"] def __init__( self : Optional[int] , *_A : Optional[int...
360
'''simple docstring''' import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _lowerCamelCase ( unittest.TestC...
275
0
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :Optional[Any] = logging.get_logger(__name__) lowerCAmelCase :int = { '''huggingface/time-series-transformer-tourism-monthly''': ( '''...
361
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :Any = logging.get_logger(__name__) lowerCAmelCase :int = { '''unc-nlp/lxmert-base-uncased''': '''https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/mai...
275
0
import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node lowerCAmelCase :Optional[int] = 4 lowerCAmelCase :Any = 3 class _lowerCamelCase ( l...
362
'''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 ...
275
0
'''simple docstring''' import math def lowerCamelCase ( lowerCAmelCase : Union[str, Any] ): """simple docstring""" 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...
363
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaI...
275
0
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : Dict ): """simple docstring""" __magic_name__ : int = [0] * len(a_ ) __magic_name__ : Optional[Any] = [] __magic_name__ : Tuple = [1] * len(a_ ) for values in graph.values(): ...
364
'''simple docstring''' import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_to...
275
0
'''simple docstring''' from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerate_a...
365
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str ): """simple docstring""" return "".join(chr(ord(lowerCAmelCase ) - 32 ) if 'a' <= char <= 'z' else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
275
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel...
366
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel...
275
0
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def lowerCamelCase ( lowerCAmelCase : int="ro" , lowerCAmelCase : str="en" , lowerCAmelCase : str="wmt16" , lowerCAmelCase : Dict=None ): """simple docstring""" try: i...
367
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): __magic_name__ : int = f'Input value of [number={number}] must be an integer' raise TypeError(lowerCAmelCase ) if nu...
275
0
'''simple docstring''' import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate ...
368
'''simple docstring''' import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( ...
275
0
'''simple docstring''' import argparse import os import re lowerCAmelCase :Union[str, Any] = '''src/diffusers''' # Pattern that looks at the indentation in a line. lowerCAmelCase :Tuple = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAm...
369
'''simple docstring''' from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor lowerCAmelCase ...
275
0
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" return 1 if digit in (0, 1) else (digit * factorial(digit - 1 )) def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" __magic_name__ : Lis...
370
'''simple docstring''' import socket def lowerCamelCase ( ): """simple docstring""" __magic_name__ : List[str] = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) __magic_name__ : Union[str, Any] = socket.gethostname() __magic_name__ : int ...
275
0
'''simple docstring''' 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...
371
'''simple docstring''' from __future__ import annotations from sys import maxsize from typing import Generic, TypeVar lowerCAmelCase :Any = TypeVar('''T''') def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" return (position - 1) // 2 def l...
275
0
'''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 ..pipeline_par...
350
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow ha...
275
0
'''simple docstring''' lowerCAmelCase :Optional[int] = [0, 2, 4, 6, 8] lowerCAmelCase :Union[str, Any] = [1, 3, 5, 7, 9] def lowerCamelCase ( lowerCAmelCase : Any , lowerCAmelCase : Tuple , lowerCAmelCase : Union[str, Any] , lowerCAmelCase ...
351
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" __magic_name__ : Optional[int] = 1 for i in range(1 , num + 1 ): fact *= i return fact def lowerCamelCase ( lowerCAmelCase : int ): """simple ...
275
0
'''simple docstring''' from manim import * class _lowerCamelCase ( __snake_case ): '''simple docstring''' def __lowerCAmelCase ( self : Any ) -> Any: __magic_name__ : int = Rectangle(height=0.5 , width=0.5 ) __magic_name__ : int ...
352
'''simple docstring''' from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DD...
275
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :Optional[int] = logging.get_logger(__name__) lowerCAmelCase :Any = { """uclanlp/visualbert-vqa""": """https://huggingface.co/uclanlp/visualbert-vqa/resolve/mai...
353
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logging, ) ...
275
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer fro...
354
'''simple docstring''' import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor lowerCAmelCase :Tuple = logging.get_logger(__name__) class _lowerCamelCase ( lowercase__ ): '''simple docstring''' def __init__( self : Any , ...
275
0
'''simple docstring''' import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelock import FileLock from ....
355
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCAmelCase :str = { '''configuration_vision_encoder_decoder''': ['''VisionEncoderDecoder...
275
0
'''simple docstring''' import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, n...
356
'''simple docstring''' lowerCAmelCase :Union[str, Any] = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers...
275
0
'''simple docstring''' from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def lowerCamelCase ( ): """simple docstring""" __magic_name__ , __magic_name__ : Dict = 9, 14 # noqa: F841...
357
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str , lowerCAmelCase : Any , lowerCAmelCase : Any=False ): """simple docstring""" if isinstance(lowerCAmelCase , lowerCAmelCase ) and isinstance(lowerCAmelCase , lowerCAmelCase ): __magic_name__ : ...
275
0
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sa...
358
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str ): """simple docstring""" if not all(x.isalpha() for x in string ): raise ValueError('String must only contain alphabetic characters.' ) __magic_name__ : int = sorted(string.lower() ) return len(l...
275
0
'''simple docstring''' from __future__ import annotations import time import numpy as np lowerCAmelCase :str = [8, 5, 9, 7] lowerCAmelCase :Optional[int] = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] lowerCAmelCase :Dict = ...
359
'''simple docstring''' import math def lowerCamelCase ( lowerCAmelCase : float , lowerCAmelCase : float ): """simple docstring""" return math.pow(lowerCAmelCase , 2 ) - a def lowerCamelCase ( lowerCAmelCase : float ): """simple docstring"...
275
0
'''simple docstring''' import argparse import requests import torch from PIL import Image from torchvision.transforms import Compose, Normalize, Resize, ToTensor from transformers import SwinaSRConfig, SwinaSRForImageSuperResolution, SwinaSRImageProcessor def lowerCamelCase ( lowerCAmelCase : ...
360
'''simple docstring''' import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _lowerCamelCase ( unittest.TestC...
275
0
import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": lowerCAmelCase :List[Any] = argparse.ArgumentParser() parser.add_argument('''--dump_path''', defau...
361
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :Any = logging.get_logger(__name__) lowerCAmelCase :int = { '''unc-nlp/lxmert-base-uncased''': '''https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/mai...
275
0
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 lowerCAmelCase :List[str] = logging.get_logger(__name__) lowerCAmelCase :List[Any] ...
362
'''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 ...
275
0
'''simple docstring''' import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenizerBa...
363
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaI...
275
0
'''simple docstring''' import argparse from collections import defaultdict import yaml lowerCAmelCase :Optional[Any] = '''docs/source/en/_toctree.yml''' def lowerCamelCase ( lowerCAmelCase : List[Any] ): """simple docstring""" __magic_name__ : int = ...
364
'''simple docstring''' import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_to...
275
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImageProce...
365
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str ): """simple docstring""" return "".join(chr(ord(lowerCAmelCase ) - 32 ) if 'a' <= char <= 'z' else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
275
0
'''simple docstring''' from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def lowerCamelCase ( lowerCAmelCase : int ) -> bool: """simple docstring""" __magic_name__ : Any = int(number**0.5 ) return number == sq * sq ...
366
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel...
275
0
'''simple docstring''' from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_vision_available(): from PIL import Image from ..image_utils import...
367
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): __magic_name__ : int = f'Input value of [number={number}] must be an integer' raise TypeError(lowerCAmelCase ) if nu...
275
0
'''simple docstring''' from math import sqrt def lowerCamelCase ( lowerCAmelCase : int = 100_0000 ): """simple docstring""" __magic_name__ : int = 0 __magic_name__ : Optional[Any] = 0 __magic_name__ : List[Any] = 42 while num...
368
'''simple docstring''' import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( ...
275
0
'''simple docstring''' import argparse import torch from transformers import RemBertConfig, RemBertModel, load_tf_weights_in_rembert from transformers.utils import logging logging.set_verbosity_info() def lowerCamelCase ( lowerCAmelCase : Optional[Any] , lowerCAmelCase : Union[str...
369
'''simple docstring''' from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor lowerCAmelCase ...
275
0
'''simple docstring''' lowerCAmelCase :Dict = '''Input must be a string of 8 numbers plus letter''' lowerCAmelCase :int = '''TRWAGMYFPDXBNJZSQVHLCKE''' def lowerCamelCase ( lowerCAmelCase : str ): """simple docstring""" if not isinstance(lowerCAmelC...
370
'''simple docstring''' import socket def lowerCamelCase ( ): """simple docstring""" __magic_name__ : List[str] = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) __magic_name__ : Union[str, Any] = socket.gethostname() __magic_name__ : int ...
275
0
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCAmelCase :Optional[Any] = { '''configuration_efficientnet''': [ '''E...
371
'''simple docstring''' from __future__ import annotations from sys import maxsize from typing import Generic, TypeVar lowerCAmelCase :Any = TypeVar('''T''') def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" return (position - 1) // 2 def l...
275
0
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : Tuple ): """simple docstring""" __magic_name__ : Dict = [int(__lowerCAmelCase ) for i in ip_va_address.split('.' ) if i.isdigit()] return len(__lowerCAmelCase ) == 4 and all(0 <= int(__lowerCAmelCase ) <...
350
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow ha...
275
0
'''simple docstring''' from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_...
351
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" __magic_name__ : Optional[int] = 1 for i in range(1 , num + 1 ): fact *= i return fact def lowerCamelCase ( lowerCAmelCase : int ): """simple ...
275
0
'''simple docstring''' 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_configuratio...
352
'''simple docstring''' from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DD...
275
0
'''simple docstring''' import argparse import re import numpy as np import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SamConfig, SamImageProcessor, SamModel, SamProcessor, SamVisionConfig, ) lowerCAmelCase :Optional[i...
353
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logging, ) ...
275
0
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : Any , lowerCAmelCase : Any ): """simple docstring""" return int(input_a == input_a == 0 ) def lowerCamelCase ( ): """simple docstring""" print('Truth Table of NOR Gate:' ) print('| ...
354
'''simple docstring''' import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor lowerCAmelCase :Tuple = logging.get_logger(__name__) class _lowerCamelCase ( lowercase__ ): '''simple docstring''' def __init__( self : Any , ...
275
0
'''simple docstring''' from __future__ import annotations from collections import namedtuple def lowerCamelCase ( lowerCAmelCase : float , lowerCAmelCase : float , lowerCAmelCase : float ): """simple docstring""" __magic_name__ : Optional[int] = ...
355
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCAmelCase :str = { '''configuration_vision_encoder_decoder''': ['''VisionEncoderDecoder...
275
0
'''simple docstring''' from __future__ import annotations from typing import Any def lowerCamelCase ( lowerCAmelCase : list[Any] ): """simple docstring""" create_state_space_tree(lowerCAmelCase , [] , 0 ) def lowerCamelCase ( lowerCAmelCase : list[Any...
356
'''simple docstring''' lowerCAmelCase :Union[str, Any] = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers...
275
0
'''simple docstring''' import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline lowerCAmelCase :Optional[int] = argparse.ArgumentParser('''Stable Diffusion script with intel optimization''', add...
357
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str , lowerCAmelCase : Any , lowerCAmelCase : Any=False ): """simple docstring""" if isinstance(lowerCAmelCase , lowerCAmelCase ) and isinstance(lowerCAmelCase , lowerCAmelCase ): __magic_name__ : ...
275
0
'''simple docstring''' lowerCAmelCase :Optional[int] = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.g...
358
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str ): """simple docstring""" if not all(x.isalpha() for x in string ): raise ValueError('String must only contain alphabetic characters.' ) __magic_name__ : int = sorted(string.lower() ) return len(l...
275
0
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig lowerCAmelCase :List[Any] = logging.get_logger(__name__) lowerCAmelCase :int = { 'Intel/dpt-large': 'https://huggingface.co/Intel/dpt-...
359
'''simple docstring''' import math def lowerCamelCase ( lowerCAmelCase : float , lowerCAmelCase : float ): """simple docstring""" return math.pow(lowerCAmelCase , 2 ) - a def lowerCamelCase ( lowerCAmelCase : float ): """simple docstring"...
275
0
'''simple docstring''' from jiwer import compute_measures import datasets lowerCAmelCase :List[Any] = '''\ @inproceedings{inproceedings, author = {Morris, Andrew and Maier, Viktoria and Green, Phil}, year = {2004}, month = {01}, pages = {}, title = {From WER and RIL to MER and ...
360
'''simple docstring''' import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _lowerCamelCase ( unittest.TestC...
275
0
import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def lowerCamelCase ( lowerCAmelCase : List[str] , lowerCAmelCase : Dict=1 ): """simple docstring""" if n_shave_prefix_segments >= 0: return ".".join(path.s...
361
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :Any = logging.get_logger(__name__) lowerCAmelCase :int = { '''unc-nlp/lxmert-base-uncased''': '''https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/mai...
275
0
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def lowerCamelCase ( lowerCAmelCase : Optional[int] , lowerCAmelCase : str ): """simple docstring""" __magic_name__ : Dict = f'{sampling_rate}' ...
362
'''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 ...
275
0
'''simple docstring''' import operator as op def lowerCamelCase ( lowerCAmelCase : List[Any] ): """simple docstring""" __magic_name__ : List[Any] = [] __magic_name__ : Any = lambda lowerCAmelCase , lowerCAmelCase : int(x / y ) # noqa: E731 int...
363
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaI...
275
0
'''simple docstring''' import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosity_info() lowerCAmelCase :Lis...
364
'''simple docstring''' import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_to...
275
0
'''simple docstring''' import enum import shutil import sys lowerCAmelCase , lowerCAmelCase :List[str] = shutil.get_terminal_size() lowerCAmelCase :Any = {'''UP''': '''A''', '''DOWN''': '''B''', '''RIGHT''': '''C''', '''LEFT''': '''D'''} class _lowerCamelCase ( enum.Enum ...
365
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str ): """simple docstring""" return "".join(chr(ord(lowerCAmelCase ) - 32 ) if 'a' <= char <= 'z' else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
275
0
'''simple docstring''' import unittest import numpy as np from transformers import AlbertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax...
366
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel...
275
0
'''simple docstring''' import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass # Co...
367
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): __magic_name__ : int = f'Input value of [number={number}] must be an integer' raise TypeError(lowerCAmelCase ) if nu...
275
0
'''simple docstring''' from __future__ import annotations import math def lowerCamelCase ( lowerCAmelCase : float , lowerCAmelCase : int ): """simple docstring""" __magic_name__ : Tuple = u for i in range(1 , lowerCAmelCase ): __magic_name__ :...
368
'''simple docstring''' import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( ...
275
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler,...
369
'''simple docstring''' from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor lowerCAmelCase ...
275
0
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int , lowerCAmelCase : float , lowerCAmelCase : float ): """simple docstring""" return round(float(moles / volume ) * nfactor ) def lowerCamelCase ( lowerCAmelCase : float , lower...
370
'''simple docstring''' import socket def lowerCamelCase ( ): """simple docstring""" __magic_name__ : List[str] = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) __magic_name__ : Union[str, Any] = socket.gethostname() __magic_name__ : int ...
275
0
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, PNDMScheduler, StableDiffusionLDMaDPipeline, UNetaDConditionModel, ) f...
371
'''simple docstring''' from __future__ import annotations from sys import maxsize from typing import Generic, TypeVar lowerCAmelCase :Any = TypeVar('''T''') def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" return (position - 1) // 2 def l...
275
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase :Optional[Any] = { "configuration_falcon": ["FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP", "FalconConfig"], } try: if no...
350
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow ha...
275
0
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int , lowerCAmelCase : int ): """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(_SCREAMING_SNAKE_CASE , int(b / 2 ) ) * actual_power(_SCREAMING_SNAKE_CASE , int(b / 2 )...
351
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" __magic_name__ : Optional[int] = 1 for i in range(1 , num + 1 ): fact *= i return fact def lowerCamelCase ( lowerCAmelCase : int ): """simple ...
275
0
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def lowerCamelCase ( lowerCAmelCase : Dict ): """simple docstring""" __magic_name__ : str = ...
352
'''simple docstring''' from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DD...
275
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :Optional[int] = logging.get_logger(__name__) lowerCAmelCase :Optional[int] = { 'microsoft/markuplm-base': 'https://huggingface.co/microsoft/markuplm-base/resol...
353
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logging, ) ...
275
0
'''simple docstring''' from scipy.stats import pearsonr import datasets lowerCAmelCase :Any = ''' Pearson correlation coefficient and p-value for testing non-correlation. The Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relie...
354
'''simple docstring''' import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor lowerCAmelCase :Tuple = logging.get_logger(__name__) class _lowerCamelCase ( lowercase__ ): '''simple docstring''' def __init__( self : Any , ...
275
0
'''simple docstring''' import operator as op lowerCAmelCase :Optional[Any] = "scaler.pt" lowerCAmelCase :Dict = "pytorch_model" lowerCAmelCase :Any = "random_states" lowerCAmelCase :List[Any] = "optimizer" lowerCAmelCase :List[str] = "sche...
355
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCAmelCase :str = { '''configuration_vision_encoder_decoder''': ['''VisionEncoderDecoder...
275
0
'''simple docstring''' from scipy.stats import pearsonr import datasets lowerCAmelCase :List[Any] = '\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value...
356
'''simple docstring''' lowerCAmelCase :Union[str, Any] = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers...
275
0
'''simple docstring''' from typing import Any import numpy as np def lowerCamelCase ( lowerCAmelCase : np.ndarray ): """simple docstring""" return np.array_equal(lowercase_ , matrix.conjugate().T ) def lowerCamelCase ( lowerCAm...
357
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str , lowerCAmelCase : Any , lowerCAmelCase : Any=False ): """simple docstring""" if isinstance(lowerCAmelCase , lowerCAmelCase ) and isinstance(lowerCAmelCase , lowerCAmelCase ): __magic_name__ : ...
275
0
'''simple docstring''' from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder lowerCAmelCase :Tuple = datasets.utils.logging.get_logger(__name__) class _lowerCamelCase ( folder_based_builder.FolderBasedBu...
358
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str ): """simple docstring""" if not all(x.isalpha() for x in string ): raise ValueError('String must only contain alphabetic characters.' ) __magic_name__ : int = sorted(string.lower() ) return len(l...
275
0
'''simple docstring''' import requests from bsa import BeautifulSoup def lowerCamelCase ( lowerCAmelCase : Optional[Any] = "AAPL" ): """simple docstring""" __magic_name__ : str = f'https://in.finance.yahoo.com/quote/{symbol}?s={symbol}' __magic_name__ : int ...
359
'''simple docstring''' import math def lowerCamelCase ( lowerCAmelCase : float , lowerCAmelCase : float ): """simple docstring""" return math.pow(lowerCAmelCase , 2 ) - a def lowerCamelCase ( lowerCAmelCase : float ): """simple docstring"...
275
0
'''simple docstring''' from math import factorial lowerCAmelCase :dict[str, int] = {str(digit): factorial(digit) for digit in range(1_0)} def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): ...
360
'''simple docstring''' import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _lowerCamelCase ( unittest.TestC...
275
0
def lowerCamelCase ( lowerCAmelCase : int = 1000 ): """simple docstring""" __magic_name__ : List[Any] = 2**power __magic_name__ : Tuple = str(_a ) __magic_name__ : Optional[Any] = list(_a ) __magic_name__ : Optional[int] = ...
361
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :Any = logging.get_logger(__name__) lowerCAmelCase :int = { '''unc-nlp/lxmert-base-uncased''': '''https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/mai...
275
0
from manim import * class _lowerCamelCase ( lowerCamelCase__ ): '''simple docstring''' def __lowerCAmelCase ( self : Any ) -> Dict: __magic_name__ : Tuple = Rectangle(height=0.5 , width=0.5 ) __magic_name__ : Any = Rectangle...
362
'''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 ...
275
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :Union[str, Any] = logging.get_logger(__name__) lowerCAmelCase :Optional[int] = { '''EleutherAI/gpt-neox-20b''': '''https://huggingface.co/EleutherAI/gpt-neox-2...
363
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaI...
275
0
'''simple docstring''' import os import sys lowerCAmelCase :int = os.path.join(os.path.dirname(__file__), '''src''') sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelF...
364
'''simple docstring''' import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_to...
275
0
'''simple docstring''' from __future__ import annotations lowerCAmelCase :int = [-1_0, -5, 0, 5, 5.1, 1_1, 1_3, 2_1, 3, 4, -2_1, -1_0, -5, -1, 0] lowerCAmelCase :Optional[Any] = [-5, 0, 5, 5.1, 1_1, 1_3, 2_1, -1, 4, -1, -1_0, -5, -1, 0, -1] def lowerCamelCase ( lowerCAm...
365
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str ): """simple docstring""" return "".join(chr(ord(lowerCAmelCase ) - 32 ) if 'a' <= char <= 'z' else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
275
0
'''simple docstring''' import logging import torch from accelerate import Accelerator from arguments import EvaluationArguments from datasets import load_dataset from torch.utils.data import IterableDataset from torch.utils.data.dataloader import DataLoader from transformers import AutoModelForCausalLM, AutoToken...
366
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel...
275
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :str = logging.get_logger(__name__) lowerCAmelCase :Tuple = {} class _lowerCamelCase ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' low...
367
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): __magic_name__ : int = f'Input value of [number={number}] must be an integer' raise TypeError(lowerCAmelCase ) if nu...
275
0
'''simple docstring''' import argparse import collections import os import re import tempfile import pandas as pd from datasets import Dataset from huggingface_hub import hf_hub_download, upload_folder from transformers.utils import direct_transformers_import # All paths are set with the intent you should run t...
368
'''simple docstring''' import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( ...
275
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCAmelCase :str = {'''configuration_encoder_decoder''': ['''EncoderDecoderConfig''']} try: ...
369
'''simple docstring''' from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor lowerCAmelCase ...
275
0
'''simple docstring''' import math def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" __magic_name__ : Optional[int] = [] __magic_name__ : Optional[int] = 2 __magic_name__ : Tuple = int(math.sqrt(snake_case_ ) ) ...
370
'''simple docstring''' import socket def lowerCamelCase ( ): """simple docstring""" __magic_name__ : List[str] = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) __magic_name__ : Union[str, Any] = socket.gethostname() __magic_name__ : int ...
275
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase :Any = { '''configuration_blip_2''': [ '''BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Blip2Config''', ...
371
'''simple docstring''' from __future__ import annotations from sys import maxsize from typing import Generic, TypeVar lowerCAmelCase :Any = TypeVar('''T''') def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" return (position - 1) // 2 def l...
275
0