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""" import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class a__ ( unittest.TestCase ): def lowercase ( se...
255
"""simple docstring""" _UpperCamelCase: Dict = [ 9_9_9, 8_0_0, 7_9_9, 6_0_0, 5_9_9, 5_0_0, 4_0_0, 3_9_9, 3_7_7, 3_5_5, 3_3_3, 3_1_1, 2_8_8, 2_6_6, 2_4_4, 2_2_2, 2_0_0, 1_9_9, 1_7_7, 1_5_5, ...
255
1
import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, BertTokenizer, BertTokenizerFast, CT...
352
"""simple docstring""" import os from typing import Dict, List, Union import tensorflow as tf from keras_nlp.tokenizers import BytePairTokenizer from tensorflow_text import pad_model_inputs from .tokenization_gpta import GPTaTokenizer class lowerCamelCase ( tf.keras.layers.Layer ): '''simple docstri...
166
0
'''simple docstring''' import unittest import torch from torch import nn from diffusers.models.activations import get_activation class _a ( unittest.TestCase ): def A ( self : List[str] ): '''simple docstring''' UpperCAmelCase = get_activat...
34
'''simple docstring''' import math class __A : '''simple docstring''' def __init__(self , A=0 ) -> Dict: # a graph with Node 0,1,...,N-1 """simple docstring""" _a = n _a = [ [math.inf for j in range(0 , A )] for i in range...
211
0
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES UpperCamelCase_ = logging.get_logger(__name__) Upper...
360
'''simple docstring''' from scipy.stats import spearmanr import datasets UpperCamelCase_ = "\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implyi...
246
0
"""simple docstring""" import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStruct...
136
"""simple docstring""" import argparse import collections import json import os import re import string import sys import numpy as np UpperCAmelCase : Union[str, Any] = re.compile(r"\b(a|an|the)\b", re.UNICODE) UpperCAmelCase : Optional[Any] = None def _SCREAMING_...
136
1
"""simple docstring""" import mpmath # for roots of unity import numpy as np class UpperCamelCase_ : def __init__( self , snake_case__=None , snake_case__=None ) -> Optional[Any]: """simple docstring""" Upper...
353
"""simple docstring""" from __future__ import annotations def _lowerCAmelCase ( lowerCAmelCase = 4 ): '''simple docstring''' UpperCAmelCase = abs(lowerCAmelCase ) or 4 return [[1 + x + y * row_size for x in range(lowerCAmelCase )] for y in ra...
248
0
import math class __SCREAMING_SNAKE_CASE : def __init__( self , SCREAMING_SNAKE_CASE__=0 ): # a graph with Node 0,1,...,N-1 lowercase : List[Any] = n lowercase : List[Any] = [ [math.inf for j in rang...
337
from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging __a = logging.get_logger(__name__) def __lowercase ( _UpperCamelCase ) ->List[int]: """simple docstring""" if isinstance(_UpperCamelCase, np.ndarray ): ...
337
1
import baseaa def SCREAMING_SNAKE_CASE_ ( _SCREAMING_SNAKE_CASE: str ): '''simple docstring''' return baseaa.baaencode(string.encode("utf-8" ) ) def SCREAMING_SNAKE_CASE_ ( _SCREAMING_SNAKE_CASE: bytes ): '''simple docstring''' ...
356
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applic...
297
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, StableDif...
323
'''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 __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCa...
323
1
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, ) __snake_case = { """iou_prediction_head...
169
import shutil import tempfile import unittest from transformers import ( SPIECE_UNDERLINE, AddedToken, BatchEncoding, NllbTokenizer, NllbTokenizerFast, is_torch_available, ) from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_...
169
1
"""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, Trai...
84
"""simple docstring""" import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloyd_if imp...
84
1
import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformers.utils...
353
"""simple docstring""" import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow __A : Tuple = logging.getLogger() @unittest.skip("...
326
0
'''simple docstring''' import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils import ...
97
from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_te...
143
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :Union[str, Any] = logging.get_logger(__name__) lowerCAmelCase :Union[str, Any] = { '''bigcode/gpt_bigcode-santacoder''': '''https://huggingface.co/bigcode/gpt_...
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
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( __a ): if not nums: raise ValueError('List is empty' ) return sum(__a ) / len(__a ) if __name__ == "__main__": import doctest doctest.testmod()
327
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqL...
327
1
'''simple docstring''' import json import os import torch from diffusers import UNetaDModel os.makedirs('''hub/hopper-medium-v2/unet/hor32''', exist_ok=True) os.makedirs('''hub/hopper-medium-v2/unet/hor128''', exist_ok=True) os.makedirs('''hub/hopper-medium-v2/value_function''', exist_ok=True) ...
351
'''simple docstring''' from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concat...
170
0
import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def lowercase_ ( _A : str , _A : Tuple , _A : List[Any] , ...
184
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Union[str, Any] = logging.get_logger(__name__) A : Optional[Any] = { "xlm-roberta-base": "...
184
1
import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from transformers import ( Ef...
361
"""simple docstring""" import math import random from typing import Any from .hill_climbing import SearchProblem def _lowerCAmelCase ( lowerCAmelCase , lowerCAmelCase = True , lowerCAmelCase = math.inf , lowerCAmelCase = -math.inf , lowerCAmelCase = math.inf , lowerCAmelCase = -math.inf ,...
248
0
"""simple docstring""" from typing import Dict from .base import GenericTensor, Pipeline class lowerCAmelCase_ (a__ ): """simple docstring""" def __magic_name__ (self , SCREAMING_SNAKE_CASE__=None , SCREAMING_SNAKE_CASE__=None , SCREAMING_SNAKE...
25
"""simple docstring""" import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class lowerCAmelCase_ (unittest.TestCase ): """simple docstring""" ...
25
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { '''google/pegasus-large''': '''https://huggingface.co/google/pegasus-large/resolve/main/config.json''', # See all PEGASUS models at https://h...
121
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class snake_case__: """simple docstring""" def __init__( self : Optional[Any] , SCREAMING_SNAKE_CASE : Collection[float] | None = None ): ...
121
1
import math def __SCREAMING_SNAKE_CASE ( ) -> None: __lowercase = input('Enter message: ' ) __lowercase = int(input(F"""Enter key [2-{len(snake_case_ ) - 1}]: """ ) ) __lowercase = input('Encryption/Decryption [e/d]: ' ) if mode.lower()...
325
"""simple docstring""" import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import...
126
0
import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table import table_cast from datasets.utils.p...
367
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder _UpperCAmelCase : Any = datasets.utils.logging.get_logger(__name__) class lowerCAmelCase ( folder_based_builder.FolderBasedBuilderConfig...
45
0
import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_MODEL_FOR_SEQUENCE_CLASSIFICATIO...
244
"""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...
66
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __UpperCAmelCase = { 'configuration_re...
365
"""simple docstring""" # This model implementation is heavily inspired by https://github.com/haofanwang/ControlNet-for-Diffusers/ import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextMode...
1
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCamelCase = logging.get_logger(__name__) lowerCamelCase = '''▁''' lowerCam...
131
'''simple docstring''' def UpperCamelCase( UpperCAmelCase_ ): return [ { 0: [1, 2], 1: [0, 2], 2: [0, 1, 3, 5], 3: [2, 4], 4: [3], 5: [2, 6, 8], 6: [5, 7], 7: [6, 8], 8: [5, 7], }, { ...
151
0
'''simple docstring''' from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class A__ ( A__ ): def A ( self : List[Any] , _a : float ) -> float: '''simple docstrin...
357
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase : Tuple = {"configuration_fnet": ["FNET_PRETRAINED_CONFIG_ARCHIVE_MAP...
114
0
import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available from ...test_backbone_common...
9
from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if ...
245
0
'''simple docstring''' from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def a__ ( lowerCAmelCase__ ) -> bool: UpperCAmelCase__ : int = int(number**0.5 ) return number == sq * sq def ...
365
'''simple docstring''' import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import Ada...
299
0
'''simple docstring''' from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, ...
276
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .modeling_utils import ModelMixin...
276
1
'''simple docstring''' from __future__ import annotations import copy import inspect import unittest import numpy as np from transformers import is_tf_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from transfor...
359
'''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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ...
280
0
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-...
104
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase = { '''configuration_electra''': ['''ELECTRA_PRETRAINED_CONFIG_A...
87
0
"""simple docstring""" import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, pr...
369
"""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(): fro...
80
0
UpperCamelCase = { '''Pillow''': '''Pillow<10.0.0''', '''accelerate''': '''accelerate>=0.20.3''', '''av''': '''av==9.2.0''', '''beautifulsoup4''': '''beautifulsoup4''', '''black''': '''black~=23.1''', '''codecarbon''': '''codecarbon==1.2.0''', '''cookiecutter''': '''...
306
"""simple docstring""" import torch from torch import nn from transformers import CLIPPreTrainedModel, CLIPVisionModel from ...models.attention import BasicTransformerBlock from ...utils import logging lowerCamelCase_ = logging.get_logger(__name__) # pylint: disable=invalid-name class Uppe...
268
0
import os from collections.abc import Iterator def _SCREAMING_SNAKE_CASE ( lowercase : Optional[Any] = "." ): '''simple docstring''' for dir_path, dir_names, filenames in os.walk(__UpperCAmelCase ): lowerCamelCase_ = [d for d in dir...
352
from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .attention...
208
0
"""simple docstring""" import math def lowerCAmelCase__ ( UpperCamelCase__ ): '''simple docstring''' return math.sqrt(__A ) * math.sqrt(__A ) == num def lowerCAmelCase__ ( UpperCamelCase__ ): '''simple docstring''' _a : Tuple ...
294
import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from tax import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffusers.pipelines.spectrogram_diffusion...
65
0
def lowerCamelCase_ ( UpperCamelCase__ : float , UpperCamelCase__ : float , UpperCamelCase__ : int ) -> str: """simple docstring""" if principal <= 0: raise Exception('Principal borrowed must be > 0' ) if rate_per_annum < 0: ...
366
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import IMAGENET_DEF...
348
0
'''simple docstring''' import argparse import math import os import torch from neural_compressor.utils.pytorch import load from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, StableDiffusionPipeline, UNetaDConditionModel def SCREAMING_SNA...
42
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
8
0
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class UpperCAmelCase__ : """simple docstring""" UpperCAmelCase__ : Tuple = None def _a ( self ) -> Tuple: __UpperCamelCase ...
352
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor _A = logging.get_logger(__name__) class UpperCAmelCase__ ( A_ ): """simple docstring""" def __init__( self , *A_ , **A_ ) -> None: warnings.warn...
117
0
import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def UpperCamelCase ( snake_case__ : Tuple ) -> List[Any]: UpperCamelCase ...
119
import argparse import os from pathlib import Path import fairseq import torch from packaging import version from torch import nn from transformers import ( BartConfig, BartForConditionalGeneration, BartForSequenceClassification, BartModel, BartTokenizer, ) from transformers.utils import loggi...
119
1
"""simple docstring""" import os import zipfile import pytest from datasets.utils.extract import ( BzipaExtractor, Extractor, GzipExtractor, LzaExtractor, SevenZipExtractor, TarExtractor, XzExtractor, ZipExtractor, ZstdExtractor, ) from .utils import requ...
313
"""simple docstring""" from collections.abc import Sequence def _SCREAMING_SNAKE_CASE (__lowerCAmelCase , __lowerCAmelCase = False ) -> float: '''simple docstring''' if not arr: return 0 lowercase_ = 0 if allow_empty_subarrays else float("""-inf"""...
313
1
'''simple docstring''' import io import itertools import json from dataclasses import dataclass from typing import Optional import pyarrow as pa import pyarrow.json as paj import datasets from datasets.table import table_cast from datasets.utils.file_utils import readline SCREAMING_SNAKE_CASE_: Any =datas...
1
'''simple docstring''' def UpperCAmelCase_ ( __lowerCamelCase : int ,__lowerCamelCase : int ): return int((input_a, input_a).count(0 ) == 0 ) def UpperCAmelCase_ ( ): assert and_gate(0 ,0 ) == 0 assert and_gate(0 ,1 ) == 0 assert and_gate(1 ,0 ...
223
0
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import BatchEncoding, PreTrainedTokenizer from ...utils import logging A_ : Union[str, Any] = logging.get_logger...
357
"""simple docstring""" def lowerCamelCase_ ( ): lowerCamelCase__ : Optional[Any] = [] lowerCamelCase__ : List[Any] = 1 while len(_lowerCamelCase ) < 1e6: constant.append(str(_lowerCamelCase ) ) i += 1 lowerCamelCase__ : str = ...
316
0
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def _snake_case( SCREAMING_SNAKE_CASE__ : List[str] , SCREAMING_SNAKE_CASE__ : Optional[int] , SCREAMING_SNAKE_CASE__ : Union[str, Any] , SCREAMING_SNAKE_CASE__ ...
7
import string import numpy def lowerCAmelCase__ ( _SCREAMING_SNAKE_CASE : int , _SCREAMING_SNAKE_CASE : int ): """simple docstring""" return b if a == 0 else greatest_common_divisor(b % a , _SCREAMING_SNAKE_CASE ) class SCREAMING_SNAKE_CASE : __lowerCame...
302
0
from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionPipel...
113
import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller a =3 def SCREAMING_SNAKE_CASE__ ( lowerCamelCase__ ) -> int: print('Generating primitive root of p' ) while True: __lowerCamelCase : Tuple = rando...
113
1
'''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, convert_to_rgb, get_resize_output_image_size, normalize, rescale, ...
42
import os from datetime import datetime as dt from github import Github snake_case__ : Union[str, Any] = [ 'good first issue', 'feature request', 'wip', ] def _a ( ) -> List[Any]: '''simple docstring''' ...
117
0
"""simple docstring""" from ..utils import DummyObject, requires_backends class UpperCamelCase__ ( metaclass=lowercase_ ): """simple docstring""" _SCREAMING_SNAKE_CASE = ["""transformers""", """torch""", """note_seq"""] ...
365
"""simple docstring""" import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home lowercase__ : int = HUGGINGFACE_HUB_CACHE lowercase__ : Tuple = """config.json""" lowercase__ : Union[str, Any] = """diffusion_pytorc...
289
0
'''simple docstring''' # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config # - g...
134
import random def A ( _SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE ) -> tuple: lowerCamelCase , lowerCamelCase , lowerCamelCase : Any = [], [], [] for element in data: if element < pivot: less.append(_SCREAMING_S...
48
0
import json import os import pickle import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers import is_faiss_available from transformers.models.bart.configuration_bart import BartConfig from transformers.models.bart...
141
import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class _a (__magic_name__ ): '''simple docstring''' UpperCAmelCase__: Optional[Any] = '''MCTCTFeatureExtractor''' UpperCAmelCase__: Optional[int] = '''...
141
1
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __A : Tuple = '''http://www.mocksite.com/file1.txt''' ...
138
import math def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> float: '''simple docstring''' return math.pow(_UpperCAmelCase, 2 ) - a def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> float: '''simple docstring''' retu...
138
1
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def __snake_case ( ): """simple docstring""" print("Making key files..." ) make_key_files("rsa" ,1024 ) ...
354
import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BertTokenizer...
329
0
import argparse import os import torch from transformers.utils import WEIGHTS_NAME __lowerCamelCase : Optional[Any] = ['''small''', '''medium''', '''large'''] __lowerCamelCase : Tuple = '''lm_head.decoder.weight''' __lowerCamelCase : Union[str, Any] = '''lm_head.weigh...
219
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
219
1
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary # Register SEW's fairseq modules from sew_asapp import tasks # noqa: F401 from transformers import ( SEWConfig, SEWForCTC, SEWModel, WavaVecaCTCTokenizer, WavaVecaF...
358
"""simple docstring""" _a = [ 'DownloadConfig', 'DownloadManager', 'DownloadMode', 'StreamingDownloadManager', ] from .download_config import DownloadConfig from .download_manager import DownloadManager, DownloadMode from .streaming_download_manager import StreamingDownloadManager ...
144
0
'''simple docstring''' import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging _lowercase : str = ...
239
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentP...
239
1
"""simple docstring""" import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_t...
355
"""simple docstring""" import math def _lowerCAmelCase ( lowercase_ ): assert isinstance(lowercase_ , lowercase_ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes ...
181
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __snake_case : str =logging.get_logger(__name__) __snake_case : int ={ 'SenseTime/deformable-detr': 'https://huggingface.co/sensetime/deformable-detr/resol...
129
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class lowerCamelCase__ ( lowerCamelCase__): '''simp...
129
1
import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling...
26
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remot...
26
1
"""simple docstring""" from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class A__ ( lowerCamelCase_ ): '''s...
269
import warnings from ..trainer import Trainer from ..utils import logging __lowerCamelCase : List[Any] = logging.get_logger(__name__) class __snake_case ( lowerCamelCase_ ): def __init__( self : Tuple , _lowercase : Optional[int]=None , *...
219
0
"""simple docstring""" import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device SCREAMING_SNAKE_CASE = False class UpperCAmelCase_ ( ...
365
"""simple docstring""" import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() SCREAMING_SNAKE_CASE = logging.get_logger(__name__) SCREAMING_SNAKE_CASE = {name: getattr(transformers, name + "Fa...
230
0
"""simple docstring""" import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class _lowerCAmelCase ( unittest.TestCase ,lowercase ): """simple docstring""" def _lowercase ( self : List[Any] ): __lowercase = ...
17
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin if is_spe...
75
0
from math import pi def __UpperCamelCase ( _lowerCAmelCase , _lowerCAmelCase ) -> str: """simple docstring""" return 2 * pi * radius * (angle / 360) if __name__ == "__main__": print(arc_length(90, 10))
350
import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from_submodules, ) from accelerate.test_utils import require_...
115
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCAmelCase__ : Union[str, Any] = { 'configuration_swiftformer': [ 'SWIFTFORMER_PRETRAINED_CONFIG_ARCHIV...
25
"""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 from torch.utils.data im...
261
0
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_available, ...
363
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def snake_case__ ( SCREAMING_SNAKE_CASE_ : BertModel , SCREAMING_SNAKE_CASE_ : str , SCREAMING_SNAKE_CASE_ : str ): '''simple docstring''' ...
216
0
def lowerCamelCase__ ( a ) -> int: if not isinstance(a , a ): raise TypeError('''Input value must be an \'int\' type''' ) _A: Any = 0 while number: position += 1 number >>= 1 return position if __name__ == "__main__": import doctest ...
121
from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils im...
121
1
import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing_utils ...
369
import inspect import unittest from transformers import ViTMSNConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester...
191
0
from math import pow def A ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , ): '''simple docstring''' if current_sum == needed_sum: # If the sum of the powers is equal to needed_sum, then we have a soluti...
36
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase = 0 ) -> list: lowerCAmelCase__ : Optional[Any] = length or len(__UpperCAmelCase ) lowerCAmelCase__ : int = False for i in range(length - 1 ): ...
242
0
import logging import os import threading import time try: import warnings except ImportError: lowerCamelCase : Optional[int] =None try: import msvcrt except ImportError: lowerCamelCase : Optional[Any] =None try: import fcntl except ImportError: lowerCamelCase ...
359
from __future__ import annotations def SCREAMING_SNAKE_CASE ( __lowerCAmelCase , __lowerCAmelCase ) -> bool: if len(__lowerCAmelCase ) == 0: return False UpperCamelCase__ : Any = len(__lowerCAmelCase ) // 2 if a_lis...
196
0
from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time UpperCAmelCase__ = Lock() def _a ( a :Optional[int] , a :List[Any] , a :List[str] , a :Union[str, Any] , a :Tuple , a :Unio...
0
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex from .utils import requi...
0
1
"""simple docstring""" import argparse import os import re __SCREAMING_SNAKE_CASE : Union[str, Any] = '''src/transformers''' # Pattern that looks at the indentation in a line. __SCREAMING_SNAKE_CASE : List[Any] = re.compile(R'''^(\s*)\S''') # Pattern that matches `"key":" and pu...
73
"""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 __SCREAMING_SNAKE_CASE : Tuple = logging.get_logger(__name__) __SC...
73
1
"""simple docstring""" # limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401 from .ut...
54
"""simple docstring""" def lowercase ( __snake_case : int = 1_0_0_0 ): lowercase_ , lowercase_ : str = 1, 1 lowercase_ : List[str] = 2 while True: lowercase_ : Tuple = 0 lowercase_ : List[Any] = ...
33
0
from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_torch_available(): import torch from...
90
import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration lowercase__ =50000 lowercase__ =5000 lowercase__ , lowercase__ =os.path.split(__file__) lowercase__ =os.path.join(RESULTS_BASEPATH, 'results', RESULTS_FILENA...
90
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a = logging.get_logger(__name__) a = { 'transfo-xl-wt103': 'https://huggingface.co/transfo-xl-wt103/resolve/main/config.json', } class SCREAMING_SNAKE_C...
155
'''simple docstring''' def __lowerCAmelCase ( UpperCamelCase__ ) -> Optional[Any]: __lowerCamelCase = [] __lowerCamelCase = set({'''(''', '''[''', '''{'''} ) __lowerCamelCase = set({''')''', ''']''', '''}'''} ) __lowerCamelCase = {'''{''': '''}''', '''[''': ''']''', '''('''...
67
0
def snake_case__ ( SCREAMING_SNAKE_CASE_ : List[Any] , SCREAMING_SNAKE_CASE_ : Tuple , SCREAMING_SNAKE_CASE_ : Union[str, Any] , SCREAMING_SNAKE_CASE_ : int ): '''simple docstring''' global f # a global dp table for knapsack if f[i][j] < 0: ...
216
from __future__ import annotations class SCREAMING_SNAKE_CASE__ : def __init__( self , a , a): lowercase__ , lowercase__ : Dict = text, pattern lowercase__ , lowercase__ : Any = len(a), len(a) def snake_case_ ( ...
216
1
"""simple docstring""" import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def lowerCamelCase ( _UpperCamelCase : Union[str, Any] , _UpperCamelCase : List[str] , **_UpperCamelCase : Dict ) -> int: '''simple...
115
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_to...
314
0
import csv from collections import defaultdict from dataclasses import dataclass, field from typing import List, Optional import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import ScalarFormatter from transformers import HfArgumentParser def UpperCAmelCase__ (UpperCam...
361
from __future__ import annotations import time _SCREAMING_SNAKE_CASE : List[Any] = list[tuple[int, int]] _SCREAMING_SNAKE_CASE : Any = [ [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], ...
213
0
from .glue import GlueDataset, GlueDataTrainingArguments from .language_modeling import ( LineByLineTextDataset, LineByLineWithRefDataset, LineByLineWithSOPTextDataset, TextDataset, TextDatasetForNextSentencePrediction, ) from .squad import SquadDataset, SquadDataTrainingArguments
12
"""simple docstring""" from __future__ import annotations from functools import lru_cache from math import ceil lowerCAmelCase__ = 100 lowerCAmelCase__ = set(range(3, NUM_PRIMES, 2)) primes.add(2) lowerCAmelCase__ = 42 for prime in range(3, ceil(NUM_PRIMES**0.5), 2): ...
108
0
'''simple docstring''' import argparse import collections import os import re 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/check_table.py __lowerCAmelCase = """src...
369
'''simple docstring''' import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class UpperCAmelCase__ ( lowercase__ ...
5
0
"""simple docstring""" from __future__ import annotations def lowercase ( A_ = 4 )-> list[list[int]]: '''simple docstring''' a : Any = abs(SCREAMING_SNAKE_CASE__ ) or 4 return [[1 + x + y * row_size for x in range(SCREAMING_...
40
def lowercase ( SCREAMING_SNAKE_CASE__ : str ) -> list: _snake_case : Optional[Any] = [0] * len(SCREAMING_SNAKE_CASE__ ) for i in range(1 , len(SCREAMING_SNAKE_CASE__ ) ): # use last results for better performance - dynamic programming _snake_case : Optiona...
317
0
"""simple docstring""" def __SCREAMING_SNAKE_CASE ( __UpperCAmelCase , __UpperCAmelCase ): print("""\nThe shortest path matrix using Floyd Warshall algorithm\n""" ) for i in range(__UpperCAmelCase ): for j in range(__UpperCAmelCase ): if dist[i][j] != float(""...
336
"""simple docstring""" import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationSt...
336
1
import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformers.utils import ...
65
from dataclasses import dataclass from typing import Optional import numpy as np import torch import torch.nn as nn from ..utils import BaseOutput, is_torch_version, randn_tensor from .attention_processor import SpatialNorm from .unet_ad_blocks import UNetMidBlockaD, get_down_block, get_up_block @...
65
1
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=lowerCamelCase__ ) class __UpperCAmelCase ( lowerCamelCase__ ): # `task` is not a ClassVar since we want it to be part of the `asdi...
99
import inspect import unittest from transformers import BitConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterMixin from ...test_conf...
99
1
'''simple docstring''' def _A ( A__ = 100 ): """simple docstring""" __lowercase = n * (n + 1) * (2 * n + 1) / 6 __lowercase = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__main__": print(f'{solution() = }')
104
import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def _snake_case ( lowerCAmelCase : str , lowerCAmelCase : Union[str, ...
18
0
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roberta import RobertaTokenizer ...
364
from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def lowerCamelCase_ ( lowerCAmelCase: str , lowerCAmelCase: complex , lowerCAmelCase: str = "x" , lowerCAmelCase: float = 10**-10 , lowerCAmelCase: int = 1 , )...
260
0
'''simple docstring''' from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddings ...
185
'''simple docstring''' import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger A__ : List[str] = get_logger(__name__) A__ : str = R""" Args: input_ids (`jnp.ndarray` ...
185
1
"""simple docstring""" import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_a...
239
"""simple docstring""" import math import random def __lowerCamelCase ( a_ : float , a_ : bool = False ) -> float: if deriv: return value * (1 - value) return 1 / (1 + math.exp(-value )) # Initial Value lowerCam...
239
1
from ..utils import DummyObject, requires_backends class lowerCamelCase_ ( metaclass=_SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = ["flax"] def __init__( self : Tuple , *_lowerCAmelCase : str , **_lowerCAmelCase : Tuple ...
225
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor lowerCamelCase__ : List[str] = logging.get_logger(__name__) class lowerCamelCase_ ( _SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__( sel...
225
1
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast from ...utils import logging if TYPE_CHECKING: from ...feature_extracti...
227
'''simple docstring''' from dataclasses import dataclass, field from typing import Optional @dataclass class __lowerCamelCase : """simple docstring""" a = field( default="codeparrot/codeparrot" , metadata={"help": "Model name or path of model to be trained."} ) a ...
227
1
"""simple docstring""" def snake_case ( A__ ): return "".join([hex(A__ )[2:].zfill(2 ).upper() for byte in list(A__ )] ) def snake_case ( A__ ): # Check data validity, following RFC3548 # https://www.ietf.org/rfc/rfc3548.txt if (len(A__ ) % 2)...
268
"""simple docstring""" import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( '''The `inpainting.py` script is outdated. Please use directly `from diffusers import''' ''' StableDiffusionInpaintPipeline` instead.''' )
268
1
"""simple docstring""" from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _UpperCAmelCase ( __snake_case ): '''simple docstring''' lowerCamelCase__ ='ClapFeatureExtractor' lowerCamelCase__ =('RobertaTokenizer'...
369
"""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_avail...
24
0
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from ..image_utils import load_image if is_torch_available(): impor...
8
import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from...
348
0
"""simple docstring""" from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar _UpperCamelCase: Optional[int] = TypeVar('T') class a__ ( Generic[T] ): _lowerCamelCase = 42 # Cache sto...
53
"""simple docstring""" from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if ...
53
1
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( DiffusionPipeline, UnCLIPImage...
214
import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_MODEL_FOR_SEQUENCE_CLASSIFIC...
214
1
'''simple docstring''' import logging import os from .state import PartialState class lowerCamelCase ( logging.LoggerAdapter ): '''simple docstring''' @staticmethod def lowercase__ ( lowerCAmelCase_ : List[Any] ) -> Optional[Any]: '''simple docstring...
136
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from...
136
1
"""simple docstring""" def __lowerCAmelCase ( lowercase : List[str] ) -> list: """simple docstring""" if len(__A ) <= 1: return [tuple(__A )] snake_case : Tuple = [] def generate(lowercase : str , lowercase : Any ): sn...
203
from manim import * class A ( UpperCAmelCase_ ): def lowercase_ (self : Union[str, Any] ) -> List[str]: """simple docstring""" UpperCAmelCase__ = Rectangle(height=0.5 , width=0.5 ) UpperCAmelCase__ ...
65
0
def lowerCamelCase__ ( _lowercase ): '''simple docstring''' assert isinstance(_lowercase , _lowercase ), f'''The input value of [n={number}] is not an integer''' if number == 1: return 2 elif number < 1: UpperCAmelCase_ : List[Any] ...
356
import argparse from collections import OrderedDict from pathlib import Path import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision.transforms import functional as F from transformers import DetrImageProcessor, TableTransformerConfig, TableTransformerForObjectDetection fr...
235
0
'''simple docstring''' import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger UpperCamelCase__ = '''<<<<<<< This should probably be modified because it mentions: '...
181
'''simple docstring''' import json import os import shutil import tempfile import unittest from multiprocessing import get_context from pathlib import Path import datasets import numpy as np from datasets import load_dataset from parameterized import parameterized from transformers import AutoProc...
181
1
'''simple docstring''' import pytest from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs @pytest.mark.parametrize( """kwargs, expected""" , [ ({"""num_shards""": 0, """max_num_jobs""": 1}, []), ({"""nu...
183
'''simple docstring''' import importlib.util import json import os import warnings from dataclasses import dataclass, field import torch from ..training_args import TrainingArguments from ..utils import cached_property, is_sagemaker_dp_enabled, logging SCREAMING_SNAKE_CASE__ = ...
183
1
# Lint as: python3 import dataclasses import re from dataclasses import dataclass from functools import total_ordering from typing import Optional, Union UpperCamelCase__ = re.compile(R"""^(?P<major>\d+)""" R"""\.(?P<minor>\d+)""" R"""\.(?P<patch>\d+)$""") @total_ordering @dataclass class a__ : ...
92
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import load_numpy, skip_mps, slo...
240
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __magic_name__: int = {"configuration_focalnet": ["FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "FocalNetConfig"]} try: if not is_torch_avail...
362
from manim import * class snake_case__ ( _lowerCAmelCase ): def __magic_name__ ( self ) -> Dict: __magic_name__ : int = Rectangle(height=0.5 , width=0.5 ) __magic_name__ : Optional[int] = Rectangle(hei...
138
0
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowercase( __a ): '''simple docstring''' lowercase__ = ["image_processor", "tokenizer"] lowerca...
64
"""simple docstring""" import re import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class lowercase( __a ): '''simple docstring''' lowercase__ = ["image_processor", "tokenizer"] lowercase__...
64
1
import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import evaluate import numpy as np from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForSequenceClassification, A...
369
from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ ...
279
0