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 shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BertTokenizer, BlipImageProcess...
40
"""simple docstring""" import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 __A = 0b101100111110110010010000011110111011000110011110 # bin(x)...
646
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase__ = { '''configuration_funnel''': ['''FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MA...
41
"""simple docstring""" # Imports import numpy as np class _snake_case : def __init__( self : Union[str, Any] , UpperCAmelCase : Dict=None , UpperCAmelCase : Any=None , UpperCAmelCase : Optional[int]=None , UpperCAmelCase : ...
646
0
'''simple docstring''' import copy import tempfile import unittest from huggingface_hub import HfFolder, delete_repo from parameterized import parameterized from requests.exceptions import HTTPError from transformers import AutoConfig, GenerationConfig from transformers.testing_utils import TOKEN, USER, is_sta...
42
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...te...
646
0
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 BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_utils import PILIm...
43
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backbo...
646
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ : Union[str, Any] = logging.get_logger(__name__) UpperCAmelCase_ : List[Any] = { 'tanreinama/GPTSAN-2.8B-spout_is_uniform': ( 'https://huggingface.co/tanr...
44
"""simple docstring""" import math def lowercase_ ( _lowerCamelCase: int ) -> list[int]: '''simple docstring''' __lowerCamelCase : Optional[int] = [] __lowerCamelCase : Tuple = 2 __lowerCamelCase : str = int(math.sqrt(_lowerCamelCase ) ...
646
0
import os from distutils.util import strtobool def A ( lowercase__ : List[str] , lowercase__ : Union[str, Any] ) -> List[str]: for e in env_keys: UpperCamelCase__ :Optional[Any] = int(os.environ.get(lowercase__ , -1 ) ) if val >= 0: return val return default def ...
45
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers i...
646
0
"""simple docstring""" import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def lowerCamelCase_( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase=5 ) -> Tuple: '''simple docstring''' assert masked_input.count("<mask...
46
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer __A = log...
646
0
def UpperCAmelCase__ ( lowerCamelCase_ : Tuple , lowerCamelCase_ : Optional[Any] , lowerCamelCase_ : int=False ): if isinstance(lowerCamelCase_ , lowerCamelCase_ ) and isinstance(lowerCamelCase_ , lowerCamelCase_ ): __a ...
47
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __A = logging.get_logger(__name__) class _snake_case ( a__ ): def __init__( self : Optional[Any] , *UpperCAmelCase : int , **...
646
0
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils import...
48
"""simple docstring""" 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...
646
0
"""simple docstring""" import operator as op _lowercase : List[str] = 'scaler.pt' _lowercase : Tuple = 'pytorch_model' _lowercase : Tuple = 'random_states' _lowercase : Optional[Any] = 'optimizer' _lowercase : str ...
49
"""simple docstring""" 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.parame...
646
0
'''simple docstring''' from __future__ import annotations from collections.abc import Generator def A__ ( ): lowerCamelCase__ = {} lowerCamelCase__ = 2 while True: lowerCamelCase__ = factor_map.pop(__lowerCAmelCase , __lowerCAmelCase ...
50
"""simple docstring""" import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class _snake_case ( ctypes.Structure ): # _fields is a specific attr expected by ctypes snake_case__ = [("...
646
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available a__ : Dict = { 'configuration_mobilenet_v2': [ 'MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MobileNetV...
51
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTe...
646
0
"""simple docstring""" from manim import * class __lowercase ( _UpperCamelCase ): '''simple docstring''' def _lowerCamelCase ( self ): __a : Dict = Rectangle(height=0.5 , width=0.5 ) ...
52
"""simple docstring""" def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float ) -> float: '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(F"""{price_plus_tax(100, 0.25) = }""") print(F"""{price_plus_tax(1_25.50, 0.05) =...
646
0
def a_ ( lowerCAmelCase_ : str ): return credit_card_number.startswith(('34', '35', '37', '4', '5', '6') ) def a_ ( lowerCAmelCase_ : str ): __lowerCAmelCase = credit_card_number __lowerCAmelCase = 0 __lowerCAmelCase ...
53
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_ima...
646
0
def a__ ( lowercase__ ): '''simple docstring''' UpperCAmelCase_ =set() # edges = list of graph's edges UpperCAmelCase_ =get_edges(lowercase__ ) # While there are still elements in edges list, take an arbitrary edge # (from_no...
54
"""simple docstring""" import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require...
646
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE :Tuple = { 'configuration_bert':...
55
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''naver-clova-ix/donut-base''': '''https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json''', # See all Donut models at https://h...
646
0
'''simple docstring''' import inspect import unittest from transformers import MobileNetVaConfig 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 imp...
56
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''SenseTime/deformable-detr''': '''https://huggingface.co/sensetime/deformable-detr/resolve/main/config.j...
646
0
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer A_ : Optional[int] = logging.get_logger(__name__) A_ : Optional[Any] ...
57
"""simple docstring""" import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowercase_ ( _lowerCamelCase: Any , _lowerCamelCase: int , _lowerCamelCase: Union[str, Any] ) ...
646
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 ...
58
"""simple docstring""" import math from collections.abc import Iterator from itertools import takewhile def lowercase_ ( _lowerCamelCase: int ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or n...
646
0
import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class _SCREAMING_SNAKE_CASE ( unittest.TestCase ): '''simple docstring''' def ...
59
"""simple docstring""" from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge __A = [ '''Prosecutor: "No videos were used in the crash investigation" German papers say they saw a cell phone video of t...
646
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { '''tiiuae/falcon-40b''': '''https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json''', '''tiiuae/falcon-7b''': '''http...
60
"""simple docstring""" from manim import * class _snake_case ( a__ ): def lowerCamelCase__ ( self : str ): __lowerCamelCase : Tuple = Rectangle(height=0.5 , width=0.5 ) __lowerCamelCase : Dict = Rectangle(height=...
646
0
import inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List, Tuple import numpy as np from...
61
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
646
0
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig 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_conf...
62
"""simple docstring""" import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 __A = 0b101100111110110010010000011110111011000110011110 # bin(x)...
646
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a : int = logging.get_logger(__name__) a : Union[str, Any] ...
63
"""simple docstring""" # Imports import numpy as np class _snake_case : def __init__( self : Union[str, Any] , UpperCAmelCase : Dict=None , UpperCAmelCase : Any=None , UpperCAmelCase : Optional[int]=None , UpperCAmelCase : ...
646
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase_ : List[Any] = logging.get_logger(__name__) lowercase_ : Any = { 'xlm-roberta-base': 'https://huggingfa...
64
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...te...
646
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __UpperCAmelCase = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_...
65
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backbo...
646
0
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename UpperCamelCase = "http://www.mocksite.com/file1.txt" Uppe...
66
"""simple docstring""" import math def lowercase_ ( _lowerCamelCase: int ) -> list[int]: '''simple docstring''' __lowerCamelCase : Optional[int] = [] __lowerCamelCase : Tuple = 2 __lowerCamelCase : str = int(math.sqrt(_lowerCamelCase ) ...
646
0
def SCREAMING_SNAKE_CASE__ ( snake_case__ :Dict , snake_case__ :str ) -> List[str]: _lowercase = [1] for i in range(2 , snake_case__ ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" _lowercase ...
67
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers i...
646
0
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 = { "facebook/xmod-base": "https://huggingface.co/facebook/xmod-base/resolve/main/c...
68
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer __A = log...
646
0
'''simple docstring''' from __future__ import annotations class SCREAMING_SNAKE_CASE__ : def __init__( self : Dict , a_ : int = 0 ): """simple docstring""" __snake_case = key def A ( self ...
69
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __A = logging.get_logger(__name__) class _snake_case ( a__ ): def __init__( self : Optional[Any] , *UpperCAmelCase : int , **...
646
0
import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS_CACHE, WEIGHTS_NAME, ca...
70
"""simple docstring""" 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...
646
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor _lowerCamelCase = logging.get_logger(__name__) class _snake_case (__SCREAMING_SNAKE_CASE): def __init__( self ,*_snake_case ,**_snake_case ...
71
"""simple docstring""" 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.parame...
646
0
'''simple docstring''' import numpy as np import datasets _UpperCAmelCase : Optional[int] = ''' Compute the Mahalanobis Distance Mahalonobis distance is the distance between a point and a distribution. And not between two distinct points. It is effectively a multivariate equivalent of the Euclidean distance. ...
72
"""simple docstring""" import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class _snake_case ( ctypes.Structure ): # _fields is a specific attr expected by ctypes snake_case__ = [("...
646
0
class _snake_case : def __init__( self , a) -> Optional[int]: SCREAMING_SNAKE_CASE = n SCREAMING_SNAKE_CASE = [None] * self.n SCREAMING_SNAKE_CASE = 0 # index of the first element SCREAMING_SNAKE_CASE = 0 SCREAMING_SNA...
73
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTe...
646
0
import copy import tempfile import unittest from huggingface_hub import HfFolder, delete_repo from parameterized import parameterized from requests.exceptions import HTTPError from transformers import AutoConfig, GenerationConfig from transformers.testing_utils import TOKEN, USER, is_staging_test class __Up...
74
"""simple docstring""" def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float ) -> float: '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(F"""{price_plus_tax(100, 0.25) = }""") print(F"""{price_plus_tax(1_25.50, 0.05) =...
646
0
'''simple docstring''' import os import unittest from transformers import LayoutLMTokenizer, LayoutLMTokenizerFast from transformers.models.layoutlm.tokenization_layoutlm import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerT...
75
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_ima...
646
0
"""simple docstring""" import numpy as np def __UpperCAmelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase = 1e-12 , __UpperCamelCase = 1_00 , ): assert np.shape(__UpperCamelCase )[0] == np.shape(__UpperCamelCase )[1] # Ensure proper dimensiona...
76
"""simple docstring""" import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require...
646
0
"""simple docstring""" def _UpperCamelCase ( UpperCamelCase , UpperCamelCase ) -> str: """simple docstring""" __UpperCAmelCase : int = len(UpperCamelCase ) __UpperCAmelCase : int = len(UpperCamelCase ) _...
77
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''naver-clova-ix/donut-base''': '''https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json''', # See all Donut models at https://h...
646
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 timm import create_model from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transfo...
78
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''SenseTime/deformable-detr''': '''https://huggingface.co/sensetime/deformable-detr/resolve/main/config.j...
646
0
from .configuration_bert_masked import MaskedBertConfig from .modeling_bert_masked import ( MaskedBertForMultipleChoice, MaskedBertForQuestionAnswering, MaskedBertForSequenceClassification, MaskedBertForTokenClassification, MaskedBertModel, ) from .modules import * ...
79
"""simple docstring""" import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowercase_ ( _lowerCamelCase: Any , _lowerCamelCase: int , _lowerCamelCase: Union[str, Any] ) ...
646
0
import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version(""">=""", FSDP_PYTORCH_VERSION): import torch.distributed.checkpoint as dist_cp from torch.distributed.checkpo...
80
"""simple docstring""" import math from collections.abc import Iterator from itertools import takewhile def lowercase_ ( _lowerCamelCase: int ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or n...
646
0
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class a (_lowerCAmelCase ): """simple docstring""" __UpperCAmelCase : List[str] = (DDIMParallelScheduler,) __UpperCAmelCase : Tuple = (("...
81
"""simple docstring""" from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge __A = [ '''Prosecutor: "No videos were used in the crash investigation" German papers say they saw a cell phone video of t...
646
0
"""simple docstring""" from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin...
82
"""simple docstring""" from manim import * class _snake_case ( a__ ): def lowerCamelCase__ ( self : str ): __lowerCamelCase : Tuple = Rectangle(height=0.5 , width=0.5 ) __lowerCamelCase : Dict = Rectangle(height=...
646
0
"""simple docstring""" import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStr...
83
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
646
0
import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class A_ ( __lowerCamelCase ): '''simple docstring''' _Upp...
84
"""simple docstring""" import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 __A = 0b101100111110110010010000011110111011000110011110 # bin(x)...
646
0
from random import randint from tempfile import TemporaryFile import numpy as np def _a ( lowercase__ : List[Any] , lowercase__ : List[Any] , lowercase__ : Optional[int] ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Tuple = 0 if start < en...
85
"""simple docstring""" # Imports import numpy as np class _snake_case : def __init__( self : Union[str, Any] , UpperCAmelCase : Dict=None , UpperCAmelCase : Any=None , UpperCAmelCase : Optional[int]=None , UpperCAmelCase : ...
646
0
# XXX: we want transformers master here - in the absense of conftest manipulating sys.path: # hack it in for now: import sys from pathlib import Path __a :Tuple = Path(__file__).resolve().parents[3] / 'src' sys.path.insert(1, str(git_repo_path)) import dataclasses # noqa import io # noqa i...
86
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...te...
646
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase : str = { """configuration_m2m_100""": ["""M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP""", """M2M100Config""", """M2M100OnnxConfig"""], ...
87
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backbo...
646
0
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffuser...
88
"""simple docstring""" import math def lowercase_ ( _lowerCamelCase: int ) -> list[int]: '''simple docstring''' __lowerCamelCase : Optional[int] = [] __lowerCamelCase : Tuple = 2 __lowerCamelCase : str = int(math.sqrt(_lowerCamelCase ) ...
646
0
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def UpperCamelCase_( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ = None , l...
89
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers i...
646
0
'''simple docstring''' def _snake_case ( A , A ) -> int: return x if y == 0 else greatest_common_divisor(A , x % y ) def _snake_case ( A , A ) -> int: return (x * y) // greatest_common_divisor(A , A ) def ...
90
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer __A = log...
646
0
"""simple docstring""" def _snake_case ( snake_case__ : str , snake_case__ : str ): A = len(snake_case__ ) + 1 A = len(snake_case__ ) + 1 # dp is a 2d matrix where dp[i][j] denotes whether prefix string of # length i of input_string matches with prefix string of length j of # given ...
91
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __A = logging.get_logger(__name__) class _snake_case ( a__ ): def __init__( self : Optional[Any] , *UpperCAmelCase : int , **...
646
0
'''simple docstring''' from .configuration_bert_masked import MaskedBertConfig from .modeling_bert_masked import ( MaskedBertForMultipleChoice, MaskedBertForQuestionAnswering, MaskedBertForSequenceClassification, MaskedBertForTokenClassification, MaskedBertModel, ) from .modules import * ...
92
"""simple docstring""" 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...
646
0
"""simple docstring""" def __A (_SCREAMING_SNAKE_CASE ) ->str: """simple docstring""" if isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING...
93
"""simple docstring""" 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.parame...
646
0
'''simple docstring''' 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 tr...
94
"""simple docstring""" import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class _snake_case ( ctypes.Structure ): # _fields is a specific attr expected by ctypes snake_case__ = [("...
646
0
"""simple docstring""" from __future__ import annotations import math def snake_case ( A__ ,A__ ): UpperCAmelCase_ : Union[str, Any] = u for i in range(1 ,A__ ): UpperCAmelCase_ : Optional[int] = temp * (u - i) return temp def snake_case ( ): ...
95
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTe...
646
0
"""simple docstring""" from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from ..image_utils import load_i...
96
"""simple docstring""" def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float ) -> float: '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(F"""{price_plus_tax(100, 0.25) = }""") print(F"""{price_plus_tax(1_25.50, 0.05) =...
646
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __a = logging.get_logger(__name__) __a = { 'facebook/xglm-564M': 'https://huggingface.co/facebook/xglm-564M/resolve/main/config.json', # See all XGLM models at https://huggingface.co/models?filter=x...
97
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_ima...
646
0
'''simple docstring''' from ....configuration_utils import PretrainedConfig from ....utils import logging lowercase__ : Dict = logging.get_logger(__name__) lowercase__ : str = { 'CarlCochet/trajectory-transformer-halfcheetah-medium-v2': ( 'https://huggingface.co/CarlCoche...
98
"""simple docstring""" import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require...
646
0
import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from transformers import GradientAccumulator, crea...
99
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''naver-clova-ix/donut-base''': '''https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json''', # See all Donut models at https://h...
646
0
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging _A : Dict = l...
100
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''SenseTime/deformable-detr''': '''https://huggingface.co/sensetime/deformable-detr/resolve/main/config.j...
646
0
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 ...test_tokenization_com...
101
"""simple docstring""" import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowercase_ ( _lowerCamelCase: Any , _lowerCamelCase: int , _lowerCamelCase: Union[str, Any] ) ...
646
0
"""simple docstring""" def UpperCamelCase (SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): assert x is not None assert y is not None UpperCamelCase : str = len(SCREAMING_SNAKE_CASE ) UpperCamelCase : List[str] = len(SCREA...
102
"""simple docstring""" import math from collections.abc import Iterator from itertools import takewhile def lowercase_ ( _lowerCamelCase: int ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or n...
646
0
"""simple docstring""" import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node snake_case = 4 snake_case = 3 class ...
103
"""simple docstring""" from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge __A = [ '''Prosecutor: "No videos were used in the crash investigation" German papers say they saw a cell phone video of t...
646
0
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : int ) -> int: """simple docstring""" if not isinstance(UpperCAmelCase_, UpperCAmelCase_ ): raise TypeError("only integers accepted as input" ) else: A__ = ...
104
"""simple docstring""" from manim import * class _snake_case ( a__ ): def lowerCamelCase__ ( self : str ): __lowerCamelCase : Tuple = Rectangle(height=0.5 , width=0.5 ) __lowerCamelCase : Dict = Rectangle(height=...
646
0
from math import factorial, pi def __UpperCAmelCase ( lowerCamelCase_ : float , lowerCamelCase_ : int = 30 ) -> float: """simple docstring""" if not isinstance(lowerCamelCase_ , (int, float) ): raise ValueError('maclaurin_sin() requires ...
105
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
646
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case :Optional[Any] =logging.get_logger(__name__) __snake_case :Tuple ={ 'transfo-xl-wt103': 'https://huggingface.co/transfo-xl-wt103/resolve/main/config.json', } class lowerCAmelCase_...
106
"""simple docstring""" import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 __A = 0b101100111110110010010000011110111011000110011110 # bin(x)...
646
0
'''simple docstring''' import operator def _SCREAMING_SNAKE_CASE ( __snake_case : list , __snake_case : bool = False , __snake_case : list | None = None ): _A = operator.lt if reverse else operator.gt _A = solution or [] if not arr: ...
107
"""simple docstring""" # Imports import numpy as np class _snake_case : def __init__( self : Union[str, Any] , UpperCAmelCase : Dict=None , UpperCAmelCase : Any=None , UpperCAmelCase : Optional[int]=None , UpperCAmelCase : ...
646
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.convert_swi...
108
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...te...
646
0
'''simple docstring''' import dataclasses import re import string from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple import numpy as np from . import residue_constants a = Mapping[str, np.ndarray] a = Mapping[str, Any] # Is a nested dict. a = 0.01 @data...
109
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backbo...
646
0
'''simple docstring''' import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuratio...
430
"""simple docstring""" import math def lowercase_ ( _lowerCamelCase: int ) -> list[int]: '''simple docstring''' __lowerCamelCase : Optional[int] = [] __lowerCamelCase : Tuple = 2 __lowerCamelCase : str = int(math.sqrt(_lowerCamelCase ) ...
646
0
import math def UpperCAmelCase_ ( UpperCAmelCase__ = 1_0_0 ): lowercase_ = sum(i * i for i in range(1 , n + 1 ) ) lowercase_ = int(math.pow(sum(range(1 , n + 1 ) ) , 2 ) ) return square_of_sum - sum_of_squares if __name__ == "__main__": print(...
412
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers i...
646
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) snake_case : Optional[int] = { 'configuration_encodec': [ 'ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP', 'EncodecConfig', ], ...
566
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer __A = log...
646
0
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __a = logging.get_logger(__name__) class __a( a__ ): """simple docstring""" def __init__( self ,*_SCREAMING_SNAKE_CASE ,**_SCREAMING_SNAKE_CASE ) -> int: ...
30
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __A = logging.get_logger(__name__) class _snake_case ( a__ ): def __init__( self : Optional[Any] , *UpperCAmelCase : int , **...
646
0
"""simple docstring""" from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText ...
19
"""simple docstring""" 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...
646
0
from collections.abc import Sequence def _SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): return sum(c * (x**i) for i, c in enumerate(_lowerCamelCase ) ) def _SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): A_ : ...
590
"""simple docstring""" 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.parame...
646
0
from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_...
604
"""simple docstring""" import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class _snake_case ( ctypes.Structure ): # _fields is a specific attr expected by ctypes snake_case__ = [("...
646
0
from PIL import Image def lowerCamelCase( a__ ,a__): def brightness(a__) -> float: return 128 + level + (c - 128) if not -255.0 <= level <= 255.0: raise ValueError('''level must be between -255.0 (black) and 255.0 (white)''') return img.point(_lowerCamelCase) if __name...
691
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTe...
646
0
import math from datetime import datetime, timedelta def _snake_case ( lowerCAmelCase : int ): """simple docstring""" SCREAMING_SNAKE_CASE_ : str = year % 1_9 SCREAMING_SNAKE_CASE_ : Dict = year % 4 SCREAMING_SNAKE_CASE_ : List[Any] ...
216
"""simple docstring""" def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float ) -> float: '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(F"""{price_plus_tax(100, 0.25) = }""") print(F"""{price_plus_tax(1_25.50, 0.05) =...
646
0
'''simple docstring''' __a: str = 6_55_21 def __UpperCamelCase ( UpperCAmelCase ): lowercase__ : Dict = 1 lowercase__ : Union[str, Any] = 0 for plain_chr in plain_text: lowercase__ : Tuple = (a + ord(_lowerCamelCase )) % MOD_ADL...
152
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_ima...
646
0
"""simple docstring""" from scipy.stats import pearsonr import datasets __A = "\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assumption...
586
"""simple docstring""" import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require...
646
0
'''simple docstring''' import unittest import numpy as np from transformers import AlbertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available()...
430
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''naver-clova-ix/donut-base''': '''https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json''', # See all Donut models at https://h...
646
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available a = { 'configuration_data2vec_audio': ['DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Data2VecAudioConfig'], 'configuration_data2vec_text': [ 'DATA2VEC_T...
412
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''SenseTime/deformable-detr''': '''https://huggingface.co/sensetime/deformable-detr/resolve/main/config.j...
646
0
'''simple docstring''' from math import sqrt def lowercase__ ( __UpperCamelCase : int = 1000000 ): '''simple docstring''' __lowercase = 0 __lowercase = 0 __lowercase = 42 while num_cuboids <= limit: max_cuboid_size +...
566
"""simple docstring""" import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowercase_ ( _lowerCamelCase: Any , _lowerCamelCase: int , _lowerCamelCase: Union[str, Any] ) ...
646
0
import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __a = '\\n@INPROCEEDINGS{Papineni02bleu:a,\n author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu},\n title = {BLEU: a Method for Automatic Eva...
30
"""simple docstring""" import math from collections.abc import Iterator from itertools import takewhile def lowercase_ ( _lowerCamelCase: int ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or n...
646
0
"""simple docstring""" def lowerCamelCase__ ( __snake_case ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] if len(_lowerCamelCase ) == 1: return [nums.copy()] for _ in range(len(_lowerCamelCase ) ...
19
"""simple docstring""" from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge __A = [ '''Prosecutor: "No videos were used in the crash investigation" German papers say they saw a cell phone video of t...
646
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_big_bird impo...
590
"""simple docstring""" from manim import * class _snake_case ( a__ ): def lowerCamelCase__ ( self : str ): __lowerCamelCase : Tuple = Rectangle(height=0.5 , width=0.5 ) __lowerCamelCase : Dict = Rectangle(height=...
646
0
def __UpperCAmelCase ( UpperCAmelCase )-> set: """simple docstring""" lowercase = set() # edges = list of graph's edges lowercase = get_edges(_lowerCamelCase ) # While there are still elements in edges list, take an arbitrary...
604
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
646
0
import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast 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 snake_ca...
691
"""simple docstring""" import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 __A = 0b101100111110110010010000011110111011000110011110 # bin(x)...
646
0
from string import ascii_uppercase __lowerCamelCase : Tuple = {char: i for i, char in enumerate(ascii_uppercase)} __lowerCamelCase : str = dict(enumerate(ascii_uppercase)) def _snake_case ( lowerCAmelCase : str , lowerCAmelCase : str ): """simple docst...
216
"""simple docstring""" # Imports import numpy as np class _snake_case : def __init__( self : Union[str, Any] , UpperCAmelCase : Dict=None , UpperCAmelCase : Any=None , UpperCAmelCase : Optional[int]=None , UpperCAmelCase : ...
646
0
'''simple docstring''' import argparse import json from collections import OrderedDict import torch from huggingface_hub import cached_download, hf_hub_url from transformers import AutoImageProcessor, CvtConfig, CvtForImageClassification def __UpperCamelCase ( UpperCAmelCase ): lowercase__ : Opt...
152
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...te...
646
0
"""simple docstring""" import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) class UpperCAmelCase (a__ ): """simple docstring""" _UpperCA...
586
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backbo...
646
0
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torc...
430
"""simple docstring""" import math def lowercase_ ( _lowerCamelCase: int ) -> list[int]: '''simple docstring''' __lowerCamelCase : Optional[int] = [] __lowerCamelCase : Tuple = 2 __lowerCamelCase : str = int(math.sqrt(_lowerCamelCase ) ...
646
0
from __future__ import annotations def UpperCAmelCase_ ( UpperCAmelCase__ ): create_state_space_tree(_lowerCamelCase , [] , 0 , [0 for i in range(len(_lowerCamelCase ) )] ) def UpperCAmelCase_ ( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ,...
412
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers i...
646
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 snake_case : Any = logging.get_logger(__name__)...
566
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer __A = log...
646
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __a = logging.get_logger(__name__) __a = { 's-JoL/Open-Llama-V1': 'https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json', } class __a( a__ ): """simple docstring""" ...
30
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __A = logging.get_logger(__name__) class _snake_case ( a__ ): def __init__( self : Optional[Any] , *UpperCAmelCase : int , **...
646
0
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImagePr...
19
"""simple docstring""" 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...
646
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { """SenseTime/deformable-detr""": """https://huggingface.co/sensetime/deformable-d...
590
"""simple docstring""" 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.parame...
646
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_...
604
"""simple docstring""" import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class _snake_case ( ctypes.Structure ): # _fields is a specific attr expected by ctypes snake_case__ = [("...
646
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'''): snake_case_ : Any = { '''linear''': PIL.Image.Resampling.BILINEAR, '''bilinear''': PIL...
691
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTe...
646
0