code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import load_numpy, sl...
40
'''simple docstring''' import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to...
41
0
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_...
42
'''simple docstring''' import doctest from collections import deque import numpy as np class lowercase_ : """simple docstring""" def __init__( self : Optional[Any] ): __lowercase = [2, 1, 2, -1] __lowercase = [1, 2, 3, 4] def SCREAMING_SNA...
41
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_ca...
43
'''simple docstring''' from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class lowercase_ (lowerCamelCase__ ): ...
41
0
'''simple docstring''' import fire from utils import calculate_rouge, save_json def A_ ( _lowerCAmelCase : List[str] , _lowerCAmelCase : int , _lowerCAmelCase : Dict=None , **_lowerCAmelCase : Any ): """simple docstring""" _low...
44
'''simple docstring''' import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu,...
41
0
import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin Uppe...
45
'''simple docstring''' from __future__ import annotations def _A ( A__ , A__ ): """simple docstring""" print(F"Vertex\tShortest Distance from vertex {src}" ) for i, d in enumerate(A__ ): print(F"{i}\t\t{d}" ) def _A ( A__ , A__ , A__ ): """simpl...
41
0
"""simple docstring""" def lowerCamelCase_( _lowerCamelCase , _lowerCamelCase = False ) -> str: '''simple docstring''' if not isinstance(_lowerCamelCase , _lowerCamelCase ): _lowerCamelCase : str = F"""Expected string as input, found {type(_lower...
46
'''simple docstring''' import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class lowercase_ (lowerCamelCase__ ): """simple docstring""" def __init__( self : List[Any] ,*low...
41
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def UpperCAmelCase__ ( lowerCamelCase_ ...
47
'''simple docstring''' import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def _A ( A__ ): """simple docstring""" __lowercase = FileLock(str(tmpdir / '''foo.lock''' ) ) __lowercase = FileLock(str(tmpdir / '''foo.lock''' ) ) ...
41
0
'''simple docstring''' def A ( UpperCamelCase_ : bytes ) -> str: '''simple docstring''' return "".join([hex(UpperCamelCase_ )[2:].zfill(2 ).upper() for byte in list(UpperCamelCase_ )] ) def A ( UpperCamelCase_ : str ) -> bytes: ...
48
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase__ = { '''configuration_gpt_bigcode''': ['''GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTBigCodeConfig'''], } try: ...
41
0
"""simple docstring""" import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import ...
49
'''simple docstring''' import argparse import os import re lowerCAmelCase__ = '''src/diffusers''' # Pattern that looks at the indentation in a line. lowerCAmelCase__ = re.compile(R'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAmelCase__ = re.compi...
41
0
'''simple docstring''' import itertools import json import os import unittest from transformers import AddedToken, RobertaTokenizer, RobertaTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from .....
50
'''simple docstring''' import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.util...
41
0
'''simple docstring''' import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNetaDConditionM...
51
'''simple docstring''' import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def _A ( A__ ): """simple docstring""" __lowercase = [ '''encoder.version''', '''decoder.version''', '''model.encoder....
41
0
"""simple docstring""" from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import...
52
'''simple docstring''' import os from math import logaa def _A ( A__ = "base_exp.txt" ): """simple docstring""" __lowercase = 0 __lowercase = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(A__ ) , A__ ) ) ): __lowercase , __lowercase...
41
0
def a_ ( lowerCAmelCase_ : list, lowerCAmelCase_ : int = 0 ): __lowerCAmelCase = length or len(lowerCAmelCase_ ) __lowerCAmelCase = False for i in range(length - 1 ): if list_data[i] > list_data[i + 1]: __lowerCAmelCase ...
53
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqCo...
41
0
import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizer...
54
'''simple docstring''' from __future__ import annotations def _A ( A__ , A__ ): """simple docstring""" if b == 0: return (1, 0) ((__lowercase) , (__lowercase)) = extended_euclid(A__ , a % b ) __lowercase = a // b return (y, x - k * y) def...
41
0
import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test_modeling_comm...
55
'''simple docstring''' from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def _A ( ): """simple docstring""" import os as original_os from os import path as original_path from os import rename as original_rename from os.path import di...
41
0
'''simple docstring''' def _a (lowercase__ : str ) -> list: """simple docstring""" return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(lowercase__ ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__("do...
56
'''simple docstring''' import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationT...
41
0
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.numpy...
57
'''simple docstring''' from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar lowerCAmelCase__ = TypeVar('''KEY''') lowerCAmelCase__ = TypeVar('''VAL''') @dataclass(frozen=lowerCamelCase__ , slots=lowerCamelCase...
41
0
"""simple docstring""" __lowerCAmelCase : dict[tuple[int, int, int], int] = {} def __lowerCAmelCase ( __UpperCamelCase : int , __UpperCamelCase : int , __UpperCamelCase : int ): '''simple docstring''' ...
58
'''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 load_im...
41
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available __A = { "configuration_gpt_neo": ["GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP", "GPTNeoConfig", "GPTNeoOnnxConfig"], } try: if not is_torch_available(): ...
59
'''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-...
41
0
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils im...
60
'''simple docstring''' from collections.abc import Callable class lowercase_ : """simple docstring""" def __init__( self : Optional[int] ,lowercase__ : Callable | None = None ): # Stores actual heap items. __lowercase = [] # Stores indexes of each item for...
41
0
import inspect import unittest from transformers import RegNetConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_common import ConfigTes...
61
'''simple docstring''' import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from trans...
41
0
import argparse import os import re import packaging.version snake_case = """examples/""" snake_case = { """examples""": (re.compile(r"""^check_min_version\(\"[^\"]+\"\)\s*$""", re.MULTILINE), """check_min_version(\"VERSION\")\n"""), """init""": (re.compile(r"""^__version__\s+=\s+\...
62
'''simple docstring''' from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax impor...
41
0
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class a : """simple docstring""" a : int a : int class a : """s...
63
'''simple docstring''' import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to...
41
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer import RoFormerTokenizer from .tokenizati...
64
'''simple docstring''' import doctest from collections import deque import numpy as np class lowercase_ : """simple docstring""" def __init__( self : Optional[Any] ): __lowercase = [2, 1, 2, -1] __lowercase = [1, 2, 3, 4] def SCREAMING_SNA...
41
0
"""simple docstring""" import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Value from .base import TaskTemplate @dataclass(frozen=__lowerCamelCase ) class __lowercase ( __lowerCamelCase ...
65
'''simple docstring''' from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class lowercase_ (lowerCamelCase__ ): ...
41
0
import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def __magic_name__ ( SCREAMING_SNAKE_CASE ) -> int: _lowercase : int = args.pruning_method _lowercase : Optional[in...
66
'''simple docstring''' import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu,...
41
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, StableDiffus...
67
'''simple docstring''' from __future__ import annotations def _A ( A__ , A__ ): """simple docstring""" print(F"Vertex\tShortest Distance from vertex {src}" ) for i, d in enumerate(A__ ): print(F"{i}\t\t{d}" ) def _A ( A__ , A__ , A__ ): """simpl...
41
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer __A = logging.get_logger(__name__) __A = {"vocab_file": "vocab....
68
'''simple docstring''' import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class lowercase_ (lowerCamelCase__ ): """simple docstring""" def __init__( self : List[Any] ,*low...
41
0
'''simple docstring''' 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 ...
69
'''simple docstring''' import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def _A ( A__ ): """simple docstring""" __lowercase = FileLock(str(tmpdir / '''foo.lock''' ) ) __lowercase = FileLock(str(tmpdir / '''foo.lock''' ) ) ...
41
0
from ... import PretrainedConfig lowerCamelCase : Any = { "sijunhe/nezha-cn-base": "https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json", } class A( UpperCamelCase ): '''simple docstring''' UpperCamelCase = NEZHA_PRETRA...
70
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase__ = { '''configuration_gpt_bigcode''': ['''GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTBigCodeConfig'''], } try: ...
41
0
'''simple docstring''' import os import re import shutil import sys import tempfile import unittest import black _lowerCamelCase = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import check_copie...
71
'''simple docstring''' import argparse import os import re lowerCAmelCase__ = '''src/diffusers''' # Pattern that looks at the indentation in a line. lowerCAmelCase__ = re.compile(R'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAmelCase__ = re.compi...
41
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _UpperCAmelCase : int = { '''configuration_blip''': [ '''BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''',...
72
'''simple docstring''' import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.util...
41
0
import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate import Accelerator from accelerat...
73
'''simple docstring''' import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def _A ( A__ ): """simple docstring""" __lowercase = [ '''encoder.version''', '''decoder.version''', '''model.encoder....
41
0
import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from pathlib import Path from urllib.pa...
74
'''simple docstring''' import os from math import logaa def _A ( A__ = "base_exp.txt" ): """simple docstring""" __lowercase = 0 __lowercase = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(A__ ) , A__ ) ) ): __lowercase , __lowercase...
41
0
'''simple docstring''' from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ ) -> np.ndarray: UpperCAmelCase__ ...
75
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqCo...
41
0
"""simple docstring""" import numpy as np def __UpperCAmelCase ( __UpperCamelCase , __UpperCamelCase ): return np.where(vector > 0 , __UpperCamelCase , (alpha * (np.exp(__UpperCamelCase ) - 1)) ) if __name__ == "__main__": import doctest doctest.tes...
76
'''simple docstring''' from __future__ import annotations def _A ( A__ , A__ ): """simple docstring""" if b == 0: return (1, 0) ((__lowercase) , (__lowercase)) = extended_euclid(A__ , a % b ) __lowercase = a // b return (y, x - k * y) def...
41
0
"""simple docstring""" def _UpperCamelCase ( UpperCamelCase ) -> bool: """simple docstring""" if not isinstance(UpperCamelCase , UpperCamelCase ): raise ValueError("check_bouncy() accepts only integer arguments" ) __UpperCAmelCase : Optional...
77
'''simple docstring''' from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def _A ( ): """simple docstring""" import os as original_os from os import path as original_path from os import rename as original_rename from os.path import di...
41
0
'''simple docstring''' import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, require...
78
'''simple docstring''' import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationT...
41
0
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...
79
'''simple docstring''' from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar lowerCAmelCase__ = TypeVar('''KEY''') lowerCAmelCase__ = TypeVar('''VAL''') @dataclass(frozen=lowerCamelCase__ , slots=lowerCamelCase...
41
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.uti...
80
'''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 load_im...
41
0
import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( TEXT_GUIDED_IMAGE_INPA...
81
'''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-...
41
0
"""simple docstring""" def a__ ( lowerCAmelCase__ , lowerCAmelCase__ ): UpperCAmelCase_ = "" for word_or_phrase in separated: if not isinstance(lowerCAmelCase__ , lowerCAmelCase__ ): raise Exception("join() accepts onl...
82
'''simple docstring''' from collections.abc import Callable class lowercase_ : """simple docstring""" def __init__( self : Optional[int] ,lowercase__ : Callable | None = None ): # Stores actual heap items. __lowercase = [] # Stores indexes of each item for...
41
0
"""simple docstring""" from __future__ import annotations lowerCAmelCase__ = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] lowerCAmelCase__ = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def snake_case_ ( A_ : list[float] )...
83
'''simple docstring''' import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from trans...
41
0
import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class A_ ( unittest.TestCase ): '''simple docstring''' def SCREAMING_SNAKE_CASE__ ( self ): lowercase = ...
84
'''simple docstring''' from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax impor...
41
0
import argparse import torch from transformers import OpenAIGPTConfig, OpenAIGPTModel, load_tf_weights_in_openai_gpt from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def _a ( lowercase__ : Optional[Any] , lowercase__ : Any , lowercase__ : ...
85
'''simple docstring''' import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to...
41
0
import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse('9.1.0'): __a :Optional[Any] = { 'linear': PIL.Image.Resampling.BILINEAR, 'bilinear': PIL.Image.Resam...
86
'''simple docstring''' import doctest from collections import deque import numpy as np class lowercase_ : """simple docstring""" def __init__( self : Optional[Any] ): __lowercase = [2, 1, 2, -1] __lowercase = [1, 2, 3, 4] def SCREAMING_SNA...
41
0
import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() _lowerCamelCase : Optional[Any] = logging.get_logger(__name__) def SCREAMING_SNAKE_CASE ( lowercase_ ) -> Op...
87
'''simple docstring''' from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class lowercase_ (lowerCamelCase__ ): ...
41
0
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class lowercase__ ( A_ ): def __init__( ...
88
'''simple docstring''' import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu,...
41
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) def ...
89
'''simple docstring''' from __future__ import annotations def _A ( A__ , A__ ): """simple docstring""" print(F"Vertex\tShortest Distance from vertex {src}" ) for i, d in enumerate(A__ ): print(F"{i}\t\t{d}" ) def _A ( A__ , A__ , A__ ): """simpl...
41
0
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTConfig, MobileViTForImageClassification, MobileViTForSemanticSegment...
90
'''simple docstring''' import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class lowercase_ (lowerCamelCase__ ): """simple docstring""" def __init__( self : List[Any] ,*low...
41
0
"""simple docstring""" def _snake_case ( snake_case__ : int = 1000 ): A = 2**power A = 0 while n: A , A = r + n % 10, n // 10 return r if __name__ == "__main__": print(solution(int(str(input()).strip())))
91
'''simple docstring''' import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def _A ( A__ ): """simple docstring""" __lowercase = FileLock(str(tmpdir / '''foo.lock''' ) ) __lowercase = FileLock(str(tmpdir / '''foo.lock''' ) ) ...
41
0
'''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 UpperCamelCase_ = logging.getLogger() @unittest.skip('Temporaril...
92
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase__ = { '''configuration_gpt_bigcode''': ['''GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTBigCodeConfig'''], } try: ...
41
0
"""simple docstring""" # limitations under the License. from typing import Optional, Tuple, Union import torch from diffusers import DiffusionPipeline, ImagePipelineOutput class _lowerCAmelCase ( a ): """simple docstring""" def __init__( self , __UpperCAmelCa...
93
'''simple docstring''' import argparse import os import re lowerCAmelCase__ = '''src/diffusers''' # Pattern that looks at the indentation in a line. lowerCAmelCase__ = re.compile(R'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAmelCase__ = re.compi...
41
0
'''simple docstring''' def lowercase_ ( __A : int ) -> bool: """simple docstring""" return number & 1 == 0 if __name__ == "__main__": import doctest doctest.testmod()
94
'''simple docstring''' import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.util...
41
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ ...
95
'''simple docstring''' import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def _A ( A__ ): """simple docstring""" __lowercase = [ '''encoder.version''', '''decoder.version''', '''model.encoder....
41
0
"""simple docstring""" import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, Features, Value from .base import TaskTemplate @dataclass(frozen=SCREAMING_SNAKE_CASE_ ) class __A ( SCREAMING_SNAKE_CASE_ ): ...
96
'''simple docstring''' import os from math import logaa def _A ( A__ = "base_exp.txt" ): """simple docstring""" __lowercase = 0 __lowercase = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(A__ ) , A__ ) ) ): __lowercase , __lowercase...
41
0
import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from transformers.models.switch_transformers.conve...
97
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqCo...
41
0
'''simple docstring''' import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=__magic_name__ ) class __lowerCAmelCase ( __magic_name__ ): """simpl...
98
'''simple docstring''' from __future__ import annotations def _A ( A__ , A__ ): """simple docstring""" if b == 0: return (1, 0) ((__lowercase) , (__lowercase)) = extended_euclid(A__ , a % b ) __lowercase = a // b return (y, x - k * y) def...
41
0
from typing import TYPE_CHECKING from ...utils import _LazyModule SCREAMING_SNAKE_CASE = {'tokenization_byt5': ['ByT5Tokenizer']} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys SCREAMING_SNAKE_CASE = _LazyModule(__name__, gl...
99
'''simple docstring''' from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def _A ( ): """simple docstring""" import os as original_os from os import path as original_path from os import rename as original_rename from os.path import di...
41
0
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, ) _A : Any = {"""configuration_xglm""": ["""XGLM_PRETRAINED_C...
100
'''simple docstring''' import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationT...
41
0
from __future__ import annotations def a__ ( A__, A__, A__, A__ ): SCREAMING_SNAKE_CASE_ : List[Any] = [] SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ : Union[str, Any] = input_list[low:mid], input_list[mid : high + 1] while le...
101
'''simple docstring''' from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar lowerCAmelCase__ = TypeVar('''KEY''') lowerCAmelCase__ = TypeVar('''VAL''') @dataclass(frozen=lowerCamelCase__ , slots=lowerCamelCase...
41
0
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_OBJECT_DETECTION_MAPPING, AutoFeatureExtractor, AutoModelForObjectDetection, ObjectDetectionPipeline, is_vision_available, pipeline, ) from transformers.testing_utils import ( is_pipeline...
102
'''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 load_im...
41
0
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWit...
103
'''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-...
41
0
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : int, UpperCAmelCase_ : int ) -> int: """simple docstring""" return int(input_a == input_a == 0 ) def _lowerCamelCase ( ) -> None: """simple d...
104
'''simple docstring''' from collections.abc import Callable class lowercase_ : """simple docstring""" def __init__( self : Optional[int] ,lowercase__ : Callable | None = None ): # Stores actual heap items. __lowercase = [] # Stores indexes of each item for...
41
0
import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def __UpperCAmelCase ( lowerCamelCa...
105
'''simple docstring''' import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from trans...
41
0
from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def lowerCamelCase_ ( lowerCAmelCase__ : NDArray[floataa] , lowerCAmelCase__ : NDArray[floataa] , lowerCAmelCase__ : list[int] , lowerCAmelCase__ : int , ) -> list[float]...
106
'''simple docstring''' from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax impor...
41
0
'''simple docstring''' from __future__ import annotations from scipy.special import comb # type: ignore class lowercase_ : """simple docstring""" def __init__( self : Tuple, UpperCamelCase__ : list[tuple[float, float]] ) -> Any: _A = list_of_poi...
107
'''simple docstring''' import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to...
41
0
from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar __a: Any = TypeVar('''T''') class SCREAMING_SNAKE_CASE__ ( Generic[T] ): '''simple docstring''' _lowerCamelCase = 42 # Cache store of keys _lowerCamelCase ...
108
'''simple docstring''' import doctest from collections import deque import numpy as np class lowercase_ : """simple docstring""" def __init__( self : Optional[Any] ): __lowercase = [2, 1, 2, -1] __lowercase = [1, 2, 3, 4] def SCREAMING_SNA...
41
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class __a ( metaclass=_snake_case ): __UpperCamelCase : Optional[Any] = ['onnx'] def __init__( self : List[str] ,*lowerCamelCase : str ,**lowerCamelCase : Dic...
109
'''simple docstring''' from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class lowercase_ (lowerCamelCase__ ): ...
41
0
"""simple docstring""" def lowerCamelCase ( _snake_case ,_snake_case ,_snake_case ,_snake_case ): # 1. Validate that path exists between current and next vertices if graph[path[curr_ind - 1]][next_ver] == 0: return False # 2. Validate that next vertex is not already in path...
110
'''simple docstring''' import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu,...
41
0
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def a_ () -> Union[str, Any]: """simple docstring""" __a : Any = HfArgumentParser(A__ ) __a : Dict = parser.parse_args_into_dataclasses()[0]...
351
'''simple docstring''' from __future__ import annotations def _A ( A__ , A__ ): """simple docstring""" print(F"Vertex\tShortest Distance from vertex {src}" ) for i, d in enumerate(A__ ): print(F"{i}\t\t{d}" ) def _A ( A__ , A__ , A__ ): """simpl...
41
0
"""simple docstring""" import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : List[Any] = logging.get_logger(__name__) A_ : Union[str, Any] = { 'RUCAIBox/mvp': 'https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json', } cl...
265
'''simple docstring''' import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class lowercase_ (lowerCamelCase__ ): """simple docstring""" def __init__( self : List[Any] ,*low...
41
0
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 DDIMSched...
21
'''simple docstring''' import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def _A ( A__ ): """simple docstring""" __lowercase = FileLock(str(tmpdir / '''foo.lock''' ) ) __lowercase = FileLock(str(tmpdir / '''foo.lock''' ) ) ...
41
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase ={ "configuration_vision_encoder_decoder": ["VisionEncoderDecod...
617
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase__ = { '''configuration_gpt_bigcode''': ['''GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTBigCodeConfig'''], } try: ...
41
0
"""simple docstring""" from __future__ import annotations def _lowerCAmelCase ( lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , ): '''simple docstring''' UpperCAmelCase = len(A__ )...
673
'''simple docstring''' import argparse import os import re lowerCAmelCase__ = '''src/diffusers''' # Pattern that looks at the indentation in a line. lowerCAmelCase__ = re.compile(R'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAmelCase__ = re.compi...
41
0
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_token...
519
'''simple docstring''' import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.util...
41
0
"""simple docstring""" import os from distutils.util import strtobool def a_ ( __a , __a ): for e in env_keys: A__ = int(os.environ.get(A__ , -1 ) ) if val >= 0: return val return default de...
571
'''simple docstring''' import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def _A ( A__ ): """simple docstring""" __lowercase = [ '''encoder.version''', '''decoder.version''', '''model.encoder....
41
0
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/check_config_docstring...
234
'''simple docstring''' import os from math import logaa def _A ( A__ = "base_exp.txt" ): """simple docstring""" __lowercase = 0 __lowercase = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(A__ ) , A__ ) ) ): __lowercase , __lowercase...
41
0
'''simple docstring''' def __UpperCamelCase ( UpperCAmelCase , UpperCAmelCase ): if discount_rate < 0: raise ValueError('''Discount rate cannot be negative''' ) if not cash_flows: raise ValueError('''Cash flows list cannot be empty''' ) lowercase__ : str = sum( cash_f...
152
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqCo...
41
0
"""simple docstring""" import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to_p...
586
'''simple docstring''' from __future__ import annotations def _A ( A__ , A__ ): """simple docstring""" if b == 0: return (1, 0) ((__lowercase) , (__lowercase)) = extended_euclid(A__ , a % b ) __lowercase = a // b return (y, x - k * y) def...
41
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase_ = { '''configuration_timesformer''': ['''TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TimesformerConfig'''], } try: if not is_torch...
338
'''simple docstring''' from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def _A ( ): """simple docstring""" import os as original_os from os import path as original_path from os import rename as original_rename from os.path import di...
41
0
from __future__ import annotations def a_ (__A , __A , __A ) -> Tuple: """simple docstring""" __a : List[Any] = list(range(len(A__ ) ) ) __a : int = [v / w for v, w in zip(A__ , A__ )] ...
351
'''simple docstring''' import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationT...
41
0
"""simple docstring""" import os from datetime import datetime as dt from github import Github A_ : Dict = [ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def __snake_case ( ) ...
265
'''simple docstring''' from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar lowerCAmelCase__ = TypeVar('''KEY''') lowerCAmelCase__ = TypeVar('''VAL''') @dataclass(frozen=lowerCamelCase__ , slots=lowerCamelCase...
41
0
import collections import json import os import re from typing import TYPE_CHECKING, List, Optional, Tuple import numpy as np from ...tokenization_utils_fast import PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conv...
21
'''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 load_im...
41
0
"""simple docstring""" import torch from diffusers import StableDiffusionPipeline UpperCAmelCase ="path-to-your-trained-model" UpperCAmelCase =StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.floataa).to("cuda") UpperCAmelCase ="A photo of sks ...
617
'''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-...
41
0
"""simple docstring""" from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common im...
673
'''simple docstring''' from collections.abc import Callable class lowercase_ : """simple docstring""" def __init__( self : Optional[int] ,lowercase__ : Callable | None = None ): # Stores actual heap items. __lowercase = [] # Stores indexes of each item for...
41
0
from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): from ..models....
519
'''simple docstring''' import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from trans...
41
0
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_se...
571
'''simple docstring''' from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax impor...
41
0
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class __magic_name__ ( lowerCamelCase__): '''sim...
234
'''simple docstring''' import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to...
41
0
'''simple docstring''' import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils impor...
152
'''simple docstring''' import doctest from collections import deque import numpy as np class lowercase_ : """simple docstring""" def __init__( self : Optional[Any] ): __lowercase = [2, 1, 2, -1] __lowercase = [1, 2, 3, 4] def SCREAMING_SNA...
41
0
"""simple docstring""" import unittest import numpy as np import torch from diffusers import DDIMPipeline, DDIMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, slow, torch_device from ..pipeline_params import UNCONDITIONAL_IMAGE_GENERATION_BATCH_PARAM...
586
'''simple docstring''' from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class lowercase_ (lowerCamelCase__ ): ...
41
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 lowerCAmelCase_ = '''<<<<<<< This should probably be modified because it mentions: ''' lowerCAme...
338
'''simple docstring''' import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu,...
41
0
def a_ (__A , __A ) -> List[Any]: """simple docstring""" __a : Optional[Any] = [1] for i in range(2 , A__ ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" __a ...
351
'''simple docstring''' from __future__ import annotations def _A ( A__ , A__ ): """simple docstring""" print(F"Vertex\tShortest Distance from vertex {src}" ) for i, d in enumerate(A__ ): print(F"{i}\t\t{d}" ) def _A ( A__ , A__ , A__ ): """simpl...
41
0
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfi...
265
'''simple docstring''' import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class lowercase_ (lowerCamelCase__ ): """simple docstring""" def __init__( self : List[Any] ,*low...
41
0
import math from numpy import inf from scipy.integrate import quad def lowerCAmelCase_ ( lowerCamelCase ): if num <= 0: raise ValueError("""math domain error""" ) return quad(A__ , 0 , A__ , args=(A__) )[0] def lowerCAmelCase_ ( ...
21
'''simple docstring''' import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def _A ( A__ ): """simple docstring""" __lowercase = FileLock(str(tmpdir / '''foo.lock''' ) ) __lowercase = FileLock(str(tmpdir / '''foo.lock''' ) ) ...
41
0
"""simple docstring""" import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import ...
617
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase__ = { '''configuration_gpt_bigcode''': ['''GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTBigCodeConfig'''], } try: ...
41
0
"""simple docstring""" import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import ...
673
'''simple docstring''' import argparse import os import re lowerCAmelCase__ = '''src/diffusers''' # Pattern that looks at the indentation in a line. lowerCAmelCase__ = re.compile(R'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAmelCase__ = re.compi...
41
0
import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class _UpperCamelCase ( lowerCamelCase__,lowerC...
519
'''simple docstring''' import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.util...
41
0
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging __snake_case : Union[st...
571
'''simple docstring''' import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def _A ( A__ ): """simple docstring""" __lowercase = [ '''encoder.version''', '''decoder.version''', '''model.encoder....
41
0
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class __magic_name__ : '''simple docstring''' SCREAMING_SNAKE_CASE__ : int S...
234
'''simple docstring''' import os from math import logaa def _A ( A__ = "base_exp.txt" ): """simple docstring""" __lowercase = 0 __lowercase = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(A__ ) , A__ ) ) ): __lowercase , __lowercase...
41
0