code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=UpperCAmelCase__ ) class __a (UpperCAmelCase__ ): __a : int = field(defau...
710
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int = 10, SCREAMING_SNAKE_CASE__ : int = 22 ) -> int: UpperCAmelCase_ : Optional[int] = range(1, SCREAMING_SNAKE_CASE__ ) UpperCAmelCase_ : List[Any] = ra...
644
0
'''simple docstring''' class __a : def __init__( self : List[Any] ) -> Tuple: """simple docstring""" UpperCAmelCase_ : List[str] = {} # Mapping from char to TrieNode UpperCAmelCase_ : Optio...
711
'''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/LIC...
644
0
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils imp...
712
'''simple docstring''' from collections.abc import Iterable from typing import Any class __a : def __init__( self : Optional[Any] , __magic_name__ : int | None = None ) -> Tuple: """simple docstring""" Uppe...
644
0
import argparse import torch from transformers import RemBertConfig, RemBertModel, load_tf_weights_in_rembert from transformers.utils import logging logging.set_verbosity_info() def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : Optional[int], SCREAMING_SNAKE_CASE__ : List[Any], ...
713
'''simple docstring''' import sys import turtle def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : tuple[float, float], SCREAMING_SNAKE_CASE__ : tuple[float, float] ) -> tuple[float, float]: return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def lowerCamelCase...
644
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 timm import create_model from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import BitConfig...
714
'''simple docstring''' import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device snake_case_ : List[str] = False class _...
644
0
'''simple docstring''' from __future__ import annotations import numpy as np def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : List[Any] ) -> int: return np.maximum(0, SCREAMING_SNAKE_CASE_ ) if __name__ == "__main__": print(np.array(relu([-1, 0, 5]))) # --> [0, 0...
715
'''simple docstring''' snake_case_ : int = { "Pillow": "Pillow", "accelerate": "accelerate>=0.11.0", "compel": "compel==0.1.8", "black": "black~=23.1", "datasets": "datasets", "filelock": "filelock", "flax": "flax>=0.4.1", "hf-doc-builder": "hf-doc-builder>=0...
644
0
'''simple docstring''' import logging import os from dataclasses import dataclass from typing import List, Optional, Union import tqdm from filelock import FileLock from transformers import ( BartTokenizer, BartTokenizerFast, DataProcessor, PreTrainedTokenizer, RobertaTokenizer, R...
716
'''simple docstring''' import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __a (unittest.Te...
644
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_donut import DonutImageProcessor snake_case_ : List[Any] = logging.get_logger(__name__) class __a (UpperCamelCase__ ): def __init__( self : Dict , ...
717
'''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/LIC...
644
0
'''simple docstring''' class __a : def __init__( self : Dict , __magic_name__ : int ) -> List[str]: """simple docstring""" UpperCAmelCase_ : Tuple = n UpperCAmelCase_ : List...
718
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int, SCREAMING_SNAKE_CASE__ : int ) -> int: return abs(SCREAMING_SNAKE_CASE__ ) if a == 0 else greatest_common_divisor(b % a, SCREAMING_SNAKE_CASE__ ) def lowerCamelCase_ ( SCR...
644
0
'''simple docstring''' import os import re from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging snake_case_ : List[Any] = logging.get_log...
719
'''simple docstring''' import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_co...
644
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case_ : List[str] = {'configuration_xlnet': ['XLNET_PRETRAINED_CONFIG_AR...
720
'''simple docstring''' import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging snake_case_ : str = logging.get_logger(__name__) snake_case_ ...
644
0
'''simple docstring''' from __future__ import annotations def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : list[int] ) -> Tuple: return len(set(_UpperCamelCase ) ) == len(_UpperCamelCase ) if __name__ == "__main__": import doctest doctest.testmod()
721
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int ) -> str: if number > 0: raise ValueError('''input must be a negative integer''' ) UpperCAmelCase_ : Union[str, Any] = len(bin(SCREAMING_SNAKE_CASE__ )[3:] ) ...
644
0
import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepie...
700
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class __a (unittest.TestCase )...
644
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case_ : Union[str, Any] = logging.get_logger(__name__) snake_case_ : Dict...
701
'''simple docstring''' import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": snake_case_ : List[Any] = pd.read_csv("sample_data.csv...
644
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 ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification...
702
'''simple docstring''' from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, ...
644
0
'''simple docstring''' from __future__ import annotations from collections.abc import Callable from typing import Any, Generic, TypeVar snake_case_ : List[str] = TypeVar("T") class __a (Generic[T] ): def __init__( self : int ...
703
'''simple docstring''' import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set...
644
0
import gc import unittest from transformers import MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, FillMaskPipeline, pipeline from transformers.pipelines import PipelineException from transformers.testing_utils import ( is_pipeline_test, is_torch_available, nested_simplify, require_t...
704
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : list[int] ) -> list[list[int]]: UpperCAmelCase_ : int = [] if len(SCREAMING_SNAKE_CASE__ ) == 1: return [nums.copy()] for _ in range(len(SCREAMING_SNAKE_CASE__ ) ...
644
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available snake_case_ : Tuple = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDepen...
705
'''simple docstring''' class __a : def __init__( self : List[Any] , __magic_name__ : int ) -> None: """simple docstring""" UpperCAmelCase_ : Optional[Any] = size UpperCAmelCase_...
644
0
'''simple docstring''' import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class __a (lowerCamelCase ): __a : str = (UnCLIPScheduler,) def UpperCAmelCase__ ( self : Optional[int] ,...
706
'''simple docstring''' import math import unittest from transformers import BioGptConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...te...
644
0
'''simple docstring''' from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : Tuple ) -> Optional[Any]: if not is_accelerate_available(): ...
707
'''simple docstring''' import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class __a (lowerCamelCase , ...
644
0
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : Dict ) -> int: if not isinstance(__UpperCamelCase, __UpperCamelCase ) or number < 0: raise ValueError('''Input must be a non-negative integer''' ) UpperCAmelCase_ : Optional[Any...
708
'''simple docstring''' import unittest import torch from torch import nn from diffusers.models.activations import get_activation class __a (unittest.TestCase ): def UpperCAmelCase__ ( self : Dict ) -> Dict: """simple docstring"""...
644
0
'''simple docstring''' from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType cla...
709
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PI...
644
0
'''simple docstring''' import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @re...
710
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int = 10, SCREAMING_SNAKE_CASE__ : int = 22 ) -> int: UpperCAmelCase_ : Optional[int] = range(1, SCREAMING_SNAKE_CASE__ ) UpperCAmelCase_ : List[Any] = ra...
644
0
'''simple docstring''' snake_case_ : List[str] = range(2, 20 + 1) snake_case_ : Optional[Any] = [10**k for k in range(ks[-1] + 1)] snake_case_ : dict[int, dict[int, list[list[int]]]] = {} def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__...
711
'''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/LIC...
644
0
'''simple docstring''' from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available()...
712
'''simple docstring''' from collections.abc import Iterable from typing import Any class __a : def __init__( self : Optional[Any] , __magic_name__ : int | None = None ) -> Tuple: """simple docstring""" Uppe...
644
0
from __future__ import annotations from collections.abc import Callable from typing import Any, Generic, TypeVar snake_case_ : List[str] = TypeVar("T") class __a (Generic[T] ): def __init__( self : Optional[int] , __magic_name__ : Optio...
713
'''simple docstring''' import sys import turtle def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : tuple[float, float], SCREAMING_SNAKE_CASE__ : tuple[float, float] ) -> tuple[float, float]: return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def lowerCamelCase...
644
0
from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig 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_com...
714
'''simple docstring''' import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device snake_case_ : List[str] = False class _...
644
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available snake_case_ : str = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDep...
715
'''simple docstring''' snake_case_ : int = { "Pillow": "Pillow", "accelerate": "accelerate>=0.11.0", "compel": "compel==0.1.8", "black": "black~=23.1", "datasets": "datasets", "filelock": "filelock", "flax": "flax>=0.4.1", "hf-doc-builder": "hf-doc-builder>=0...
644
0
'''simple docstring''' from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forw...
716
'''simple docstring''' import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __a (unittest.Te...
644
0
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn...
717
'''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/LIC...
644
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available snake_case_ : Dict = { "configuration_biogpt": ["BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BioGptConfig"], "tokenizatio...
718
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int, SCREAMING_SNAKE_CASE__ : int ) -> int: return abs(SCREAMING_SNAKE_CASE__ ) if a == 0 else greatest_common_divisor(b % a, SCREAMING_SNAKE_CASE__ ) def lowerCamelCase_ ( SCR...
644
0
'''simple docstring''' from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record snake_case_ : Tuple = "\\n@article{wang2019superglue,\n title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understa...
719
'''simple docstring''' import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_co...
644
0
import os import pytest from attr import dataclass snake_case_ : Union[str, Any] = 'us-east-1' # defaults region @dataclass class __a : __a : str __a : Any = '''arn:aws:iam::558105141721:role/sagemaker_execution_role''' __a : Tup...
720
'''simple docstring''' import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging snake_case_ : str = logging.get_logger(__name__) snake_case_ ...
644
0
'''simple docstring''' from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature...
721
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int ) -> str: if number > 0: raise ValueError('''input must be a negative integer''' ) UpperCAmelCase_ : Union[str, Any] = len(bin(SCREAMING_SNAKE_CASE__ )[3:] ) ...
644
0
import random def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int, SCREAMING_SNAKE_CASE__ : float, SCREAMING_SNAKE_CASE__ : bool = False ) -> Union[str, Any]: UpperCAmelCase_ : str = {i: [] for i in range(_lowerCamelCase )} # if probabil...
700
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class __a (unittest.TestCase )...
644
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available snake_case_ : Dict = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""...
701
'''simple docstring''' import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": snake_case_ : List[Any] = pd.read_csv("sample_data.csv...
644
0
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : float, SCREAMING_SNAKE_CASE__ : float, SCREAMING_SNAKE_CASE__ : float, SCREAMING_SNAKE_CASE__ : float, SCREAMING_SNAKE_CASE__ : float, ) -> float: UpperCAmelCase_ : A...
702
'''simple docstring''' from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, ...
644
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available snake_case_ : Dict = { "configuration_rag": ["RagConfig"], "retrieval_rag": ["RagRetriever"], "t...
703
'''simple docstring''' import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set...
644
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case_ : Union[str, Any] = { "configuration_blenderbot_small": [ "BLEN...
704
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : list[int] ) -> list[list[int]]: UpperCAmelCase_ : int = [] if len(SCREAMING_SNAKE_CASE__ ) == 1: return [nums.copy()] for _ in range(len(SCREAMING_SNAKE_CASE__ ) ...
644
0
'''simple docstring''' import argparse from collections import defaultdict import yaml snake_case_ : int = "docs/source/en/_toctree.yml" def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : Union[str, Any] ) -> str: UpperCAmelCase_ : List[Any] = ...
705
'''simple docstring''' class __a : def __init__( self : List[Any] , __magic_name__ : int ) -> None: """simple docstring""" UpperCAmelCase_ : Optional[Any] = size UpperCAmelCase_...
644
0
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) snake_case_ : str = pytest.mark.integration @pytest.mark.p...
706
'''simple docstring''' import math import unittest from transformers import BioGptConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...te...
644
0
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase : List[Any] = logging.get_logger(__name__) lowerCamelCase : Union[str, Any] = { "Salesforce/blip-vqa-...
707
'''simple docstring''' import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class __a (lowerCamelCase , ...
644
0
'''simple docstring''' snake_case_ : str = "2.13.1" import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version.parse("3.7"): raise ImportWarning( "To use `datasets`, Python>=3.7 is required, and the current version ...
708
'''simple docstring''' import unittest import torch from torch import nn from diffusers.models.activations import get_activation class __a (unittest.TestCase ): def UpperCAmelCase__ ( self : Dict ) -> Dict: """simple docstring"""...
644
0
'''simple docstring''' import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def lowerCamelCase_ ...
709
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PI...
644
0
'''simple docstring''' import collections import importlib.util import os import re from pathlib import Path snake_case_ = 'src/transformers' # Matches is_xxx_available() snake_case_ = re.compile(r"is\_([a-z_]*)_available()") # Catches a one-line _import_struct = {xxx} snake_case_ = r...
710
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int = 10, SCREAMING_SNAKE_CASE__ : int = 22 ) -> int: UpperCAmelCase_ : Optional[int] = range(1, SCREAMING_SNAKE_CASE__ ) UpperCAmelCase_ : List[Any] = ra...
644
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : Union[str, Any] = logging.get_logger(__name__) snake_case_ : List[Any] = { '''tanreinama/GPTSAN-2.8B-spout_is_uniform''': ( '''https://h...
711
'''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/LIC...
644
0
'''simple docstring''' import logging import math from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union import torch from .tensor_utils import tensor_tree_map, tree_map def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : ...
712
'''simple docstring''' from collections.abc import Iterable from typing import Any class __a : def __init__( self : Optional[Any] , __magic_name__ : int | None = None ) -> Tuple: """simple docstring""" Uppe...
644
0
import warnings from ...utils import is_sklearn_available, requires_backends if is_sklearn_available(): from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef snake_case_ : Optional[int] = ( "This metric will be removed from the libra...
713
'''simple docstring''' import sys import turtle def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : tuple[float, float], SCREAMING_SNAKE_CASE__ : tuple[float, float] ) -> tuple[float, float]: return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def lowerCamelCase...
644
0
import builtins import sys from ...utils.imports import _is_package_available from . import cursor, input from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor from .keymap import KEYMAP snake_case_ : List[str] = False try: snake_case_ ...
714
'''simple docstring''' import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device snake_case_ : List[str] = False class _...
644
0
'''simple docstring''' from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_...
715
'''simple docstring''' snake_case_ : int = { "Pillow": "Pillow", "accelerate": "accelerate>=0.11.0", "compel": "compel==0.1.8", "black": "black~=23.1", "datasets": "datasets", "filelock": "filelock", "flax": "flax>=0.4.1", "hf-doc-builder": "hf-doc-builder>=0...
644
0
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int ) -> int: return 1 if digit in (0, 1) else (digit * factorial(digit - 1 )) def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : Dict ) -> bool: UpperCAmelCase_ : Optiona...
716
'''simple docstring''' import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __a (unittest.Te...
644
0
'''simple docstring''' from __future__ import annotations from typing import Generic, TypeVar snake_case_ : int = TypeVar("T") class __a (Generic[T] ): def __init__( self : List[str] , __magic_name__ : int ) -> None: ...
717
'''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/LIC...
644
0
'''simple docstring''' import argparse from collections import OrderedDict from pathlib import Path import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision.transforms import functional as F from transformers import DetrImageProcessor, TableTransformerConfig, TableTran...
718
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int, SCREAMING_SNAKE_CASE__ : int ) -> int: return abs(SCREAMING_SNAKE_CASE__ ) if a == 0 else greatest_common_divisor(b % a, SCREAMING_SNAKE_CASE__ ) def lowerCamelCase_ ( SCR...
644
0
'''simple docstring''' import jax.numpy as jnp from ...utils import logging from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel from .configuration_mta import MTaConfig snake_case_ : Optional[Any] = logging.get_logger(__name__) snake_case_ ...
719
'''simple docstring''' import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_co...
644
0
def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int, SCREAMING_SNAKE_CASE__ : int ) -> List[str]: return abs(__a ) if a == 0 else greatest_common_divisor(b % a, __a ) def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int, SCREAMING_SNAKE_CASE__ ...
720
'''simple docstring''' import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging snake_case_ : str = logging.get_logger(__name__) snake_case_ ...
644
0
'''simple docstring''' from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : bool = True, *SCREAMING_SNAKE_CASE__ : Optional[int], **SCREAMING...
721
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int ) -> str: if number > 0: raise ValueError('''input must be a negative integer''' ) UpperCAmelCase_ : Union[str, Any] = len(bin(SCREAMING_SNAKE_CASE__ )[3:] ) ...
644
0
import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home snake_case_ : int = HUGGINGFACE_HUB_CACHE snake_case_ : str = "config.json" snake_case_ : Union[str, Any] = "diffusion_pytorch_model.bin" snake_case_ : Union[str, Any...
700
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class __a (unittest.TestCase )...
644
0
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import ...
701
'''simple docstring''' import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": snake_case_ : List[Any] = pd.read_csv("sample_data.csv...
644
0
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int = 50 ) -> str: UpperCAmelCase_ : Union[str, Any] = [1] * (length + 1) for row_length in range(3, length + 1 ): for block_length in range(3, row_length + 1 ): ...
702
'''simple docstring''' from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, ...
644
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case_ : Any = { "configuration_lxmert": ["LX...
703
'''simple docstring''' import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set...
644
0
import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configuration_pegasus import DEFAULTS, task_specific_pa...
704
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : list[int] ) -> list[list[int]]: UpperCAmelCase_ : int = [] if len(SCREAMING_SNAKE_CASE__ ) == 1: return [nums.copy()] for _ in range(len(SCREAMING_SNAKE_CASE__ ) ...
644
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : Dict = logging.get_logger(__name__) snake_case_ : int = { "google/switch-base-8": "https://huggingface.co/google/switch-base-8/blob/main/config.json", } ...
705
'''simple docstring''' class __a : def __init__( self : List[Any] , __magic_name__ : int ) -> None: """simple docstring""" UpperCAmelCase_ : Optional[Any] = size UpperCAmelCase_...
644
0
'''simple docstring''' from collections.abc import Sequence def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : Sequence[int] | None = None ) -> int: if nums is None or not nums: raise ValueError('''Input sequence should not be empty''' ) UpperCAmelCase...
706
'''simple docstring''' import math import unittest from transformers import BioGptConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...te...
644
0
'''simple docstring''' class __a : def __init__( self : Dict ) -> str: """simple docstring""" UpperCAmelCase_ : str = '''''' UpperCAmelCase_ : List[Any] = '''''' Uppe...
707
'''simple docstring''' import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class __a (lowerCamelCase , ...
644
0
'''simple docstring''' from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import I...
708
'''simple docstring''' import unittest import torch from torch import nn from diffusers.models.activations import get_activation class __a (unittest.TestCase ): def UpperCAmelCase__ ( self : Dict ) -> Dict: """simple docstring"""...
644
0
'''simple docstring''' from datetime import datetime as dt import os from github import Github snake_case_ : Optional[int] = [ "good first issue", "good second issue", "good difficult issue", "feature request", "new model", "wip", ] def lowerCamelCase_...
709
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PI...
644
0
'''simple docstring''' import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __a (unittest.TestCase ...
710
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int = 10, SCREAMING_SNAKE_CASE__ : int = 22 ) -> int: UpperCAmelCase_ : Optional[int] = range(1, SCREAMING_SNAKE_CASE__ ) UpperCAmelCase_ : List[Any] = ra...
644
0
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LIC...
711
'''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/LIC...
644
0
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging snake_case_ : str = logging.get_...
712
'''simple docstring''' from collections.abc import Iterable from typing import Any class __a : def __init__( self : Optional[Any] , __magic_name__ : int | None = None ) -> Tuple: """simple docstring""" Uppe...
644
0
from __future__ import annotations import typing from collections import Counter def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int ) -> typing.Counter[int]: UpperCAmelCase_ : typing.Counter[int] = Counter() for base in range(1, max_perimeter + 1 ): ...
713
'''simple docstring''' import sys import turtle def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : tuple[float, float], SCREAMING_SNAKE_CASE__ : tuple[float, float] ) -> tuple[float, float]: return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def lowerCamelCase...
644
0
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=_a ) class __a (_a ): __a : Dict = field(default="question-answering-extractive" , met...
714
'''simple docstring''' import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device snake_case_ : List[str] = False class _...
644
0
'''simple docstring''' import json import logging import os import socket import git import numpy as np import torch logging.basicConfig( format="%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s", datefmt="%m/%d/%Y %H:%M:%S", level=logging.INFO, ) snake_case_ : ...
715
'''simple docstring''' snake_case_ : int = { "Pillow": "Pillow", "accelerate": "accelerate>=0.11.0", "compel": "compel==0.1.8", "black": "black~=23.1", "datasets": "datasets", "filelock": "filelock", "flax": "flax>=0.4.1", "hf-doc-builder": "hf-doc-builder>=0...
644
0
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int ) -> bool: if not isinstance(_UpperCamelCase, _UpperCamelCase ): UpperCAmelCase_ : Tuple = F"""Input value of [number={number}] must be an integer""" rai...
716
'''simple docstring''' import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __a (unittest.Te...
644
0
'''simple docstring''' from __future__ import annotations import math class __a : def __init__( self : int , __magic_name__ : Optional[Any] ) -> Dict: """simple docstring""" UpperCAmelCase_ : Option...
717
'''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/LIC...
644
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available snake_case_ : Optional[int] = { "configuration_rag": ["RagConfig"], "retrieval_rag": ["RagRetriever"], "tokenization_rag"...
718
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int, SCREAMING_SNAKE_CASE__ : int ) -> int: return abs(SCREAMING_SNAKE_CASE__ ) if a == 0 else greatest_common_divisor(b % a, SCREAMING_SNAKE_CASE__ ) def lowerCamelCase_ ( SCR...
644
0
'''simple docstring''' from typing import List import numpy as np def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : dict ) -> int: UpperCAmelCase_ : Tuple = {key: len(snake_case_ ) for key, value in gen_kwargs.items() if isinstance(snake_case_, snake_cas...
719
'''simple docstring''' import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_co...
644
0
# This model implementation is heavily inspired by https://github.com/haofanwang/ControlNet-for-Diffusers/ import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( ...
720
'''simple docstring''' import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging snake_case_ : str = logging.get_logger(__name__) snake_case_ ...
644
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : Optional[Any] = logging.get_logger(__name__) snake_case_ : str = { "s-JoL/Open-Llama-V1": "https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config...
721
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int ) -> str: if number > 0: raise ValueError('''input must be a negative integer''' ) UpperCAmelCase_ : Union[str, Any] = len(bin(SCREAMING_SNAKE_CASE__ )[3:] ) ...
644
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 snake_case_ : Optional[Any] = logging.get_logger(__name__) snake_case_ : Tuple...
700
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class __a (unittest.TestCase )...
644
0
'''simple docstring''' import unittest import torch from torch import nn from diffusers.models.activations import get_activation class __a (unittest.TestCase ): def UpperCAmelCase__ ( self : Dict ) -> Dict: """simple docstring"""...
701
'''simple docstring''' import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": snake_case_ : List[Any] = pd.read_csv("sample_data.csv...
644
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) snake_case_ : Tuple = {"configuration_unispeech": ["UNISPEECH_PRETRAINED_CONFIG_ARCHIV...
702
'''simple docstring''' from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, ...
644
0
'''simple docstring''' import operator as op def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : Optional[int] ) -> Dict: UpperCAmelCase_ : int = [] UpperCAmelCase_ : Optional[Any] = lambda SCREAMING_SNAKE_CASE__, ...
703
'''simple docstring''' import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set...
644
0
def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int ) -> str: if number > 0: raise ValueError('''input must be a negative integer''' ) UpperCAmelCase_ : Union[str, Any] = len(bin(SCREAMING_SNAKE_CASE__ )[3:] ) UpperCAmelCase_ : Unio...
704
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : list[int] ) -> list[list[int]]: UpperCAmelCase_ : int = [] if len(SCREAMING_SNAKE_CASE__ ) == 1: return [nums.copy()] for _ in range(len(SCREAMING_SNAKE_CASE__ ) ...
644
0
'''simple docstring''' import io import itertools import json from dataclasses import dataclass from typing import Optional import pyarrow as pa import pyarrow.json as paj import datasets from datasets.table import table_cast from datasets.utils.file_utils import readline snake_case_ : Dict ...
705
'''simple docstring''' class __a : def __init__( self : List[Any] , __magic_name__ : int ) -> None: """simple docstring""" UpperCAmelCase_ : Optional[Any] = size UpperCAmelCase_...
644
0
'''simple docstring''' import argparse import json import os from tensorflow.core.protobuf.saved_model_pba import SavedModel # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py snake_case_ : Optional[Any] ...
706
'''simple docstring''' import math import unittest from transformers import BioGptConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...te...
644
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase : Tuple = { "configuration_roberta": [...
707
'''simple docstring''' import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class __a (lowerCamelCase , ...
644
0
'''simple docstring''' from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 snake_case_ : List[str] = { # 1536-bit 5: ...
708
'''simple docstring''' import unittest import torch from torch import nn from diffusers.models.activations import get_activation class __a (unittest.TestCase ): def UpperCAmelCase__ ( self : Dict ) -> Dict: """simple docstring"""...
644
0
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow if is_torch_available(): import torch from transformers import XLMRobertaModel @require_sentencepiece @req...
709
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PI...
644
0
'''simple docstring''' import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging snake_case_ = logging.get_logger(__name__) def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int ...
710
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int = 10, SCREAMING_SNAKE_CASE__ : int = 22 ) -> int: UpperCAmelCase_ : Optional[int] = range(1, SCREAMING_SNAKE_CASE__ ) UpperCAmelCase_ : List[Any] = ra...
644
0
'''simple docstring''' import torch from torch import nn from transformers import CLIPPreTrainedModel, CLIPVisionModel from ...models.attention import BasicTransformerBlock from ...utils import logging snake_case_ : Optional[Any] = logging.get_logger(__name__) # pylint: disable=inval...
711
'''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/LIC...
644
0
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int ) -> str: if isinstance(SCREAMING_SNAKE_CASE__, SCREAMING_SNAKE_CASE__ ): raise TypeError('''\'float\' object cannot be interpreted as an integer''' ) if isinstance(SCREAMING_S...
712
'''simple docstring''' from collections.abc import Iterable from typing import Any class __a : def __init__( self : Optional[Any] , __magic_name__ : int | None = None ) -> Tuple: """simple docstring""" Uppe...
644
0
import builtins import sys from ...utils.imports import _is_package_available from . import cursor, input from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor from .keymap import KEYMAP snake_case_ : Any = False try: snake_case_ : ...
713
'''simple docstring''' import sys import turtle def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : tuple[float, float], SCREAMING_SNAKE_CASE__ : tuple[float, float] ) -> tuple[float, float]: return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def lowerCamelCase...
644
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : str = logging.get_logger(__name__) snake_case_ : int = { "microsoft/wavlm-base": "https://huggingface.co/microsoft/wavlm-base/resolve/main/config....
714
'''simple docstring''' import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device snake_case_ : List[str] = False class _...
644
0
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : str ) -> str: return " ".join( ''''''.join(word[::-1] ) if len(SCREAMING_SNAKE_CASE__ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest docte...
715
'''simple docstring''' snake_case_ : int = { "Pillow": "Pillow", "accelerate": "accelerate>=0.11.0", "compel": "compel==0.1.8", "black": "black~=23.1", "datasets": "datasets", "filelock": "filelock", "flax": "flax>=0.4.1", "hf-doc-builder": "hf-doc-builder>=0...
644
0
'''simple docstring''' import torch from ..models.speechta import SpeechTaForTextToSpeech, SpeechTaHifiGan, SpeechTaProcessor from ..utils import is_datasets_available from .base import PipelineTool if is_datasets_available(): from datasets import load_dataset class __a (lowerCamelCase ...
716
'''simple docstring''' import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __a (unittest.Te...
644
0
'''simple docstring''' import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig snake_case_ : Any = logging.get_logger(__name__) class __a : d...
717
'''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/LIC...
644
0
'''simple docstring''' import unittest import numpy as np import requests from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inp...
718
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int, SCREAMING_SNAKE_CASE__ : int ) -> int: return abs(SCREAMING_SNAKE_CASE__ ) if a == 0 else greatest_common_divisor(b % a, SCREAMING_SNAKE_CASE__ ) def lowerCamelCase_ ( SCR...
644
0
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : str, SCREAMING_SNAKE_CASE__ : bool = False ) -> str: if not isinstance(SCREAMING_SNAKE_CASE__, SCREAMING_SNAKE_CASE__ ): UpperCAmelCase_ : Any = F"""Expected string ...
719
'''simple docstring''' import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_co...
644
0
import os def lowerCamelCase_ ( ) -> str: with open(os.path.dirname(SCREAMING_SNAKE_CASE__ ) + '''/p022_names.txt''' ) as file: UpperCAmelCase_ : Optional[int] = str(file.readlines()[0] ) UpperCAmelCase_ : Optional[int] = na...
720
'''simple docstring''' import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging snake_case_ : str = logging.get_logger(__name__) snake_case_ ...
644
0
'''simple docstring''' import os import re import shutil import sys import tempfile import unittest import black snake_case_ : Any = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_copies # ...
721
'''simple docstring''' def lowerCamelCase_ ( SCREAMING_SNAKE_CASE__ : int ) -> str: if number > 0: raise ValueError('''input must be a negative integer''' ) UpperCAmelCase_ : Union[str, Any] = len(bin(SCREAMING_SNAKE_CASE__ )[3:] ) ...
644
0