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
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) __A = { '''configuration_perceiver''': ['''PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Pe...
646
"""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
1
"""simple docstring""" 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 ( AutoProcesso...
646
"""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
1
"""simple docstring""" import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class _snake_case : snake_case__ = None snake_case__ = False snake_case__ = False snake_case__ = ...
646
"""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
1
"""simple docstring""" import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class _snake_case ( a__ ): snake_case__ = "" snake_case__ = ( None # protocol passed i...
646
"""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
1
"""simple docstring""" import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelT...
646
"""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
1
"""simple docstring""" def lowercase_ ( _lowerCamelCase: dict ) -> set: '''simple docstring''' __lowerCamelCase : Union[str, Any] = set() # edges = list of graph's edges __lowerCamelCase : Any = get_edges(_lowerCamelCase ) # While there are ...
646
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import _LazyModule __A = {'''tokenization_tapex''': ['''TapexTokenizer''']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys __A = _LazyModule(__name__, globals()['''__file__'''], _im...
646
"""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
1
"""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
"""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
1
"""simple docstring""" import argparse import logging import os import re import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, DataCollatorForLanguageModeling, PushToHubCallback, TFAutoModelForMaskedLM, create_optimizer, ) __A = logging.getLogger(__name__) ...
646
"""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
1
"""simple docstring""" import unittest from transformers import BigBirdConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax from transforme...
646
"""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
1
"""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_distilbert import DistilBertTokenizer __A = logging.get_logger(__name__) __A = {...
646
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __A = { '''configuration_resnet''': ['''RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ResNetConfig''', '...
646
"""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
1
"""simple docstring""" import unittest import numpy as np from transformers import AlbertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.n...
646
"""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
1
"""simple docstring""" from collections.abc import Sequence def lowercase_ ( _lowerCamelCase: Sequence[float] , _lowerCamelCase: bool = False ) -> float: '''simple docstring''' if not arr: return 0 __lowerCamelCase : int = 0 if allow_empty_sub...
646
"""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
1
"""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 = { '''kssteven/ibert-roberta-base''': '''https://huggingface....
646
"""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
1
"""simple docstring""" from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures,...
646
"""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
1
"""simple docstring""" import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FIL...
646
"""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
1
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler,...
646
"""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
1
"""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...
646
"""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
1
"""simple docstring""" def lowercase_ ( _lowerCamelCase: Tuple ) -> List[Any]: '''simple docstring''' if collection == []: return [] # get some information about the collection __lowerCamelCase : Optional[int] = len(_lowerCamelCase ) __l...
646
"""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
1
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int ) -> bool: '''simple docstring''' return number & 1 == 0 if __name__ == "__main__": import doctest doctest.testmod()
646
"""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
1
"""simple docstring""" from __future__ import annotations def lowercase_ ( _lowerCamelCase: int , _lowerCamelCase: int ) -> list[list[int]]: '''simple docstring''' __lowerCamelCase : list[list[int]] = [] create_all_state(1 , _lowerCamelCase , _lowerCam...
646
"""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
1
"""simple docstring""" from queue import PriorityQueue from typing import Any import numpy as np def lowercase_ ( _lowerCamelCase: dict , _lowerCamelCase: str , _lowerCamelCase: set , _lowerCamelCase: set , _lowerCamelCase: dict , _lowerCamelCase: dict , _lowerCa...
646
"""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
1
"""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 = { '''facebook/xmod-base''': '''https://huggingface.co/facebo...
646
"""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
1
"""simple docstring""" from math import log from scipy.constants import Boltzmann, physical_constants __A = 300 # TEMPERATURE (unit = K) def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float , _lowerCamelCase: float , ) -> float: '''simple docstring''' ...
646
"""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
1
"""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
"""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
1
"""simple docstring""" from __future__ import annotations __A = 8.9_8_8e9 # units = N * m^s * C^-2 def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float , _lowerCamelCase: float , _lowerCamelCase: float ) -> dict[str, float]: '''simple docstring''' ...
646
"""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
1
"""simple docstring""" from json import JSONDecodeError # Workaround for requests.exceptions.JSONDecodeError import requests def lowercase_ ( _lowerCamelCase: str = "isbn/0140328726" ) -> dict: '''simple docstring''' __lowerCamelCase : Optional[Any] = olid.strip().strip(...
646
"""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
1
"""simple docstring""" import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class _snake_case ( nn.Module ): snake_case__ = 42 snake_case__ = 42 ...
646
"""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
1
"""simple docstring""" import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging __A = logging.get_logger(__name__) class _snake_case ( a__ ): snake_case__ = "li...
646
"""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
1
"""simple docstring""" # Copyright (c) 2021-, NVIDIA CORPORATION. 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
"""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
1
"""simple docstring""" __A = {str(digit): digit**5 for digit in range(10)} def lowercase_ ( _lowerCamelCase: int ) -> int: '''simple docstring''' return sum(DIGITS_FIFTH_POWER[digit] for digit in str(_lowerCamelCase ) ) def lowercase_ ( ) -> int: '''simple d...
646
"""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
1
"""simple docstring""" import os import tempfile import unittest import uuid from pathlib import Path from transformers.testing_utils import get_tests_dir, require_soundfile, require_torch, require_vision from transformers.tools.agent_types import AgentAudio, AgentImage, AgentText from transformers.utils import i...
646
"""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
1
"""simple docstring""" import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging __A = logging.get_logger(__name__) def lowercase_ ( _lowerCamelCase: int , _lowerCamelCase: Tup...
646
"""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
1
"""simple docstring""" def lowercase_ ( _lowerCamelCase: str ) -> bool: '''simple docstring''' if not all(x.isalpha() for x in string ): raise ValueError("String must only contain alphabetic characters." ) __lowerCamelCase : Dict = sorted(string.low...
646
"""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
1
"""simple docstring""" import pickle import numpy as np from matplotlib import pyplot as plt class _snake_case : def __init__( self : List[Any] , UpperCAmelCase : Tuple , UpperCAmelCase : List[Any] , UpperCAmelCase : List[Any] , ...
646
"""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
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''google/mobilenet_v2_1.4_...
646
"""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
1
"""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
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __A = { '''configuration_encodec''': [ '''ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''EncodecConfig''', ], '''feature_ext...
646
"""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
1
"""simple docstring""" from math import ceil, sqrt def lowercase_ ( _lowerCamelCase: int = 1000000 ) -> int: '''simple docstring''' __lowerCamelCase : Dict = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: ...
646
"""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
1
"""simple docstring""" import unittest from transformers import MobileBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigT...
646
"""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
1
"""simple docstring""" from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, sl...
646
"""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
1
"""simple docstring""" from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_torch_available(): ...
646
"""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
1
"""simple docstring""" from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class _snake_case ( yaml.SafeLoader ): def lowerCamelCase__ ( self : Dict , UpperCAmelCase : Optional[int] ): __lo...
646
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A = { '''configuration_upernet''': ['''UperNetConfig'''], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except Optional...
646
"""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
1
"""simple docstring""" 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 Conf...
646
"""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
1
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int ) -> int: '''simple docstring''' if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise ValueError("multiplicative_persistence() only accepts integral values" ) if num < 0: rai...
646
"""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
1
"""simple docstring""" from __future__ import annotations def lowercase_ ( _lowerCamelCase: list[int | str] ) -> None: '''simple docstring''' create_state_space_tree(_lowerCamelCase , [] , 0 , [0 for i in range(len(_lowerCamelCase ) )] ) def lowercase_ ( _lowerCame...
646
"""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
1
"""simple docstring""" import logging import os from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union from filelock import FileLock from transformers import PreTrainedTokenizer, is_tf_available, is_torch_available __A = logging.getLogger(__name__) @dataclass class...
646
"""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
1
"""simple docstring""" import re def lowercase_ ( _lowerCamelCase: str ) -> bool: '''simple docstring''' __lowerCamelCase : List[Any] = re.compile(r"^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$" ) if match := re.search(_lowerCamelCase , _lowerCamelCase ): ...
646
"""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
1
"""simple docstring""" import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, ...
646
"""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
1
"""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_sen...
646
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __A = { '''configuration_transfo_xl''': ['''TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TransfoXLConfig'''], '''tokenization_transfo_xl'''...
646
"""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
1
"""simple docstring""" import random from .binary_exp_mod import bin_exp_mod def lowercase_ ( _lowerCamelCase: Tuple , _lowerCamelCase: str=1000 ) -> Dict: '''simple docstring''' if n < 2: return False if n % 2 == 0: return n == 2 ...
646
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __A = {'''configuration_vit_mae''': ['''VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMAEConfig''']} tr...
646
"""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
1
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from transformers.utils i...
646
"""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
1
"""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_infos.jso...
646
"""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
1
"""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 lowercase_ ( _lowerCamelCase: str ) -> Dict: ''...
646
"""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
1
"""simple docstring""" import argparse import torch from transformers import OpenAIGPTConfig, OpenAIGPTModel, load_tf_weights_in_openai_gpt from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowercase_ ( _lowerCamelCase: Optional[int] , _lowerCamelCase...
646
"""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
1
"""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
"""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
1
"""simple docstring""" import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils import cached_...
646
"""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
1
"""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_logger(__name__) __A = {'''v...
646
"""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
1
"""simple docstring""" import argparse import struct import unittest class _snake_case : def __init__( self : Optional[int] , UpperCAmelCase : bytes ): __lowerCamelCase : Dict = data # Initialize hash values __lowerC...
646
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A = { '''configuration_blenderbot''': [ '''BLENDERBOT_PRETRAINE...
646
"""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
1
"""simple docstring""" __A = 65521 def lowercase_ ( _lowerCamelCase: str ) -> int: '''simple docstring''' __lowerCamelCase : Dict = 1 __lowerCamelCase : Union[str, Any] = 0 for plain_chr in plain_text: __lowerCamelCase : Tup...
646
"""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
1
"""simple docstring""" from cva import destroyAllWindows, imread, imshow, waitKey def lowercase_ ( _lowerCamelCase: Any ) -> Optional[Any]: '''simple docstring''' __lowerCamelCase , __lowerCamelCase : int = img.shape[0], img.shape[1] # converting each pixel's color...
646
"""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
1
"""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
"""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
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor...
646
"""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
1
"""simple docstring""" import math import sys import cva import numpy as np def lowercase_ ( _lowerCamelCase: np.ndarray , _lowerCamelCase: float ) -> np.ndarray: '''simple docstring''' __lowerCamelCase : int = math.sqrt(_lowerCamelCase ) __lowerCamelCase...
646
"""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
1
"""simple docstring""" 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 Tokeni...
646
"""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
1
"""simple docstring""" import unittest from transformers import MPNetConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask fr...
646
"""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
1
"""simple docstring""" import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin __A = get_tests_dir('''fixtures/test_sentencepiece_with_bytefall...
646
"""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
1
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .to...
646
"""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
1
"""simple docstring""" import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_atten...
646
"""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
1
"""simple docstring""" import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class _snake_case ( unittest.TestCase ): snake_case__ = ...
646
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __A = { '''configuration_conditional_detr''': [ '''CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ConditionalDetrConfig...
646
"""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
1
"""simple docstring""" import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae_...
646
"""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
1
"""simple docstring""" import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer __A = logging.getLogger(__name__) def lowercase_ ( ) -> str: '''simple docstring''' __lowerCamelCase : Tuple = argparse.ArgumentP...
646
"""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
1
"""simple docstring""" import math def lowercase_ ( _lowerCamelCase: int = 100 ) -> int: '''simple docstring''' __lowerCamelCase : Optional[Any] = sum(i * i for i in range(1 , n + 1 ) ) __lowerCamelCase : Optional[Any] = int(math.pow(sum(range(1 ...
646
"""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
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''EleutherAI/gpt-neox-20b''': '''https://huggingface.co/EleutherAI/gpt-neox-20b/resolve/main/config.json''', # See all GPTNeoX models at https://hug...
646
"""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
1
"""simple docstring""" from string import ascii_uppercase __A = {char: i for i, char in enumerate(ascii_uppercase)} __A = dict(enumerate(ascii_uppercase)) def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: str ) -> str: '''simple docstring''' __lowerCamelCase ...
646
"""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
1
"""simple docstring""" import enum import shutil import sys __A, __A = shutil.get_terminal_size() __A = {'''UP''': '''A''', '''DOWN''': '''B''', '''RIGHT''': '''C''', '''LEFT''': '''D'''} class _snake_case ( enum.Enum ): snake_case__ = 0 snake_case__ = 1 d...
646
"""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
1
"""simple docstring""" from __future__ import annotations from collections.abc import Callable def lowercase_ ( _lowerCamelCase: Callable[[int | float], int | float] , _lowerCamelCase: int | float , _lowerCamelCase: int | float , _lowerCamelCase: int = 100 , ) -> float: ...
646
"""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
1
"""simple docstring""" from math import factorial def lowercase_ ( _lowerCamelCase: int = 20 ) -> int: '''simple docstring''' __lowerCamelCase : Optional[int] = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... __lowerC...
646
"""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
1
"""simple docstring""" import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __A = '''\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, title = {BLEU: a Method for Au...
646
"""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
1
"""simple docstring""" from math import sqrt def lowercase_ ( _lowerCamelCase: int = 1000000 ) -> int: '''simple docstring''' __lowerCamelCase : int = 0 __lowerCamelCase : int = 0 __lowerCamelCase : int while num_cuboids <= limit: ...
646
"""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
1
"""simple docstring""" from decimal import Decimal, getcontext from math import ceil, factorial def lowercase_ ( _lowerCamelCase: int ) -> str: '''simple docstring''' if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("Undefined for non-integer...
646
"""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
1
"""simple docstring""" from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar __A = TypeVar('''T''') __A = TypeVar('''U''') class _snake_case ( Generic[T, U] ): def __init__( self : Any , UpperCAmelCase : ...
646
"""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
1
"""simple docstring""" import json import os import shutil import warnings from argparse import ArgumentParser, Namespace from pathlib import Path from typing import List from ..utils import logging from . import BaseTransformersCLICommand try: from cookiecutter.main import cookiecutter __A = True ...
646
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available __A = {'''tokenization_herbert''': ['''HerbertTokenizer''']} try: if not is_tokenizers_available(): raise OptionalDependencyNotAvailable() except Opt...
646
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __A = {'''configuration_deit''': ['''DEIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''DeiTConfig''', '''DeiTOnn...
646
"""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
1
"""simple docstring""" import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class _snake_case ( a__ ): snake_case__ ...
646
"""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
1
"""simple docstring""" import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets __A = '''\ @inproceedings{popovic-2015-chrf, title = "chr{F}: character n-gram {F}-score for automatic {MT} evaluation", author = "Popovi{\'c}, Maja", booktitle = "Proceedings ...
646
"""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
1
"""simple docstring""" class _snake_case : def __init__( self : int , UpperCAmelCase : list[int] ): __lowerCamelCase : Optional[int] = len(UpperCAmelCase ) __lowerCamelCase : int = [0] * len_array if le...
646
"""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
1
"""simple docstring""" import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() __A = logging.get_logger('''transformers.models.speecht5''') def lowercase_ ( _lowerCamelCase: Any , _lowerCamelCase: ...
646
"""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
1
"""simple docstring""" 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_...
646
"""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
1
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int , _lowerCamelCase: int ) -> int: '''simple docstring''' return int((input_a, input_a).count(0 ) == 0 ) def lowercase_ ( ) -> None: '''simple docstring''' assert and_gate(0 , 0 ) == 0...
646
"""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
1
"""simple docstring""" import datasets from .evaluate import evaluate __A = '''\ @article{hendrycks2021cuad, title={CUAD: An Expert-Annotated NLP Dataset for Legal Contract Review}, author={Dan Hendrycks and Collin Burns and Anya Chen and Spencer Ball}, journal={arXiv preprint arXiv:2103.0...
646
"""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
1
"""simple docstring""" import random import unittest import torch from diffusers import IFInpaintingSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_pa...
646
"""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
1
"""simple docstring""" import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from pathlib...
646
"""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
1