code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( DiffusionPipeline, UnCLIPImageV...
124
import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging if is_torch_available(): import torch ...
124
1
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) from ...
124
def lowerCAmelCase_ ( _snake_case : str , _snake_case : str ) -> float: '''simple docstring''' def get_matched_characters(_snake_case : str , _snake_case : str ) -> str: __magic_name__ : str = [] __magic_name__ : Optional[Any] = min(len...
124
1
import copy import inspect import unittest from transformers import PretrainedConfig, SwiftFormerConfig 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_co...
124
import unittest from transformers import XLMConfig, 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_common import ModelTesterMixin, ids_te...
124
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING snake_case : Optional[Any] = logging.get_logger(__name__) snak...
124
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_attention_mask from ...test_pipe...
124
1
def lowerCAmelCase_ ( _snake_case : int = 1000 ) -> int: '''simple docstring''' __magic_name__ , __magic_name__ : Optional[Any] = 1, 1 __magic_name__ : str = 2 while True: __magic_name__ : Union[str, Any] = 0 __magic_name_...
124
import os import numpy import onnx def lowerCAmelCase_ ( _snake_case : Tuple , _snake_case : int ) -> List[str]: '''simple docstring''' __magic_name__ : Dict = a.name __magic_name__ : Optional[Any] = b.name __magic_name__ : Opti...
124
1
from sklearn.metrics import recall_score import datasets snake_case : Optional[int] = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is the true positives and FN is the ...
124
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_full_determinis...
124
1
import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging snake_case : List[str] = logging.get_logge...
124
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCAmelCase_ ( _snake_case : int , _snake_case : Union[str, Any] ) ...
124
1
from __future__ import annotations snake_case : Optional[int] = [] def lowerCAmelCase_ ( _snake_case : list[list[int]] , _snake_case : int , _snake_case : int ) -> bool: '''simple docstring''' for i in range(len(_snake_case ) ): if board[row][i] == 1:...
124
from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDIMScheduler, DDPMScheduler...
124
1
from collections import defaultdict from math import ceil, sqrt def lowerCAmelCase_ ( _snake_case : int = 1000000 , _snake_case : int = 10 ) -> int: '''simple docstring''' __magic_name__ : defaultdict = defaultdict(_snake_case ) for outer_width in range(3 ...
124
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
124
1
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, TFAutoModelForSequenceCla...
124
import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils import logging if version.parse(fairseq.__vers...
124
1
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTRACTOR_MAPPING, AutoConfig, AutoFeatureExtractor, WavaVecaConfig, WavaVecaFeatureExtractor, ) from transformers.testing_utils import DUMMY_U...
124
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_utils import PILImageResampling f...
124
1
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(">=", "4.25.0")): raise OptionalDependencyNotAvailable() except Op...
124
import os import sys import unittest snake_case : List[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_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, find_...
124
1
import re import time from typing import Optional import IPython.display as disp from ..trainer_callback import TrainerCallback from ..trainer_utils import IntervalStrategy, has_length def lowerCAmelCase_ ( _snake_case : List[str] ) -> Optional[int]: '''simple docstring''' __ma...
124
from __future__ import annotations from typing import Any class _snake_case ( snake_case ): pass class _snake_case : def __init__( self , _a ): __magic_name__ : Any = data __magic_name__ : Node | None = None def __it...
124
1
from typing import Any class _snake_case : def __init__( self , _a ): __magic_name__ : Tuple = data __magic_name__ : Optional[int] = None def __repr__( self ): return f'''Node({self.data})''' class _snake_case :...
124
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTimestepEmbedding, FlaxT...
124
1
from __future__ import annotations import os from collections.abc import Mapping snake_case : List[str] = tuple[int, int] class _snake_case : def __init__( self , _a , _a ): __magic_name__ : set[int] = vertices __magic_name__ : dict[...
124
import requests def lowerCAmelCase_ ( _snake_case : str , _snake_case : str ) -> None: '''simple docstring''' __magic_name__ : Any = {"Content-Type": "application/json"} __magic_name__ : Optional[int] = requests.post(_snake_case , json={"te...
124
1
import os import zipfile import pytest from datasets.utils.extract import ( BzipaExtractor, Extractor, GzipExtractor, LzaExtractor, SevenZipExtractor, TarExtractor, XzExtractor, ZipExtractor, ZstdExtractor, ) from .utils import require_lza, require_pyazr, require_zstandard ...
124
import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(snake_case ) , 'Tatoeba dir...
124
1
import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class _snake_case ( snake_case ): def __init__( self , _a , _a , _a...
124
import math def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' if not isinstance(_snake_case , _snake_case ): __magic_name__ : str = F'''Input value of [number={number}] must be an integer''' raise TypeError(_snake_case ) if number ...
124
1
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 : Dict = False class _snake_case ( unittest.TestCase ): ...
124
from collections import defaultdict from math import ceil, sqrt def lowerCAmelCase_ ( _snake_case : int = 1000000 , _snake_case : int = 10 ) -> int: '''simple docstring''' __magic_name__ : defaultdict = defaultdict(_snake_case ) for outer_width in range(3 ...
124
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) snake_case : int = { "configuration_mega": ["MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP", "MegaConfig", "MegaOnnxConfig"], } try: if not is_torch_available(): ...
124
from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor snake_case : Optional[int] = ...
124
1
import random def lowerCAmelCase_ ( _snake_case : list , _snake_case : Union[str, Any] ) -> tuple: '''simple docstring''' __magic_name__ , __magic_name__ , __magic_name__ : Union[str, Any] = [], [], [] for element in data: if element < pivot:...
124
import itertools import os from collections import Counter, defaultdict from concurrent.futures import ThreadPoolExecutor, as_completed import numpy as np import datasets from .execute import check_correctness snake_case : int = "\\n@misc{chen2021evaluating,\n title={Evaluating Large Language...
124
1
from typing import Optional from torch import nn from .transformer_ad import TransformeraDModel, TransformeraDModelOutput class _snake_case ( nn.Module ): def __init__( self , _a = 16 , _a = 88 , _a = None , _a = 1 , _a = 0.0 , _a = 32 , _a = None , _a = False , _a = N...
124
import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger snake_case : Optional[int] = get_logger(__name__) snake_case : Union[str, Any] = R"\n Args:\n input_ids (`jnp.ndarray` ...
124
1
import math def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' if not isinstance(_snake_case , _snake_case ): __magic_name__ : str = F'''Input value of [number={number}] must be an integer''' raise TypeError(_snake_case ) if number ...
124
from typing import Dict from .base import GenericTensor, Pipeline class _snake_case ( snake_case ): def SCREAMING_SNAKE_CASE ( self , _a=None , _a=None , _a=None , **_a ): if tokenize_kwargs is None: __magic_name__ : Tuple = {} if tr...
124
1
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTimestepEmbedding, FlaxT...
124
import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging if is_torch_available(): import torch ...
124
1
import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokeniz...
124
def lowerCAmelCase_ ( _snake_case : str , _snake_case : str ) -> float: '''simple docstring''' def get_matched_characters(_snake_case : str , _snake_case : str ) -> str: __magic_name__ : str = [] __magic_name__ : Optional[Any] = min(len...
124
1
def lowerCAmelCase_ ( _snake_case : str , _snake_case : str ) -> float: '''simple docstring''' def get_matched_characters(_snake_case : str , _snake_case : str ) -> str: __magic_name__ : str = [] __magic_name__ : Optional[Any] = min(len...
124
import unittest from transformers import XLMConfig, 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_common import ModelTesterMixin, ids_te...
124
1
from typing import Dict import numpy as np import torch from . import residue_constants as rc from .tensor_utils import tensor_tree_map, tree_map def lowerCAmelCase_ ( _snake_case : Dict[str, torch.Tensor] ) -> Dict[str, torch.Tensor]: '''simple docstring''' __magic_name__ ...
124
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_attention_mask from ...test_pipe...
124
1
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
124
import os import numpy import onnx def lowerCAmelCase_ ( _snake_case : Tuple , _snake_case : int ) -> List[str]: '''simple docstring''' __magic_name__ : Dict = a.name __magic_name__ : Optional[Any] = b.name __magic_name__ : Opti...
124
1
import os def lowerCAmelCase_ ( _snake_case : str = "matrix.txt" ) -> int: '''simple docstring''' with open(os.path.join(os.path.dirname(_snake_case ) , _snake_case ) ) as in_file: __magic_name__ : str = in_file.read() __magic_name__ : int ...
124
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_full_determinis...
124
1
from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
124
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCAmelCase_ ( _snake_case : int , _snake_case : Union[str, Any] ) ...
124
1
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start_docstrings_to...
124
from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDIMScheduler, DDPMScheduler...
124
1
from math import sqrt def lowerCAmelCase_ ( _snake_case : int ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes...
124
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
124
1
from __future__ import annotations def lowerCAmelCase_ ( _snake_case : int | float | str , _snake_case : int | float | str ) -> list[str]: '''simple docstring''' if nth_term == "": return [""] __magic_name__ : Tuple = int(_snake_case ) __magic_name__ ...
124
import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils import logging if version.parse(fairseq.__vers...
124
1
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import SegformerImageProcessor, SwinConfig, UperNetConfig, UperNetForSemanticSegmentation def lowerCAmelCase_ ( _snake_case : Optional[Any] ) -> Tup...
124
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_utils import PILImageResampling f...
124
1
import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipel...
124
import os import sys import unittest snake_case : List[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_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, find_...
124
1
import argparse from collections import defaultdict import yaml snake_case : str = "docs/source/en/_toctree.yml" def lowerCAmelCase_ ( _snake_case : List[Any] ) -> Union[str, Any]: '''simple docstring''' __magic_name__ : str = defaultdict(_snak...
124
from __future__ import annotations from typing import Any class _snake_case ( snake_case ): pass class _snake_case : def __init__( self , _a ): __magic_name__ : Any = data __magic_name__ : Node | None = None def __it...
124
1
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[int] = logging.get_logger(__name__) snake_case : List[Any] ...
124
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTimestepEmbedding, FlaxT...
124
1
import pytest snake_case : Optional[Any] = "__dummy_dataset1__" snake_case : int = "\nimport json\nimport os\n\nimport datasets\n\n\nREPO_URL = \"https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/\"\nURLS = {\"train\": REPO_URL + \"wikiann-bn-train.jsonl\",...
124
import requests def lowerCAmelCase_ ( _snake_case : str , _snake_case : str ) -> None: '''simple docstring''' __magic_name__ : Any = {"Content-Type": "application/json"} __magic_name__ : Optional[int] = requests.post(_snake_case , json={"te...
124
1
import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_secondary_learner, ) from torch.utils.data import DataLoader, Random...
124
import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(snake_case ) , 'Tatoeba dir...
124
1
def lowerCAmelCase_ ( _snake_case : int , _snake_case : int ) -> float: '''simple docstring''' return base * power(_snake_case , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print("Raise base to the power of exponent using recursion...") snake_case ...
124
import math def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' if not isinstance(_snake_case , _snake_case ): __magic_name__ : str = F'''Input value of [number={number}] must be an integer''' raise TypeError(_snake_case ) if number ...
124
1
# Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar snake_case : Any = TypeVar("T") class _snake_case ( Generic[T] ): def __init__( ...
124
from collections import defaultdict from math import ceil, sqrt def lowerCAmelCase_ ( _snake_case : int = 1000000 , _snake_case : int = 10 ) -> int: '''simple docstring''' __magic_name__ : defaultdict = defaultdict(_snake_case ) for outer_width in range(3 ...
124
1
import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import load_metric from .utils import...
124
from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor snake_case : Optional[int] = ...
124
1
from __future__ import annotations class _snake_case : def __init__( self , _a ): __magic_name__ : int = data __magic_name__ : Node | None = None __magic_name__ : Node | None = None def lowerCAmelCase_ ( _snake_...
124
import itertools import os from collections import Counter, defaultdict from concurrent.futures import ThreadPoolExecutor, as_completed import numpy as np import datasets from .execute import check_correctness snake_case : int = "\\n@misc{chen2021evaluating,\n title={Evaluating Large Language...
124
1
import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteSche...
124
import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger snake_case : Optional[int] = get_logger(__name__) snake_case : Union[str, Any] = R"\n Args:\n input_ids (`jnp.ndarray` ...
124
1
import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger snake_case : Optional[int] = get_logger(__name__) snake_case : Union[str, Any] = R"\n Args:\n input_ids (`jnp.ndarray` ...
124
from typing import Dict from .base import GenericTensor, Pipeline class _snake_case ( snake_case ): def SCREAMING_SNAKE_CASE ( self , _a=None , _a=None , _a=None , **_a ): if tokenize_kwargs is None: __magic_name__ : Tuple = {} if tr...
124
1
def lowerCAmelCase_ ( _snake_case : Optional[Any] ) -> Optional[int]: '''simple docstring''' if not head: return True # split the list to two parts __magic_name__ , __magic_name__ : List[Any] = head.next, head while fast and fast.next: __magic_name__ ...
124
import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging if is_torch_available(): import torch ...
124
1
from __future__ import annotations def lowerCAmelCase_ ( _snake_case : int , _snake_case : int ) -> list[list[int]]: '''simple docstring''' __magic_name__ : list[list[int]] = [] create_all_state(1 , _snake_case , _snake_case , [] , _snake_case ) return...
124
def lowerCAmelCase_ ( _snake_case : str , _snake_case : str ) -> float: '''simple docstring''' def get_matched_characters(_snake_case : str , _snake_case : str ) -> str: __magic_name__ : str = [] __magic_name__ : Optional[Any] = min(len...
124
1
from bisect import bisect from itertools import accumulate def lowerCAmelCase_ ( _snake_case : List[str] , _snake_case : Union[str, Any] , _snake_case : Dict , _snake_case : int ) -> int: '''simple docstring''' __magic_name__ : str = sorted(zip(_snake...
124
import unittest from transformers import XLMConfig, 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_common import ModelTesterMixin, ids_te...
124
1
import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging snake_case : Tuple = logging.get_logger(__name__) snake_case : Dict = {"vocab_file": "senten...
124
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_attention_mask from ...test_pipe...
124
1
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : int = logging.get_logger(__name__) snake_case : Any = { "SCUT-DLVCLab/lilt-roberta-en-base": ( "https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/resolve/main/config.json"...
124
import os import numpy import onnx def lowerCAmelCase_ ( _snake_case : Tuple , _snake_case : int ) -> List[str]: '''simple docstring''' __magic_name__ : Dict = a.name __magic_name__ : Optional[Any] = b.name __magic_name__ : Opti...
124
1
from __future__ import annotations import bisect def lowerCAmelCase_ ( _snake_case : list[int] , _snake_case : int , _snake_case : int = 0 , _snake_case : int = -1 ) -> int: '''simple docstring''' if hi < 0: __magic_name__ : Union[str, Any] = len(_...
124
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_full_determinis...
124
1
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin from .feature_extraction_wavaveca import WavaVecaFeatureExtractor from .tokenization_wavaveca import WavaVecaCTCTokenizer class _snake_case ( snake_case ): UpperCamelCase__ = 'Wav2Vec2Fea...
124
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCAmelCase_ ( _snake_case : int , _snake_case : Union[str, Any] ) ...
124
1
import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) snake_case : Tuple = { "sample_size": 32, "in_channels": 3, "out_channels": 3, "layers_per_block": 2, "num_class_embeds": 1_000, ...
124
from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDIMScheduler, DDPMScheduler...
124
1
from math import factorial snake_case : dict[str, int] = {str(digit): factorial(digit) for digit in range(10)} def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' if not isinstance(_snake_case , _snake_case ): raise TypeError("Parameter n...
124
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
124
1
from __future__ import annotations snake_case : Optional[Any] = 8.9_8_8E9 # units = N * m^s * C^-2 def lowerCAmelCase_ ( _snake_case : float , _snake_case : float , _snake_case : float , _snake_case : float ) -> dict[str, float]: '''simple docstring''' ...
124
import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils import logging if version.parse(fairseq.__vers...
124
1
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaVe...
124
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_utils import PILImageResampling f...
124
1
from tempfile import TemporaryDirectory from unittest import TestCase from unittest.mock import MagicMock, patch from transformers import AutoModel, TFAutoModel from transformers.onnx import FeaturesManager from transformers.testing_utils import SMALL_MODEL_IDENTIFIER, require_tf, require_torch @require_torch @r...
124
import os import sys import unittest snake_case : List[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_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, find_...
124
1
from __future__ import annotations import unittest import numpy as np from transformers import LayoutLMConfig, 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, random_...
124
from __future__ import annotations from typing import Any class _snake_case ( snake_case ): pass class _snake_case : def __init__( self , _a ): __magic_name__ : Any = data __magic_name__ : Node | None = None def __it...
124
1
import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput def lowerCAmelCase_ ( ...
124
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTimestepEmbedding, FlaxT...
124
1
import random from .binary_exp_mod import bin_exp_mod def lowerCAmelCase_ ( _snake_case : int , _snake_case : int=1000 ) -> Union[str, Any]: '''simple docstring''' if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd __magic_name__ : L...
124
import requests def lowerCAmelCase_ ( _snake_case : str , _snake_case : str ) -> None: '''simple docstring''' __magic_name__ : Any = {"Content-Type": "application/json"} __magic_name__ : Optional[int] = requests.post(_snake_case , json={"te...
124
1
import pytest from datasets.splits import SplitDict, SplitInfo from datasets.utils.py_utils import asdict @pytest.mark.parametrize( "split_dict" , [ SplitDict(), SplitDict({"train": SplitInfo(name="train" , num_bytes=1337 , num_examples=42 , dataset_name="my_dataset" )} ), Spli...
124
import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(snake_case ) , 'Tatoeba dir...
124
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_roberta_series import ( ...
124
import math def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' if not isinstance(_snake_case , _snake_case ): __magic_name__ : str = F'''Input value of [number={number}] must be an integer''' raise TypeError(_snake_case ) if number ...
124
1
from .constants import ( MODEL_NAME, OPTIMIZER_NAME, RNG_STATE_NAME, SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, SCALER_NAME, SCHEDULER_NAME, TORCH_LAUNCH_PARAMS, WEIGHTS_INDEX_NAME, WEIGHTS_NAME, ) from .dataclasses import ( BnbQuantizationConfig, ComputeEnvironment, ...
124
from collections import defaultdict from math import ceil, sqrt def lowerCAmelCase_ ( _snake_case : int = 1000000 , _snake_case : int = 10 ) -> int: '''simple docstring''' __magic_name__ : defaultdict = defaultdict(_snake_case ) for outer_width in range(3 ...
124
1
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : Union[str, Any] = logging.get_logger(__name__) snake_case : Tuple = { "RWKV/rwkv-4-169m-pile": "https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json", "RWKV/rwkv-4-4...
124
from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor snake_case : Optional[int] = ...
124
1
def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' if not isinstance(_snake_case , _snake_case ): raise ValueError("multiplicative_persistence() only accepts integral values" ) if num < 0: raise ValueError("multiplicative_persistence() does not accept nega...
124
import itertools import os from collections import Counter, defaultdict from concurrent.futures import ThreadPoolExecutor, as_completed import numpy as np import datasets from .execute import check_correctness snake_case : int = "\\n@misc{chen2021evaluating,\n title={Evaluating Large Language...
124
1
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase_ ( _snake_case : Tuple , _snake_case : Optional[Any] , _snake_case : Dict ) -> str...
124
import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger snake_case : Optional[int] = get_logger(__name__) snake_case : Union[str, Any] = R"\n Args:\n input_ids (`jnp.ndarray` ...
124
1
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case : List[str] = logging.get_logger(__name__) snake_case : Union[str, Any] = { "studio-ousia/luke-base": "https://huggingface.co/studio-ousia/luke-base/resolve/main/config.json", "studio-...
124
from typing import Dict from .base import GenericTensor, Pipeline class _snake_case ( snake_case ): def SCREAMING_SNAKE_CASE ( self , _a=None , _a=None , _a=None , **_a ): if tokenize_kwargs is None: __magic_name__ : Tuple = {} if tr...
124
1
from math import factorial def lowerCAmelCase_ ( _snake_case : int = 20 ) -> int: '''simple docstring''' __magic_name__ : List[str] = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... __magic_name__ : Tuple ...
124
import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging if is_torch_available(): import torch ...
124
1
import uuid from typing import Any, Dict, List, Optional, Union from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf if is_torch_available(): import torch snake_case : Lis...
124
def lowerCAmelCase_ ( _snake_case : str , _snake_case : str ) -> float: '''simple docstring''' def get_matched_characters(_snake_case : str , _snake_case : str ) -> str: __magic_name__ : str = [] __magic_name__ : Optional[Any] = min(len...
124
1
import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline snake_case : List[str] = argparse.ArgumentParser("Stable Diffusion script with intel optimization", add_help=False) parser.add_argument("--dpm", action=...
124
import unittest from transformers import XLMConfig, 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_common import ModelTesterMixin, ids_te...
124
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_camembert import...
124
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_attention_mask from ...test_pipe...
124
1
def lowerCAmelCase_ ( _snake_case : list , _snake_case : int , _snake_case : int = 0 , _snake_case : int = 0 ) -> int: '''simple docstring''' __magic_name__ : List[str] = right or len(_snake_case ) - 1 if left > right: return -1 elif list_data[left] ==...
124
import os import numpy import onnx def lowerCAmelCase_ ( _snake_case : Tuple , _snake_case : int ) -> List[str]: '''simple docstring''' __magic_name__ : Dict = a.name __magic_name__ : Optional[Any] = b.name __magic_name__ : Opti...
124
1
import numpy as np class _snake_case : def __init__( self ): __magic_name__ : List[str] = (0, 0) __magic_name__ : List[str] = None __magic_name__ : Union[str, Any] = 0 __magic_name__ : Tuple = 0 __magic...
124
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_full_determinis...
124
1
import unittest from dataclasses import dataclass import pytest from accelerate.commands.config.config_args import SageMakerConfig from accelerate.utils import ComputeEnvironment from accelerate.utils.launch import _convert_nargs_to_dict @dataclass class _snake_case ( snake_case ): UpperCamelCase__ ...
124
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCAmelCase_ ( _snake_case : int , _snake_case : Union[str, Any] ) ...
124
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) snake_case : List[str] = {"configuration_encoder_decoder": ["EncoderDecoderConfig"]} try: if not is_torch_available(...
124
from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDIMScheduler, DDPMScheduler...
124
1
from scipy.stats import spearmanr import datasets snake_case : List[str] = "\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implying no correlation.\nPositive corr...
124
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
124
1
import unittest 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 ImageProcessingSavingTestMixin, prepare_video_inputs if is_torch_available(): import torch ...
124
import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils import logging if version.parse(fairseq.__vers...
124
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case : Optional[int] = {"configuration_yolos": ["YOLOS_PRETRAINED_CONFIG_ARCHIVE_MAP", "YolosConfig", "YolosOnnxConfig"]} try: if not is_vision_availa...
124
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_utils import PILImageResampling f...
124
1
from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("repo_id" , ["canonical_dataset_name", "org-name/dataset-name"] ) @pytest.mark.parametrize("path" , ["filename.csv", "filename with blanks.csv"] ) @pytest.mark.parametrize("revision" , [None, "v...
124
import os import sys import unittest snake_case : List[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_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, find_...
124
1
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_utils import PILImageResampling f...
124
from __future__ import annotations from typing import Any class _snake_case ( snake_case ): pass class _snake_case : def __init__( self , _a ): __magic_name__ : Any = data __magic_name__ : Node | None = None def __it...
124
1
from math import factorial, radians def lowerCAmelCase_ ( _snake_case : float , _snake_case : int = 18 , _snake_case : int = 10 ) -> float: '''simple docstring''' __magic_name__ : int = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) # Converti...
124
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTimestepEmbedding, FlaxT...
124
1
from typing import Dict import numpy as np import torch from . import residue_constants as rc from .tensor_utils import tensor_tree_map, tree_map def __lowercase ( snake_case ): """simple docstring""" __magic_name__ :Tuple = [] __magic_name__ :Tuple = [] __ma...
0
import requests def lowerCAmelCase_ ( _snake_case : str , _snake_case : str ) -> None: '''simple docstring''' __magic_name__ : Any = {"Content-Type": "application/json"} __magic_name__ : Optional[int] = requests.post(_snake_case , json={"te...
124
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __snake_case = { '''configuration_groupvit''': [ '''GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GroupViTConfig''', '''Group...
1
import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(snake_case ) , 'Tatoeba dir...
124
0
from heapq import heappop, heappush import numpy as np def SCREAMING_SNAKE_CASE_ ( _snake_case :np.ndarray , _snake_case :tuple[int, int] , _snake_case :tuple[int, int] , _snake_case :bool , ) -> tuple[float | int, list[tuple[int, int]]]: _A , _A = grid.shape _A ...
2
import math def lowerCAmelCase_ ( _snake_case : int ) -> int: '''simple docstring''' if not isinstance(_snake_case , _snake_case ): __magic_name__ : str = F'''Input value of [number={number}] must be an integer''' raise TypeError(_snake_case ) if number ...
124
0
'''simple docstring''' import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( ...
3
from collections import defaultdict from math import ceil, sqrt def lowerCAmelCase_ ( _snake_case : int = 1000000 , _snake_case : int = 10 ) -> int: '''simple docstring''' __magic_name__ : defaultdict = defaultdict(_snake_case ) for outer_width in range(3 ...
124
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __UpperCamelCase : List[Any] = {'''configuration_encoder_decoder''': ['''EncoderDecoder...
4
from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor snake_case : Optional[int] = ...
124
0
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def A (__lowerCamelCase :List[Any] ): _lowe...
5
import itertools import os from collections import Counter, defaultdict from concurrent.futures import ThreadPoolExecutor, as_completed import numpy as np import datasets from .execute import check_correctness snake_case : int = "\\n@misc{chen2021evaluating,\n title={Evaluating Large Language...
124
0
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class UpperCamelCase_ : lowerCamelCase_ = 42 lowerCamelCase_ = 42 class UpperCamelCase_ : ...
6
import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger snake_case : Optional[int] = get_logger(__name__) snake_case : Union[str, Any] = R"\n Args:\n input_ids (`jnp.ndarray` ...
124
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a = logging.get_logger(__name__) a = { '''google/pegasus-large''': '''https://huggingface.co/google/pegasus-large/resolve/main/config.json''', # See all PEGASUS models...
7
from typing import Dict from .base import GenericTensor, Pipeline class _snake_case ( snake_case ): def SCREAMING_SNAKE_CASE ( self , _a=None , _a=None , _a=None , **_a ): if tokenize_kwargs is None: __magic_name__ : Tuple = {} if tr...
124
0
'''simple docstring''' import math import sys def _lowerCAmelCase ( __snake_case : int ) -> int: if number != int(__snake_case ): raise ValueError('the value of input must be a natural number' ) if number < 0: raise ValueE...
8
import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging if is_torch_available(): import torch ...
124
0
import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def A ( *__UpperCamelCase ) -> Dict: if not isinstance(__UpperCamelCase , __UpperCamelCase ): A__ = list(__UpperCamelCase ) for i in range(len(_...
9
def lowerCAmelCase_ ( _snake_case : str , _snake_case : str ) -> float: '''simple docstring''' def get_matched_characters(_snake_case : str , _snake_case : str ) -> str: __magic_name__ : str = [] __magic_name__ : Optional[Any] = min(len...
124
0
import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modules import _PACKAGED_DATASETS_MO...
10
import unittest from transformers import XLMConfig, 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_common import ModelTesterMixin, ids_te...
124
0
'''simple docstring''' from __future__ import annotations def lowerCAmelCase (__A , __A): """simple docstring""" if len(__A) < k or k < 0: raise ValueError('''Invalid Input''') _a = _a = sum(array[:k]) for i in range(len(__A) - k): ...
11
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_attention_mask from ...test_pipe...
124
0
def UpperCamelCase ( lowercase_ , lowercase_ ) -> int: '''simple docstring''' return abs(lowercase_ ) if a == 0 else greatest_common_divisor(b % a , lowercase_ ) def UpperCamelCase ( lowercase_ , lowercase_ ) -> int: '''simple docstring''' ...
12
import os import numpy import onnx def lowerCAmelCase_ ( _snake_case : Tuple , _snake_case : int ) -> List[str]: '''simple docstring''' __magic_name__ : Dict = a.name __magic_name__ : Optional[Any] = b.name __magic_name__ : Opti...
124
0
'''simple docstring''' A__ : List[Any] = [ """DownloadConfig""", """DownloadManager""", """DownloadMode""", """StreamingDownloadManager""", ] from .download_config import DownloadConfig from .download_manager import DownloadManager, DownloadMode from .streaming_download_manager impor...
13
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_full_determinis...
124
0
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ = logging.get_logger(__name__) a__ = {} class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : Optional[int] ...
14
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCAmelCase_ ( _snake_case : int , _snake_case : Union[str, Any] ) ...
124
0
from ...configuration_utils import PretrainedConfig from ...utils import logging A : Any = logging.get_logger(__name__) A : List[str] = { 'microsoft/cvt-13': 'https://huggingface.co/microsoft/cvt-13/resolve/main/config.json', # See all Cvt models at https://hugging...
15
from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDIMScheduler, DDPMScheduler...
124
0
import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput def __a ...
16
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
124
0
import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosity_info() UpperCAmelCase_ : Any = loggin...
17
import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils import logging if version.parse(fairseq.__vers...
124
0
'''simple docstring''' from __future__ import annotations from math import pi, sqrt def __a(SCREAMING_SNAKE_CASE_ : float , SCREAMING_SNAKE_CASE_ : float ): '''simple docstring''' if inductance <= 0: raise ValueError("Inductance cannot be 0 or negative" ...
18
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_utils import PILImageResampling f...
124
0
"""simple docstring""" import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerati...
19
import os import sys import unittest snake_case : List[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_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, find_...
124
0