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
from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize('repo_id' , ['canonical_dataset_name', 'org-name/dataset-name'] ) @pytest.mark.parametrize('path' , ['filename.csv', 'filename with blanks.csv'] ) @pytest.mark.parametrize('revision' , [...
40
import inspect import unittest from transformers import MobileViTConfig 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 from ...test...
81
0
'''simple docstring''' from collections.abc import Generator def _A ( ): """simple docstring""" __lowercase , __lowercase = 0, 1 while True: __lowercase , __lowercase = b, a + b yield b def _A ( A__ = 1000 ): """simple docs...
41
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor _snake_case : int = logging.get_logger(__name__) class a (_lowerCAmelCase ): """simple docstring""" def __init__( self : Optional[int] , ...
81
0
'''simple docstring''' import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers...
42
from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_images, to_numpy_array, valid_...
81
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING lowerCAmelCase = logging.get_logger(__name__) class _a ( UpperCamelCase__ ): _lowercase : Dict = '''upernet''...
43
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _snake_case : Any = { "configuration_informer": [ "INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "InformerConfig", ], } ...
81
0
'''simple docstring''' def A_ ( _lowerCAmelCase : List[Any] , _lowerCAmelCase : Any ): """simple docstring""" return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def A_ ( _lowerCAmelCase : Any , _lowerCAmelCase : ...
44
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_utils import FrozenDict f...
81
0
UpperCamelCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" def A ( lowercase__ : bytes ) -> bytes: # Make sure the supplied data is a bytes-like object if not isinstance(lowercase__ , lowercase__ ): UpperCamelCase__ :Dict = f"""a bytes-like obje...
45
class a : """simple docstring""" def __init__( self : Tuple , lowerCamelCase : list ) -> None: __snake_case : str = set_counts __snake_case : Union[str, Any] = max(lowerCamelCase ...
81
0
"""simple docstring""" import unittest from transformers import AutoConfig, AutoTokenizer, BertConfig, TensorType, is_flax_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, slow if is_flax_available(): import jax from transformers.models.auto.modeling_flax_auto im...
46
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_t...
81
0
from __future__ import annotations import random import unittest from transformers import TransfoXLConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, id...
47
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start_docstrings_...
81
0
'''simple docstring''' import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( "files" , [ ["full:README.md", "dataset_infos.json"], ["empty:README.md", "dataset_in...
48
from __future__ import annotations def lowerCAmelCase_ ( __lowerCamelCase ): if not nums: return 0 __snake_case : Any = nums[0] __snake_case : str = 0 for num in nums[1:]: __snake_case , __snake_c...
81
0
"""simple docstring""" # Copyright 2023 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/LI...
49
from __future__ import annotations from typing import Any def lowerCAmelCase_ ( __lowerCamelCase ): create_state_space_tree(__lowerCamelCase , [] , 0 ) def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase )...
81
0
'''simple docstring''' import collections import inspect import unittest from transformers import SwinvaConfig 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_con...
50
import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteSc...
81
0
'''simple docstring''' from __future__ import annotations import csv import requests from bsa import BeautifulSoup def __snake_case ( SCREAMING_SNAKE_CASE_ : str = "" ) -> dict[str, float]: """simple docstring""" UpperCAmelCase = url or '''https://www.imdb.com/chart/t...
51
import gc import unittest import torch from parameterized import parameterized from diffusers import AutoencoderKL from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.tes...
81
0
"""simple docstring""" # using dfs for finding eulerian path traversal def __A ( a_ :int , a_ :Dict , a_ :str , a_ :Optional[int]=None) -> List[str]: __a : Any = (path or []) + [u] for v in graph[u]: if visited_e...
52
import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor _snake_case : Optional[int] = logging.get_logger(__name__) class a (_lowerCAmelCase ): """simple docstring""" def __init__( self : Optional[Any] , ...
81
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _snake_case : List[str] = logging.get_logger(__name__) _snake_case : Optional[int] = { ...
53
import shutil import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_tf_cross_test, require_tf, require_torch, require_torchvision, require_vision, ) from transformers.utils import is_tf_available, is_torch_available, is_vision_available if is_vision...
81
0
from math import pi, sqrt, tan def a__ ( lowercase__ ): '''simple docstring''' if side_length < 0: raise ValueError("surface_area_cube() only accepts non-negative values" ) return 6 * side_length**2 def a__ ( lowercase__ ...
54
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor _snake_case : List[str] = logging.get_logger(__name__) class a (_lowerCAmelCase ): """simple docstring""" def __init__( self : List[str] , *lowe...
81
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 SCRE...
55
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _snake_case : Union[str, Any] = { "configuration_owlvit": ...
81
0
'''simple docstring''' def _a (lowercase__ : str , lowercase__ : str ) -> Dict: """simple docstring""" assert x is not None assert y is not None __snake_case = len(lowercase__ ) __snake_case = len(lowercase__ ) ...
56
from ....configuration_utils import PretrainedConfig from ....utils import logging _snake_case : int = logging.get_logger(__name__) _snake_case : str = { "Visual-Attention-Network/van-base": ( "https://huggingface.co/Visual-Attention-Network/van-base/blob/main/con...
81
0
from abc import ABC, abstractmethod from typing import List, Optional class _lowerCAmelCase( UpperCAmelCase_ ): """simple docstring""" def __init__( self ): # test for the above condition self.test() de...
57
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _snake_case : Union[str, Any] = logging.getLogger(__name__) def lowerCAmelCase_ ( ): __snake_case : int = argparse.ArgumentParser( ...
81
0
"""simple docstring""" from __future__ import annotations import csv import requests from bsa import BeautifulSoup def __lowerCAmelCase ( __UpperCamelCase : str = "" ): '''simple docstring''' snake_case_ : Optional[int] = ur...
58
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, g...
81
0
import random from typing import Any def lowerCAmelCase_ ( __a ) -> list[Any]: """simple docstring""" for _ in range(len(__a ) ): lowerCamelCase__: Tuple =random.randint(0 , len(__a ) - 1 ) lowerCamelCase__: str =random.r...
59
_snake_case : Optional[int] = {"a": ["c", "b"], "b": ["d", "e"], "c": [], "d": [], "e": []} _snake_case : Dict = ["a", "b", "c", "d", "e"] def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase ): __snake_case ...
81
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCAmelCase_ = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass else: lowerCAmelCas...
60
def lowerCAmelCase_ ( ): return [ a * b * (1_0_0_0 - a - b) for a in range(1 , 9_9_9 ) for b in range(__lowerCamelCase , 9_9_9 ) if (a * a + b * b == (1_0_0_0 - a - b) ** 2) ][0] if __name__ == "__main__": print(f'''{so...
81
0
import inspect import unittest from transformers import YolosConfig 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 f...
61
from math import sqrt def lowerCAmelCase_ ( __lowerCamelCase = 1_0_0_0_0_0_0 ): __snake_case : int = 0 __snake_case : int = 0 __snake_case : int while num_cuboids <= limit: max_cuboid_size += 1 ...
81
0
import copy import os from typing import TYPE_CHECKING, List, Union if TYPE_CHECKING: pass from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case = logging.get_logger(__name__) snake_case = { """kakaobrain/align-base""": """https://huggingface...
62
import inspect import unittest from transformers import MobileViTConfig 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 from ...test...
81
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 : List[str] = {"configuration_xg...
63
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor _snake_case : int = logging.get_logger(__name__) class a (_lowerCAmelCase ): """simple docstring""" def __init__( self : Optional[int] , ...
81
0
def A__ ( snake_case_ : list ): SCREAMING_SNAKE_CASE__: Dict= 0 while len(snake_case_ ) > 1: SCREAMING_SNAKE_CASE__: Any= 0 # Consider two files with minimum cost to be merged for _ in range(2 ): SCREAMING_SNAKE_CASE__: Optional[int]= files.index(min(snake_case_ ) ) temp +=...
64
from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_images, to_numpy_array, valid_...
81
0
"""simple docstring""" 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 __UpperCAmelCas...
65
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _snake_case : Any = { "configuration_informer": [ "INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "InformerConfig", ], } ...
81
0
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandinsky.text_encoder imp...
66
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_utils import FrozenDict f...
81
0
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case = logging.get_logger(__name__) snake_case = { """transfo-xl-wt103""": """https://huggingface.co/transfo-xl-wt103/resolve/main/config.json""", } class A_ ( ...
67
class a : """simple docstring""" def __init__( self : Tuple , lowerCamelCase : list ) -> None: __snake_case : str = set_counts __snake_case : Union[str, Any] = max(lowerCamelCase ...
81
0
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
68
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_t...
81
0
'''simple docstring''' from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class SCREAMING_SNAKE_CASE__ : __SCREAMING_SNAKE_CASE = 42 # [batch_size x 3] __SCREAMING_SNAKE_CASE = 42 # [batch_size x 3] __SCREAMING_SNAKE...
69
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start_docstrings_...
81
0
from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def _SCREAMING_SNAKE_CASE ( lowercase : NDArray[floataa] , lowercase : NDArray[floataa] , lowercase : list[int] , lowercase : ...
70
from __future__ import annotations def lowerCAmelCase_ ( __lowerCamelCase ): if not nums: return 0 __snake_case : Any = nums[0] __snake_case : str = 0 for num in nums[1:]: __snake_case , __snake_c...
81
0
'''simple docstring''' import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralD...
71
from __future__ import annotations from typing import Any def lowerCAmelCase_ ( __lowerCamelCase ): create_state_space_tree(__lowerCamelCase , [] , 0 ) def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase )...
81
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _UpperCAmelCase : List[Any] = { '''configuration_cl...
72
import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteSc...
81
0
a_ : dict[tuple[int, int, int], int] = {} def lowerCamelCase__ (_UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase): # if we are absent twice, or late 3 consecutive days, # no further prize strings are possible if late == 3 or absent == 2: return...
73
import gc import unittest import torch from parameterized import parameterized from diffusers import AutoencoderKL from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.tes...
81
0
# # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 torch-distributed-gpu-te...
74
import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor _snake_case : Optional[int] = logging.get_logger(__name__) class a (_lowerCAmelCase ): """simple docstring""" def __init__( self : Optional[Any] , ...
81
0
'''simple docstring''' from __future__ import annotations import numpy as np def a__ ( lowerCAmelCase__ ) -> List[Any]: return np.maximum(0 , lowerCAmelCase__ ) if __name__ == "__main__": print(np.array(relu([-1, 0, 5]))) # --> [0, 0, 5]
75
import shutil import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_tf_cross_test, require_tf, require_torch, require_torchvision, require_vision, ) from transformers.utils import is_tf_available, is_torch_available, is_vision_available if is_vision...
81
0
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer a_ = logging.get_l...
76
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor _snake_case : List[str] = logging.get_logger(__name__) class a (_lowerCAmelCase ): """simple docstring""" def __init__( self : List[str] , *lowe...
81
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A = logging.get_logger(__name__) A = { """distilbert-base-uncased""": """https://huggi...
77
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _snake_case : Union[str, Any] = { "configuration_owlvit": ...
81
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import tensorflow as tf from transformers import AutoTokenizer, TF...
78
from ....configuration_utils import PretrainedConfig from ....utils import logging _snake_case : int = logging.get_logger(__name__) _snake_case : str = { "Visual-Attention-Network/van-base": ( "https://huggingface.co/Visual-Attention-Network/van-base/blob/main/con...
81
0
import math class UpperCAmelCase_ : def __init__( self , _lowerCAmelCase=0 ): # a graph with Node 0,1,...,N-1 UpperCAmelCase__ : Union[str, Any] = n UpperCAmelCase__ : Union[str, Any] = [ [ma...
79
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _snake_case : Union[str, Any] = logging.getLogger(__name__) def lowerCAmelCase_ ( ): __snake_case : int = argparse.ArgumentParser( ...
81
0
import unittest from diffusers import FlaxAutoencoderKL from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): import jax @require_flax class __UpperCamelCase (...
80
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, g...
81
0
"""simple docstring""" import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info ...
82
_snake_case : Optional[int] = {"a": ["c", "b"], "b": ["d", "e"], "c": [], "d": [], "e": []} _snake_case : Dict = ["a", "b", "c", "d", "e"] def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase ): __snake_case ...
81
0
"""simple docstring""" import contextlib import copy import random from typing import Any, Dict, Iterable, Optional, Union import numpy as np import torch from .utils import deprecate, is_transformers_available if is_transformers_available(): import transformers def snake_case_ ( A_ : ...
83
def lowerCAmelCase_ ( ): return [ a * b * (1_0_0_0 - a - b) for a in range(1 , 9_9_9 ) for b in range(__lowerCamelCase , 9_9_9 ) if (a * a + b * b == (1_0_0_0 - a - b) ** 2) ][0] if __name__ == "__main__": print(f'''{so...
81
0
import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() UpperCAmelCase = logging.get_logger(__name__) def UpperCAmelCase_ ( __SCREAMING_SNAKE_CASE ): lowercase = ...
84
from math import sqrt def lowerCAmelCase_ ( __lowerCamelCase = 1_0_0_0_0_0_0 ): __snake_case : int = 0 __snake_case : int = 0 __snake_case : int while num_cuboids <= limit: max_cuboid_size += 1 ...
81
0
import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class snake_case ( UpperCamelCase_ ): def __init__( self : Dict , a_ : str , a_ : Optional[int]=None , a_ : s...
85
import inspect import unittest from transformers import MobileViTConfig 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 from ...test...
81
0
import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py __a :Optional[int] = '.' if __name__ == "__main__": __a :str = os.path.join(REPO_PATH, 'utils/documentation_tests.txt') ...
86
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor _snake_case : int = logging.get_logger(__name__) class a (_lowerCAmelCase ): """simple docstring""" def __init__( self : Optional[int] , ...
81
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase : Tuple = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: if not is_torch_ava...
87
from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_images, to_numpy_array, valid_...
81
0
"""simple docstring""" import argparse import copy def _snake_case ( __snake_case : Tuple ): """simple docstring""" _lowerCamelCase : str = {} with open(__snake_case ) as f: for line in f: if line.split()[0] not in dict_of_...
88
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _snake_case : Any = { "configuration_informer": [ "INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "InformerConfig", ], } ...
81
0
from __future__ import annotations import typing from collections import Counter def UpperCamelCase_( lowerCamelCase_ ) -> typing.Counter[int]: _lowercase : typing.Counter[int] = Counter() for base in range(1 , max_perimeter + 1 ): for perpendicular in...
89
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_utils import FrozenDict f...
81
0
'''simple docstring''' import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShar...
90
class a : """simple docstring""" def __init__( self : Tuple , lowerCamelCase : list ) -> None: __snake_case : str = set_counts __snake_case : Union[str, Any] = max(lowerCamelCase ...
81
0
"""simple docstring""" import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @require_se...
91
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_t...
81
0
'''simple docstring''' import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFAutoModel, is_tensorflow_text_available, is_tf_available from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.testing_utils import requ...
92
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start_docstrings_...
81
0
"""simple docstring""" __A = tuple[float, float, float] __A = tuple[float, float, float] def __A (_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) ->Vectorad: """simple docstring""" lowerCAmelCase__ :Tuple = end_pointa[0] - end_pointa[0] ...
93
from __future__ import annotations def lowerCAmelCase_ ( __lowerCamelCase ): if not nums: return 0 __snake_case : Any = nums[0] __snake_case : str = 0 for num in nums[1:]: __snake_case , __snake_c...
81
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available SCREAMING_SNAKE_CASE = {'configuration_glpn': ['GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GLPNConfig']} try: if not is_vision_avail...
94
from __future__ import annotations from typing import Any def lowerCAmelCase_ ( __lowerCamelCase ): create_state_space_tree(__lowerCamelCase , [] , 0 ) def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase )...
81
0
"""simple docstring""" import random def snake_case ( A__ ,A__ ): UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ : List[str] = [], [], [] for element in data: if element < pivot: less.append(A__ ) elif element > pivot: greater.append(A...
95
import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteSc...
81
0
"""simple docstring""" from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutpu...
96
import gc import unittest import torch from parameterized import parameterized from diffusers import AutoencoderKL from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.tes...
81
0
import copy import os import cva import numpy as np from matplotlib import pyplot as plt class lowercase__: """simple docstring""" def __init__( self : Optional[int] ) -> int: lowercase_ = '''''' lowercase_ = '''''' lowercase_ = [] l...
97
import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor _snake_case : Optional[int] = logging.get_logger(__name__) class a (_lowerCAmelCase ): """simple docstring""" def __init__( self : Optional[Any] , ...
81
0
'''simple docstring''' def a__ ( lowercase : int, lowercase : int ) -> float: """simple docstring""" return base * power(lowercase, (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('Raise base to the power of exponent using recursion...') ...
98
import shutil import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_tf_cross_test, require_tf, require_torch, require_torchvision, require_vision, ) from transformers.utils import is_tf_available, is_torch_available, is_vision_available if is_vision...
81
0
import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor SCREAMING_SNAKE_CASE = logging.getLogger(__name__) SCREAMING_SNAKE_CASE ...
99
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor _snake_case : List[str] = logging.get_logger(__name__) class a (_lowerCAmelCase ): """simple docstring""" def __init__( self : List[str] , *lowe...
81
0
import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class __snake_case : '''simple docstring''' def __init__( self , A_ ): '''simple docstring''' ...
100
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _snake_case : Union[str, Any] = { "configuration_owlvit": ...
81
0
import torch from torch import nn from transformers import CLIPPreTrainedModel, CLIPVisionModel from ...models.attention import BasicTransformerBlock from ...utils import logging lowerCAmelCase__ : Optional[int] =logging.get_logger(__name__) # pylint: disable=invalid-name ...
101
from ....configuration_utils import PretrainedConfig from ....utils import logging _snake_case : int = logging.get_logger(__name__) _snake_case : str = { "Visual-Attention-Network/van-base": ( "https://huggingface.co/Visual-Attention-Network/van-base/blob/main/con...
81
0
"""simple docstring""" from math import ceil, sqrt def UpperCamelCase (SCREAMING_SNAKE_CASE = 100_0000 ): UpperCamelCase : int = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: Uppe...
102
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _snake_case : Union[str, Any] = logging.getLogger(__name__) def lowerCAmelCase_ ( ): __snake_case : int = argparse.ArgumentParser( ...
81
0
"""simple docstring""" from __future__ import annotations def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ = None , lowerCAmelCase_ = None , lowerCAmelCase_ = False , ) -> tuple[int, float, str]: _snake_case = cipher_alphabet or [chr(lowerC...
103
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, g...
81
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
_snake_case : Optional[int] = {"a": ["c", "b"], "b": ["d", "e"], "c": [], "d": [], "e": []} _snake_case : Dict = ["a", "b", "c", "d", "e"] def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase ): __snake_case ...
81
0
def __UpperCAmelCase ( lowerCamelCase_ : int ) -> bool: """simple docstring""" return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('''Program to check whether a number is a Perfect number ...
105
def lowerCAmelCase_ ( ): return [ a * b * (1_0_0_0 - a - b) for a in range(1 , 9_9_9 ) for b in range(__lowerCamelCase , 9_9_9 ) if (a * a + b * b == (1_0_0_0 - a - b) ** 2) ][0] if __name__ == "__main__": print(f'''{so...
81
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case :Tuple =logging.get_logger(__name__) __snake_case :str ={ 'microsoft/markuplm-base': 'https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json', 'microsoft/markuplm-large...
106
from math import sqrt def lowerCAmelCase_ ( __lowerCamelCase = 1_0_0_0_0_0_0 ): __snake_case : int = 0 __snake_case : int = 0 __snake_case : int while num_cuboids <= limit: max_cuboid_size += 1 ...
81
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Dict = logging.get_logger(__name__) _UpperCAmelCase : List[str] = { '''facebook/nllb-moe-54B''': '''https://huggingface.co/facebook/nllb-moe-54...
107
import inspect import unittest from transformers import MobileViTConfig 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 from ...test...
81
0
def _SCREAMING_SNAKE_CASE ( __snake_case , __snake_case ) -> str: _UpperCAmelCase = len(__snake_case ) _UpperCAmelCase = len(__snake_case ) _UpperCAmelCase = ( first_str_length if first_str_length > second_str_length else secon...
108
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor _snake_case : int = logging.get_logger(__name__) class a (_lowerCAmelCase ): """simple docstring""" def __init__( self : Optional[int] , ...
81
0
'''simple docstring''' 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 imp...
109
from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_images, to_numpy_array, valid_...
81
0
"""simple docstring""" UpperCamelCase__ = { 'meter': 'm', 'kilometer': 'km', 'megametre': 'Mm', 'gigametre': 'Gm', 'terametre': 'Tm', 'petametre': 'Pm', 'exametre': 'Em', 'zettametre': 'Zm', 'yottametre': 'Ym', } # Exponent of the factor(meter) UpperCamelCase__ ...
110
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _snake_case : Any = { "configuration_informer": [ "INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "InformerConfig", ], } ...
81
0
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, ...
668
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_utils import FrozenDict f...
81
0
'''simple docstring''' 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 UNetMidBl...
26
class a : """simple docstring""" def __init__( self : Tuple , lowerCamelCase : list ) -> None: __snake_case : str = set_counts __snake_case : Union[str, Any] = max(lowerCamelCase ...
81
0
'''simple docstring''' UpperCAmelCase = "\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" UpperCAmelCase ...
119
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_t...
81
0
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_...
298
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start_docstrings_...
81
0
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer __SCREAMING...
425
from __future__ import annotations def lowerCAmelCase_ ( __lowerCamelCase ): if not nums: return 0 __snake_case : Any = nums[0] __snake_case : str = 0 for num in nums[1:]: __snake_case , __snake_c...
81
0
'''simple docstring''' import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, req...
212
from __future__ import annotations from typing import Any def lowerCAmelCase_ ( __lowerCamelCase ): create_state_space_tree(__lowerCamelCase , [] , 0 ) def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase )...
81
0
def __snake_case ( _lowerCAmelCase : Dict , _lowerCAmelCase : Any ) -> int: return int((input_a, input_a).count(0 ) == 0 ) def __snake_case ( ) -> List[str]: assert and_gate(0 , 0 ) == 0 assert and_gate(0 , 1 ) == 0...
454
import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteSc...
81
0
"""simple docstring""" from ....configuration_utils import PretrainedConfig from ....utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "Visual-Attention-Network/van-base": ( "https://huggingface.co/Visual-Attention-Network/v...
574
import gc import unittest import torch from parameterized import parameterized from diffusers import AutoencoderKL from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.tes...
81
0
'''simple docstring''' def __UpperCamelCase ( UpperCAmelCase , UpperCAmelCase ): print('''\nThe shortest path matrix using Floyd Warshall algorithm\n''' ) for i in range(__lowerCamelCase ): for j in range(__lowerCamelCase ): if dist[i][j] != float('''inf''' ): print(int(dist[i][j] ) , end=...
152
import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor _snake_case : Optional[int] = logging.get_logger(__name__) class a (_lowerCAmelCase ): """simple docstring""" def __init__( self : Optional[Any] , ...
81
0
import argparse from torch import nn # transformers_old should correspond to branch `save_old_prophetnet_model_structure` here # original prophetnet_checkpoints are saved under `patrickvonplaten/..._old` respectively from transformers_old.modeling_prophetnet import ( ProphetNetForConditionalGeneration as Pr...
326
import shutil import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_tf_cross_test, require_tf, require_torch, require_torchvision, require_vision, ) from transformers.utils import is_tf_available, is_torch_available, is_vision_available if is_vision...
81
0
"""simple docstring""" import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class SCREAMING_SNAKE_CASE_ : """simple docstring""" def __init__( self , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__): if dst_width < 0 or dst_height < 0: ...
155
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor _snake_case : List[str] = logging.get_logger(__name__) class a (_lowerCAmelCase ): """simple docstring""" def __init__( self : List[str] , *lowe...
81
0
import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from transformers import AutoTokenizer, Fl...
668
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _snake_case : Union[str, Any] = { "configuration_owlvit": ...
81
0
'''simple docstring''' from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import...
26
from ....configuration_utils import PretrainedConfig from ....utils import logging _snake_case : int = logging.get_logger(__name__) _snake_case : str = { "Visual-Attention-Network/van-base": ( "https://huggingface.co/Visual-Attention-Network/van-base/blob/main/con...
81
0
'''simple docstring''' def __UpperCamelCase ( lowercase__ : List[Any], lowercase__ : Optional[Any] ): '''simple docstring''' __lowercase =len(__lowerCamelCase ) __lowercase =len(__lowerCamelCase ) __lowercase =[[False for _ in range(m...
119
import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _snake_case : Union[str, Any] = logging.getLogger(__name__) def lowerCAmelCase_ ( ): __snake_case : int = argparse.ArgumentParser( ...
81
0
import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( _lowerCAmelCase ): a__ : Optional[int] = (CMStochasticIterativeScheduler,) a__ : List[Any] = 10 def __A ( self :...
298
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ftp_head, g...
81
0
"""simple docstring""" from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuratio...
425
_snake_case : Optional[int] = {"a": ["c", "b"], "b": ["d", "e"], "c": [], "d": [], "e": []} _snake_case : Dict = ["a", "b", "c", "d", "e"] def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase ): __snake_case ...
81
0
'''simple docstring''' from __future__ import annotations import math def __snake_case ( _UpperCAmelCase : Optional[int]): if num <= 0: UpperCamelCase = f'{num}: Invalid input, please enter a positive integer.' raise ValueError(__lowerCamelCase) UpperCame...
212
def lowerCAmelCase_ ( ): return [ a * b * (1_0_0_0 - a - b) for a in range(1 , 9_9_9 ) for b in range(__lowerCamelCase , 9_9_9 ) if (a * a + b * b == (1_0_0_0 - a - b) ** 2) ][0] if __name__ == "__main__": print(f'''{so...
81
0
import unittest from transformers.testing_utils import CaptureStdout from transformers.tools.python_interpreter import evaluate def __snake_case ( _lowerCAmelCase : int ) -> Any: return x + 2 class __magic_name__ ( unittest.TestCase ): """simple docstring"...
454
from math import sqrt def lowerCAmelCase_ ( __lowerCamelCase = 1_0_0_0_0_0_0 ): __snake_case : int = 0 __snake_case : int = 0 __snake_case : int while num_cuboids <= limit: max_cuboid_size += 1 ...
81
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(): impo...
574
import inspect import unittest from transformers import MobileViTConfig 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 from ...test...
81
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __a: Optional[Any] = { "configuration_timesformer": ["TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimesformerConfig"], } try: if not is_torch_available(): ...
152
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor _snake_case : int = logging.get_logger(__name__) class a (_lowerCAmelCase ): """simple docstring""" def __init__( self : Optional[int] , ...
81
0
from math import sqrt def A_ ( lowercase_ = 1000000 ) -> int: _snake_case : int = 0 _snake_case : int = 0 _snake_case : int while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_sides in rang...
326
from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_images, to_numpy_array, valid_...
81
0
"""simple docstring""" import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __magic_name__ = logging.get_logger(__name__) __magic_name__ = { "vocab_file": "vocab.json", "...
155
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _snake_case : Any = { "configuration_informer": [ "INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "InformerConfig", ], } ...
81
0
import math def lowerCAmelCase_ (lowercase__ : Optional[int] , lowercase__ : Optional[int] ) -> Dict: '''simple docstring''' lowerCAmelCase__ = len(__lowerCamelCase ) lowerCAmelCase__ = int(math.floor(math.sqrt(__lowerC...
668
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_utils import FrozenDict f...
81
0
'''simple docstring''' 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 im...
26
class a : """simple docstring""" def __init__( self : Tuple , lowerCamelCase : list ) -> None: __snake_case : str = set_counts __snake_case : Union[str, Any] = max(lowerCamelCase ...
81
0
'''simple docstring''' import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": UpperCAmelCase = argparse.ArgumentParser( description=( '''Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned'''...
119
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_t...
81
0
class lowerCAmelCase__ : def __init__( self : List[str] ) -> List[str]: __lowerCamelCase = "" __lowerCamelCase = "" __lowerCamelCase = [] def __A ( self : int , SCREAMING_SNAKE_CASE__ : i...
298
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start_docstrings_...
81
0
"""simple docstring""" import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope='session' ) def lowercase__( ): lowe...
425
from __future__ import annotations def lowerCAmelCase_ ( __lowerCamelCase ): if not nums: return 0 __snake_case : Any = nums[0] __snake_case : str = 0 for num in nums[1:]: __snake_case , __snake_c...
81
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : Tuple = logging.get_logger(__name__) snake_case_ : List[Any] = { "microsoft/cvt-13": "https://huggingface.co/microsoft/cvt-13/resolve/main/config.json", # See...
212
from __future__ import annotations from typing import Any def lowerCAmelCase_ ( __lowerCamelCase ): create_state_space_tree(__lowerCamelCase , [] , 0 ) def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase )...
81
0
import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY if ...
454
import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteSc...
81
0
"""simple docstring""" import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, requi...
574
import gc import unittest import torch from parameterized import parameterized from diffusers import AutoencoderKL from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.tes...
81
0