code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __SCREAMING_SNAKE_CASE ( __UpperCamelCase : int ) -> int: """simple docstring""" SCREAMING_SNAKE_CASE__ = prime_factors(_lowerCAmelCase ) if i...
219
'''simple docstring''' import os 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 UpperCamelCase__: Tuple = logging.get_...
23
0
from __future__ import annotations def __snake_case ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): if (voltage, current, resistance).count(0 ) != 1: raise ValueError('''One and only one argument must be 0''' ) if resistance < 0: raise ValueError('''Resistan...
49
'''simple docstring''' import tempfile import unittest import numpy as np from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import BertConfig, is_flax_available from transformers.testing_utils import TOKEN, USER, is_staging_test,...
23
0
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward fro...
101
'''simple docstring''' import unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, i...
23
0
import argparse import os from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_task_guides.py _SCREAMING_SNAKE_CASE = "src/transformers" _SCREAMING_SNAKE_CASE = "d...
343
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, ...
23
0
'''simple docstring''' 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 __a ...
35
'''simple docstring''' import argparse import os import re import packaging.version UpperCamelCase__: Union[str, Any] = "examples/" UpperCamelCase__: Optional[Any] = { "examples": (re.compile(r"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_ve...
23
0
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor _A = logging.get_logger(__name__) class lowercase_ ( A__ ): def __init__( self , *__UpperCamelCase , **__UpperCamelCase ): """simple docstring""" w...
122
'''simple docstring''' from __future__ import annotations import matplotlib.pyplot as plt # type: ignore import numpy # initial triangle of Koch snowflake UpperCamelCase__: Tuple = numpy.array([0, 0]) UpperCamelCase__: Union[str, Any] = numpy.array([0.5, 0.8660254]) ...
23
0
import os from collections import deque import torch from torch.utils.data import Dataset class a_ ( A__ ): """simple docstring""" def __init__( self : Optional[int] ,snake_case : Optional[int]="" ,snake_case : List[Any]="train" ): ...
334
'''simple docstring''' from manim import * class SCREAMING_SNAKE_CASE( A__ ): """simple docstring""" def A ( self : Union[str, Any] ) -> List[str]: UpperCAmelCase : Optional[Any] = Rectangle(height=0.5 , widt...
23
0
import random def UpperCamelCase_( _snake_case : list , _snake_case : str ): """simple docstring""" __a =[], [], [] for element in data: if element < pivot: less.append(_lowerCAmelCase ) elif element > pivot: ...
218
'''simple docstring''' import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings....
23
0
'''simple docstring''' import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def UpperCamelCase_ ( snake_case_ : Any ) -> Tuple: '''simple docstring''' if "model" in orig_key: __lowerCAmelCase = ...
229
'''simple docstring''' from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : int , _lowerCAmelCase : float = 1 / sqrt(2 ) ) -> IIRFilter: Upper...
23
0
def lowerCAmelCase__(__snake_case ,__snake_case ) -> float: '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(f"""{price_plus_tax(100, 0.25) = }""") print(f"""{price_plus_tax(125.50, 0.05) = }""")
209
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ) -> bool: UpperCAmelCase : str = get_failure_array(_lowerCAmelCase ) # 2) Step through text searching ...
23
0
"""simple docstring""" import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class lowerCAmelCase__ ( datasets.BeamBasedBuilder ): ...
288
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, Wav...
23
0
def __SCREAMING_SNAKE_CASE ( __UpperCamelCase : list[int] , __UpperCamelCase : str ) -> list[int]: """simple docstring""" SCREAMING_SNAKE_CASE__ = int(_lowerCAmelCase ) # Initialize Result SCREAMING_SNAKE_CASE__ = []...
219
'''simple docstring''' import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_...
23
0
import os import sys import transformers __snake_case :Optional[int] = "3" print('''Python version:''', sys.version) print('''transformers version:''', transformers.__version__) try: import torch print('''Torch version:''', torch.__version__) print('''Cuda available:''', torch.cuda.is_avail...
49
'''simple docstring''' import random from .binary_exp_mod import bin_exp_mod def snake_case_ ( _lowerCAmelCase : Tuple , _lowerCAmelCase : Optional[Any]=1000 ) -> int: if n < 2: return False if n % 2 == 0: r...
23
0
def UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' if num < 0: return False lowercase = num lowercase = 0 while num > 0: lowercase = rev_num * 10 + (num % 10) num //= 10 return num_copy == rev_n...
101
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor ...
23
0
import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets _SCREAMING_SNAKE_CASE = "\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n and Saurav Kadavath\n and Akul ...
343
'''simple docstring''' # 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/lic...
23
0
'''simple docstring''' 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, nest...
35
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : list[int | float] , _lowerCAmelCase : int , _lowerCAmelCase : int ) -> int | float: if len(_lowerCAmelCase ) == 0: raise ValueE...
23
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_sentencepiece_av...
122
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class SCREAMING_S...
23
0
import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def snake_case__ ( lowerCAmelCase_ ): """simple docstring""" SCREAMING_SNAKE_CASE =FileLock(str(tmpdir / 'foo.lock' ) ) SCREAMING_SNAKE_CASE =FileLock(str(t...
334
'''simple docstring''' import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class SCREAMING_SNAKE_CASE( A__ ): """simple docstring""" lowerCamelCase__ = """MCTCTFeatureExtractor""" lowerCame...
23
0
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast _lowerCAmelCase : int = datasets.utils.logging.get_logger(__name__) @dataclass class ...
218
'''simple docstring''' from math import isclose, sqrt def snake_case_ ( _lowerCAmelCase : float , _lowerCAmelCase : float , _lowerCAmelCase : float ) -> tuple[float, float, float]: UpperCAmelCase : Optional[int] = point_y /...
23
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : Tuple = logging.get_logger(__name__) _A : List[Any] = { "uw-madison/mra-base-512-4": "https://huggingface.co/uw-madison/mra-base-512-4/resolve/main/config...
229
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase__: str = { "configuration_lxmert": ["LXMERT_PR...
23
0
from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelerate.test_utils import R...
209
'''simple docstring''' 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.pipelin...
23
0
"""simple docstring""" from __future__ import annotations from typing import Any def _UpperCAmelCase ( __lowerCamelCase : list[Any] ) -> None: create_state_space_tree(_lowerCAmelCase , [] , 0 ) def _UpperCAmelCase ( __lowerCamelCase : list[Any] , ...
288
'''simple docstring''' import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_...
23
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase : Any = logging.get_logger(__name__) __lowerCamelCase : str = {} class __snake_case ( A__ ): lowerCAmelCase_ = "llama" lowerCAmelCase_ ...
219
'''simple docstring''' import os 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 UpperCamelCase__: Tuple = logging.get_...
23
0
def __snake_case ( _UpperCAmelCase , _UpperCAmelCase ): if mass < 0: raise ValueError('''The mass of a body cannot be negative''' ) return 0.5 * mass * abs(_lowerCAmelCase ) * abs(_lowerCAmelCase ) if __name__ == "__main__": import doctest doctest.testmod(verbose=True) ...
49
'''simple docstring''' import tempfile import unittest import numpy as np from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import BertConfig, is_flax_available from transformers.testing_utils import TOKEN, USER, is_staging_test,...
23
0
import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency lowercase__ :str = { "E": 12.70, "T": 9.06, "A": 8.17, "O": 7.51, "I": 6.97, "N": 6.75, "S": 6.33, "H": 6.09, "R": 5.99, "D": 4.25, "L": 4.03, "C": 2.78, "U": 2.76, "M": 2....
101
'''simple docstring''' import unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, i...
23
0
import argparse import os from pathlib import Path import fairseq import torch from packaging import version from torch import nn from transformers import ( BartConfig, BartForConditionalGeneration, BartForSequenceClassification, BartModel, BartTokenizer, ) from transformers.utils import logging ...
343
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, ...
23
0
'''simple docstring''' import enum import shutil import sys __a = shutil.get_terminal_size() __a = {"UP": "A", "DOWN": "B", "RIGHT": "C", "LEFT": "D"} class UpperCAmelCase_ ( enum.Enum ): """simple docstring""" lowercase = 0 lowercase = ...
35
'''simple docstring''' import argparse import os import re import packaging.version UpperCamelCase__: Union[str, Any] = "examples/" UpperCamelCase__: Optional[Any] = { "examples": (re.compile(r"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_ve...
23
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _A = { "configuration_funnel": ["FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP", "FunnelConfig"], "convert_funnel_original_...
122
'''simple docstring''' from __future__ import annotations import matplotlib.pyplot as plt # type: ignore import numpy # initial triangle of Koch snowflake UpperCamelCase__: Tuple = numpy.array([0, 0]) UpperCamelCase__: Union[str, Any] = numpy.array([0.5, 0.8660254]) ...
23
0
import unittest import numpy as np import torch from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad class a_ ( unittest.TestCase ): """simple docstring""" def _lowerCAmelCase ( self : List[str] ):...
334
'''simple docstring''' from manim import * class SCREAMING_SNAKE_CASE( A__ ): """simple docstring""" def A ( self : Union[str, Any] ) -> List[str]: UpperCAmelCase : Optional[Any] = Rectangle(height=0.5 , widt...
23
0
import os import sys import unittest _lowerCAmelCase : int = 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_objec...
218
'''simple docstring''' import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings....
23
0
'''simple docstring''' import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import Diffusi...
229
'''simple docstring''' from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : int , _lowerCAmelCase : float = 1 / sqrt(2 ) ) -> IIRFilter: Upper...
23
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_camembert im...
209
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ) -> bool: UpperCAmelCase : str = get_failure_array(_lowerCAmelCase ) # 2) Step through text searching ...
23
0
"""simple docstring""" import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class lowerCAmelCase__ ( unittest.TestCase ): ...
288
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, Wav...
23
0
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler, DDPMSchedul...
219
'''simple docstring''' import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_...
23
0
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 :List[Any] = pytest.mark.integration @pytest.mark.parametrize('''path''' , ...
49
'''simple docstring''' import random from .binary_exp_mod import bin_exp_mod def snake_case_ ( _lowerCAmelCase : Tuple , _lowerCAmelCase : Optional[Any]=1000 ) -> int: if n < 2: return False if n % 2 == 0: r...
23
0
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from transformers.mo...
101
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor ...
23
0
import math import random from typing import Any from .hill_climbing import SearchProblem def lowercase( UpperCamelCase_ , UpperCamelCase_ = True , UpperCamelCase_ = math.inf , UpperCamelCase_ = -math.inf , UpperCamelCase_ = math.inf , UpperCamelCase_ = -math.inf , UpperCamelCase_ = F...
343
'''simple docstring''' # 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/lic...
23
0
'''simple docstring''' from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_acceler...
35
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : list[int | float] , _lowerCAmelCase : int , _lowerCAmelCase : int ) -> int | float: if len(_lowerCAmelCase ) == 0: raise ValueE...
23
0
import os import numpy import onnx def lowerCamelCase__ ( a__ : str , a__ : Optional[Any] ) -> int: UpperCamelCase_ = a.name UpperCamelCase_ = b.name UpperCamelCase_ = '''''' UpperCamelCase_ = '''''' ...
122
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class SCREAMING_S...
23
0
def snake_case__ ( lowerCAmelCase_, lowerCAmelCase_, lowerCAmelCase_, lowerCAmelCase_ ): """simple docstring""" global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: SCREAMING_SNAKE_CASE =mf_knapsack(i - 1, _lo...
334
'''simple docstring''' import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class SCREAMING_SNAKE_CASE( A__ ): """simple docstring""" lowerCamelCase__ = """MCTCTFeatureExtractor""" lowerCame...
23
0
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...
218
'''simple docstring''' from math import isclose, sqrt def snake_case_ ( _lowerCAmelCase : float , _lowerCAmelCase : float , _lowerCAmelCase : float ) -> tuple[float, float, float]: UpperCAmelCase : Optional[int] = point_y /...
23
0
'''simple docstring''' import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import Tok...
229
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase__: str = { "configuration_lxmert": ["LXMERT_PR...
23
0
def lowerCAmelCase__(__snake_case ) -> float: '''simple docstring''' if not nums: # Makes sure that the list is not empty raise ValueError('''List is empty''' ) lowerCamelCase__ = sum(_lowerCAmelCase ) / len(_lowerCAmelCase ) # Calculate the average r...
209
'''simple docstring''' 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.pipelin...
23
0
"""simple docstring""" import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class lowerCAmelCase__ ( unittest.TestCase ): def low...
288
'''simple docstring''' import io import json import fsspec import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.json import JsonDatasetReader, JsonDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_...
23
0
import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae_attention_paths,...
219
'''simple docstring''' import os 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 UpperCamelCase__: Tuple = logging.get_...
23
0
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 :Union[str, Any] = logging.get_logger(__name__) class _A : def __init__( self ...
49
'''simple docstring''' import tempfile import unittest import numpy as np from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import BertConfig, is_flax_available from transformers.testing_utils import TOKEN, USER, is_staging_test,...
23
0
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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, IMA...
101
'''simple docstring''' import unittest from transformers import MraConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, floats_tensor, i...
23
0
def lowercase( UpperCamelCase_ ) -> list: '''simple docstring''' UpperCamelCase = [0] * len(_lowerCAmelCase ) for i in range(1 , len(_lowerCAmelCase ) ): # use last results for better performance - dynamic programming UpperCamelCase = prefix_result[i -...
343
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, ...
23
0
'''simple docstring''' import argparse import ast import logging import os import sys import pandas as pd import torch from tqdm import tqdm from transformers import BartForConditionalGeneration, RagRetriever, RagSequenceForGeneration, RagTokenForGeneration from transformers import logging as transformers_lo...
35
'''simple docstring''' import argparse import os import re import packaging.version UpperCamelCase__: Union[str, Any] = "examples/" UpperCamelCase__: Optional[Any] = { "examples": (re.compile(r"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_ve...
23
0
import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def lowerCamelCase__ ( a__ : Dict , a__ : Optional[Any] , a__ : Tuple , a__ : str=5 ) -> Any: # Adapted from https://github.com/pytorch/fairseq/blob/master/fairseq/models/...
122
'''simple docstring''' from __future__ import annotations import matplotlib.pyplot as plt # type: ignore import numpy # initial triangle of Koch snowflake UpperCamelCase__: Tuple = numpy.array([0, 0]) UpperCamelCase__: Union[str, Any] = numpy.array([0.5, 0.8660254]) ...
23
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCamelCase ={ "configuration_lxmert": ["LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "LxmertConfig"], "tokeniz...
334
'''simple docstring''' from manim import * class SCREAMING_SNAKE_CASE( A__ ): """simple docstring""" def A ( self : Union[str, Any] ) -> List[str]: UpperCAmelCase : Optional[Any] = Rectangle(height=0.5 , widt...
23
0
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES _lowerCAmelCase : Any = logging.get_logger(__name__) _lowerCAmelCase : int =...
218
'''simple docstring''' import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings....
23
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A : int = logging.get_logger(__name__) _A : Tuple = { "funnel-transformer/small": "https://huggingface.co/funnel-transformer/small/resolve/main/config.json", ...
229
'''simple docstring''' from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : int , _lowerCAmelCase : float = 1 / sqrt(2 ) ) -> IIRFilter: Upper...
23
0
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils import logging logging.set_verb...
209
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ) -> bool: UpperCAmelCase : str = get_failure_array(_lowerCAmelCase ) # 2) Step through text searching ...
23
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from transf...
288
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, Wav...
23
0
__lowerCamelCase : List[str] = [0, 2, 4, 6, 8] __lowerCamelCase : Any = [1, 3, 5, 7, 9] def __SCREAMING_SNAKE_CASE ( __UpperCamelCase : int , __UpperCamelCase : int , __UpperCamelCase : list[int] , __UpperCamelCase : int ) -> ...
219
'''simple docstring''' import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_...
23
0
import argparse import copy def __snake_case ( _UpperCAmelCase ): __a = {} with open(_lowerCAmelCase ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: __a = [] _list.append([line.split()[1...
49
'''simple docstring''' import random from .binary_exp_mod import bin_exp_mod def snake_case_ ( _lowerCAmelCase : Tuple , _lowerCAmelCase : Optional[Any]=1000 ) -> int: if n < 2: return False if n % 2 == 0: r...
23
0
import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate from flax.training.comm...
101
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor ...
23
0
import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets _SCREAMING_SNAKE_CASE = "\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained Multilingual Language Models for ...
343
'''simple docstring''' # 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/lic...
23
0
'''simple docstring''' import sys from collections import defaultdict class UpperCAmelCase_ : """simple docstring""" def __init__( self : Any ): snake_case__ : Union[str, Any] = [] def lowerCamelCase ( self : s...
35
'''simple docstring''' from __future__ import annotations def snake_case_ ( _lowerCAmelCase : list[int | float] , _lowerCAmelCase : int , _lowerCAmelCase : int ) -> int | float: if len(_lowerCAmelCase ) == 0: raise ValueE...
23
0
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable snake_case_ = {'configuration_dpt': ['DPT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'DPTConfig']} try: if n...
24
import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( is_pipelin...
24
1
from __future__ import annotations snake_case_ = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def lowerCamelCase__ ( snake_case_ : list[list[int]] , snake_case_ : list[int] , snake_case_ : list[int] , ...
24
from __future__ import annotations def lowerCamelCase__ ( snake_case_ : list[int] , snake_case_ : int ) -> list[list[int]]: __snake_case = [] __snake_case = [] __snake_case = 0 __snake_case ...
24
1
import json import sys def lowerCamelCase__ ( snake_case_ : Tuple , snake_case_ : List[Any] ) -> Optional[int]: with open(snake_case_ , encoding='''utf-8''' ) as f: __snake_case = json.load(snake_case_ ) ...
24
import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterM...
24
1
import random import unittest import numpy as np from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionImgaImgPipeline, PNDMScheduler, ) from diffusers.utils import floats_...
24
def lowerCamelCase__ ( ) -> int: return [ a * b * (1000 - a - b) for a in range(1 , 999 ) for b in range(snake_case_ , 999 ) if (a * a + b * b == (1000 - a - b) ** 2) ][0] if __name__ == "__main__": print(F'...
24
1
from __future__ import annotations snake_case_ = list[list[int]] # assigning initial values to the grid snake_case_ = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, 0, 8, 6, 3, 0, 0, 5], ...
24
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin snake_case_ = get_tests_dir('fixtures/test_sentencepi...
24
1
import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterM...
24
def lowerCamelCase__ ( snake_case_ : int ) -> int: if not isinstance(snake_case_ , snake_case_ ) or number < 0: raise ValueError('''Input must be a non-negative integer''' ) __snake_case = 0 while number: # This way we...
24
1
def lowerCamelCase__ ( snake_case_ : int = 200 ) -> int: __snake_case = [1, 2, 5, 10, 20, 50, 100, 200] __snake_case = [0] * (pence + 1) __snake_case = 1 # base case: 1 way to make 0 pence for coin in coins: for i...
24
from math import loga def lowerCamelCase__ ( snake_case_ : int ) -> int: if a < 0: raise ValueError('''Input value must be a positive integer''' ) elif isinstance(snake_case_ , snake_case_ ): raise TypeError('''Input value mus...
24
1
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py snake_case_ = 'src/transformers' # This is to make sure ...
24
from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_...
24
1
import argparse import collections import json from pathlib import Path import requests import torch import yaml from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTImageProcessor, MobileViTVaConfig, MobileViTVaForImageClassificat...
24
from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def lowerCamelCase__ ( ) -> Any: import os as original_os from os import path as original_path from os import rename as original_rename from os.path import dir...
24
1
from __future__ import annotations def lowerCamelCase__ ( snake_case_ : int = 4 ) -> list[list[int]]: __snake_case = abs(snake_case_ ) or 4 return [[1 + x + y * row_size for x in range(snake_case_ )] for y in range(snake_case_ )] ...
24
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqL...
24
1
from __future__ import annotations from random import random class SCREAMING_SNAKE_CASE__ : def __init__(self : int , a__ : int | None = None ): """simple docstring""" __snake_case = value __sn...
24
from math import pi def lowerCamelCase__ ( snake_case_ : int , snake_case_ : int ) -> float: return 2 * pi * radius * (angle / 360) if __name__ == "__main__": print(arc_length(90, 10))
24
1
def lowerCamelCase__ ( snake_case_ : int = 100 ) -> int: __snake_case = n * (n + 1) * (2 * n + 1) / 6 __snake_case = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__main__": print(F'{soluti...
24
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ = logging.get_logger(__name__) snake_case_ = { 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at https://hug...
24
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) snake_case_ = { 'configuration_swiftformer': [ 'SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SwiftFormerConfig', 'SwiftForme...
24
import random import unittest import numpy as np from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionImgaImgPipeline, PNDMScheduler, ) from diffusers.utils import floats_...
24
1
import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_availab...
24
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, RobertaToke...
24
1
import gc import unittest import torch from parameterized import parameterized from diffusers import AutoencoderKL from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device from diffusers.utils.import_utils import is_xformers_available from d...
24
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ): A_ : List[str] = ['image_processor', 'tokenizer'] A_ : Optional[Any] = 'CLI...
24
1
from __future__ import annotations import numpy as np def lowerCamelCase__ ( snake_case_ : np.ndarray ) -> tuple[np.ndarray, np.ndarray]: __snake_case , __snake_case = np.shape(snake_case_ ) if rows != columns: __snake_case ...
24
import os import unittest from huggingface_hub.utils import are_progress_bars_disabled import transformers.models.bart.tokenization_bart from transformers import logging from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context from transformers.utils.logging import disable_pr...
24
1
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast snake_case_ = datasets.utils.logging.get_logger(__name__) @dataclass class SCREAMING_SNAKE_CA...
24
import os import unittest from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer from transformers.testing_utils import require_jieba, tooslow from ...test_tokenization_common import TokenizerTesterMixin @require_jieba class SCREAMING_SNAKE_CASE__ ( ...
24
1
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Liter...
24
import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available from ...te...
24
1
from __future__ import annotations import math def lowerCamelCase__ ( snake_case_ : int , snake_case_ : int , snake_case_ : bool , snake_case_ : list[int] , snake_case_ : float ) -> int: if depth < 0: raise ...
24
import os import pytest from transformers.dynamic_module_utils import get_imports snake_case_ = '\nimport os\n' snake_case_ = '\ndef foo():\n import os\n return False\n' snake_case_ = '\ndef foo():\n def bar():\n if True:\n import os\n return...
24
1
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 ...
24
import socket def lowerCamelCase__ ( ) -> Any: __snake_case = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) __snake_case = socket.gethostname() __snake_case = 1_2312 sock.connect((host, port) ...
24
1
import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weights from ...
24
from __future__ import annotations def lowerCamelCase__ ( snake_case_ : list[int] ) -> list[int]: # This function is recursive __snake_case = len(snake_case_ ) # If the array contains only one element, we return it (it's the stop condition o...
24
1
import logging import os import threading import time try: import warnings except ImportError: snake_case_ = None try: import msvcrt except ImportError: snake_case_ = None try: import fcntl except ImportError: snake_case_ = None # Backward c...
24
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_common import Model...
24
1
import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...tes...
24
import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( is_pipelin...
24
1
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import IMAGENET_D...
24
from __future__ import annotations def lowerCamelCase__ ( snake_case_ : list[int] , snake_case_ : int ) -> list[list[int]]: __snake_case = [] __snake_case = [] __snake_case = 0 __snake_case ...
24
1
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu_available...
24
import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterM...
24
1
snake_case_ = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] snake_case_ = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] snake_case_ = { 0: 'Sunday', 1: 'Monday', 2: 'Tuesday', 3: 'Wednesday', 4: 'Thursday', 5: 'Friday', 6: 'Saturday', } def lowerCamelCase__ ...
24
def lowerCamelCase__ ( ) -> int: return [ a * b * (1000 - a - b) for a in range(1 , 999 ) for b in range(snake_case_ , 999 ) if (a * a + b * b == (1000 - a - b) ** 2) ][0] if __name__ == "__main__": print(F'...
24
1
import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debug.metrics as met class SC...
24
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin snake_case_ = get_tests_dir('fixtures/test_sentencepi...
24
1
import json import os import tempfile from unittest.mock import patch import torch from torch.utils.data import DataLoader, TensorDataset from accelerate import DistributedType, infer_auto_device_map, init_empty_weights from accelerate.accelerator import Accelerator from accelerate.state import ...
24
def lowerCamelCase__ ( snake_case_ : int ) -> int: if not isinstance(snake_case_ , snake_case_ ) or number < 0: raise ValueError('''Input must be a non-negative integer''' ) __snake_case = 0 while number: # This way we...
24
1
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class SCREAMING_SNAKE_CASE__ : A_ : List[str] = None def a (self : Tuple ): """simple docstring""" ...
24
from math import loga def lowerCamelCase__ ( snake_case_ : int ) -> int: if a < 0: raise ValueError('''Input value must be a positive integer''' ) elif isinstance(snake_case_ , snake_case_ ): raise TypeError('''Input value mus...
24
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case_ = { 'configuration_blip_2': [ 'BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Blip2Config', 'Blip2QFormerConfig', 'Blip2VisionConfi...
24
from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_...
24
1
from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import ConfigTester from ...test_modeling_tf_c...
24
from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def lowerCamelCase__ ( ) -> Any: import os as original_os from os import path as original_path from os import rename as original_rename from os.path import dir...
24
1
import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def lowerCamelCase__ ( snake_case_ : dict ) ...
24
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqL...
24
1
import os import unittest from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer from transformers.testing_utils import require_jieba, tooslow from ...test_tokenization_common import TokenizerTesterMixin @require_jieba class SCREAMING_SNAKE_CASE__ ( ...
24
from math import pi def lowerCamelCase__ ( snake_case_ : int , snake_case_ : int ) -> float: return 2 * pi * radius * (angle / 360) if __name__ == "__main__": print(arc_length(90, 10))
24
1
import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import CLIPModel, CL...
24
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ = logging.get_logger(__name__) snake_case_ = { 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at https://hug...
24
1
def lowerCamelCase__ ( snake_case_ : int = 1 , snake_case_ : int = 1000 ) -> int: __snake_case = 1 __snake_case = 0 for divide_by_number in range(snake_case_ , digit + 1 ): __snake_case = [...
24
import random import unittest import numpy as np from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionImgaImgPipeline, PNDMScheduler, ) from diffusers.utils import floats_...
24
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case_ = {'configuration_vit_msn': ['VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMSNConfig']} try: if not is_torch_available(): raise OptionalDependencyNot...
24
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, RobertaToke...
24
1
import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( is_pipelin...
24
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ): A_ : List[str] = ['image_processor', 'tokenizer'] A_ : Optional[Any] = 'CLI...
24
1
import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class SCREAMING_SNAKE_CASE__ : def __init__(self : Any , a__ : str , a__ : int , a__ : int ): """simple docstring""" ...
24
import os import unittest from huggingface_hub.utils import are_progress_bars_disabled import transformers.models.bart.tokenization_bart from transformers import logging from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context from transformers.utils.logging import disable_pr...
24
1
from __future__ import annotations def lowerCamelCase__ ( snake_case_ : list[int | str] ) -> None: create_state_space_tree(snake_case_ , [] , 0 , [0 for i in range(len(snake_case_ ) )] ) def lowerCamelCa...
24
import os import unittest from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer from transformers.testing_utils import require_jieba, tooslow from ...test_tokenization_common import TokenizerTesterMixin @require_jieba class SCREAMING_SNAKE_CASE__ ( ...
24
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 .tokeniza...
24
import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available from ...te...
24
1