code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" import unittest import torch from torch import nn from diffusers.models.activations import get_activation class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): """simple docstring""" def lowercase__ ( self ): """simple...
108
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = {} class SCREAMING_SNAKE_CASE__ ( lowercase ): """simple docstring""" a : str ...
108
1
'''simple docstring''' 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, convert_to_rgb, get_resize_output_image_size, normalize, rescale, ...
361
'''simple docstring''' import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever __a = logging.getLogger(__name__) class UpperCAmelCase_ ( _a ): """simple docstring""...
43
0
from timeit import timeit def _a ( SCREAMING_SNAKE_CASE : Any ) -> List[str]: """simple docstring""" if number < 0: raise ValueError('the value of input must not be negative' ) __lowerCAmelCase: Optional[Any] = 0 while number: number &= number - ...
322
"""simple docstring""" UpperCAmelCase__ = { """meter""": """m""", """kilometer""": """km""", """megametre""": """Mm""", """gigametre""": """Gm""", """terametre""": """Tm""", """petametre""": """Pm""", """exametre""": """Em""", """zettametre""": """Zm""", """yottametre"""...
289
0
"""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 _lowercase : str = logging.get_logger(__name__) _lo...
368
"""simple docstring""" import math import flax.linen as nn import jax.numpy as jnp def snake_case__ ( __lowerCamelCase : jnp.ndarray , __lowerCamelCase : int , __lowerCamelCase : float = 1 , __lowerCamelCase : float = 1 , __lowerCamelCase :...
272
0
import importlib.metadata import operator import re import sys from typing import Optional from packaging import version _snake_case = { "<": operator.lt, "<=": operator.le, "==": operator.eq, "!=": operator.ne, ">=": operator.ge, ">": operator.gt, } def A ( _lowerCamel...
36
'''simple docstring''' # Lint as: python3 import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.vers...
254
0
from __future__ import annotations from typing import Any class lowercase_ : def __init__( self , __UpperCamelCase = 6 ): """simple docstring""" UpperCamelCase_ = None UpperCamelCase_ = None self.create_linked_list(__UpperCamelCa...
261
from __future__ import annotations def lowerCamelCase__ ( a__ : list[list[int]] ) -> int: # preprocessing the first row for i in range(1 , len(matrix[0] ) ): matrix[0][i] += matrix[0][i - 1] # preprocessing the first column for i in...
261
1
from __future__ import annotations import collections import pprint from pathlib import Path def UpperCamelCase_( lowerCamelCase_ ) -> str: return "".join(sorted(lowerCamelCase_ ) ) def UpperCamelCase_( lowerCamelCase_ ) -> list[str]: return word_by_signature[signatur...
21
"""simple docstring""" 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...
113
0
# 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 applica...
216
from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class SCREAMING_SNAKE_CASE__ (__snake_case ): def __init__( self , a , ...
216
1
"""simple docstring""" class A_ : """simple docstring""" def __init__( self :List[str] , lowerCamelCase_ :list[int] ): """simple docstring""" lowerCamelCase__ : Any =len(lowerCamelCase_ ) ...
126
"""simple docstring""" import unittest from transformers import AlbertTokenizer, AlbertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin lowerCAmelCase = get_test...
126
1
import qiskit def UpperCamelCase( lowercase_ , lowercase_ ) -> qiskit.result.counts.Counts: '''simple docstring''' snake_case_ = qiskit.Aer.get_backend("""aer_simulator""" ) # Create a Quantum Circuit acting on the q register snake_case_ = qiskit....
34
from __future__ import annotations import csv import requests from bsa import BeautifulSoup def UpperCamelCase( lowercase_ = "" ) -> dict[str, float]: '''simple docstring''' snake_case_ = url or """https://www.imdb.com/chart/top/?ref_=nv_mv_250""" snake_case_ = ...
34
1
from __future__ import annotations lowercase : Tuple = """Muhammad Umer Farooq""" lowercase : List[str] = """MIT""" lowercase : Any = """1.0.0""" lowercase : str = """Muhammad Umer Farooq""" lowercase : List[str] = """...
20
from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_...
20
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_image_inputs if is_torch_availab...
351
from __future__ import annotations import unittest from transformers import 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_attention_mask ...
125
0
"""simple docstring""" def _snake_case ( lowercase__ ): if not isinstance(lowercase__ , lowercase__ ): raise ValueError('Input series is not valid, valid series - [2, 4, 6]' ) if len(lowercase__ ) == 0: raise ValueError('Input list must be a non ...
96
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCAmelCase :int = {'configuration_vit_msn': ['VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMSNConfig']} try: if not is_torch_available(): raise Option...
263
0
from __future__ import annotations from math import gcd def __lowerCamelCase ( __magic_name__ : int , __magic_name__ : int = 2 , __magic_name__ : int = 1 , __magic_name__ : int = 3 , ): # A value less than 2 can cause an infinite loop in the algorithm. ...
42
import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceFeat...
42
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : Any = logging.get_logger(__name__) UpperCAmelCase : Optional[int] = { "EleutherAI/gpt-neox-20b": "https://huggingface.co/EleutherAI/gpt-neox-20b/resolv...
115
import argparse import collections import json import os import re import string import sys import numpy as np snake_case : Dict = re.compile(R"\b(a|an|the)\b", re.UNICODE) snake_case : Optional[int] = None def lowerCAmelCase_ ( ) -> Union[str, Any]: '''simp...
281
0
def _UpperCamelCase ( snake_case__ ) -> bool: __UpperCAmelCase : Any = 0 for ch in input_str: __UpperCAmelCase : Optional[Any] = ord(snake_case__ ) __UpperCAmelCase : Union[str, Any] = p...
366
import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_vision, slow, torch_devic...
342
0
"""simple docstring""" def a_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ): '''simple docstring''' lowercase__ : List[str] = len(_lowerCAmelCase ) + 1 lowercase__ : Any = len(_lowerCAmelCase ) + 1 # dp is a 2d matrix where dp[i]...
77
import math import qiskit def lowerCamelCase ( SCREAMING_SNAKE_CASE = 1 , SCREAMING_SNAKE_CASE = 1 , SCREAMING_SNAKE_CASE = 1 ): '''simple docstring''' if ( isinstance(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) or isinstance(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CAS...
43
0
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import c...
78
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __snake_case = { '''configuration_llama''': ['''LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''LlamaConfig'''],...
78
1
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): impo...
273
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer __A : Dict = logging.get_logger(__name__) __A : An...
273
1
import os import string import sys lowerCAmelCase__ :List[str] = 1 << 8 lowerCAmelCase__ :Any = { """tab""": ord('''\t'''), """newline""": ord('''\r'''), """esc""": 2_7, """up""": 6_5 + ARROW_KEY_FLAG, """down""": 6_6 + ARROW_KEY_FLAG, """right""": ...
366
def lowerCAmelCase__ ( a__: int ) -> None: '''simple docstring''' _UpperCAmelCase = generate_pascal_triangle(a__ ) for row_idx in range(a__ ): # Print left spaces for _ in range(num_rows - row_idx - 1 ): print(end=' ' ) ...
185
0
"""simple docstring""" import inspect import unittest from transformers import MobileViTConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import Co...
261
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class snake_case__ ( snake_case_, snake_case_ ): @register_to_config def __init__( ...
261
1
'''simple docstring''' from __future__ import annotations def lowerCamelCase__ ( __lowerCamelCase : int ): '''simple docstring''' _UpperCAmelCase : Tuple =[True] * limit _UpperCAmelCase : int =False _UpperCAmelCase ...
242
'''simple docstring''' import warnings from ...utils import logging from .image_processing_deformable_detr import DeformableDetrImageProcessor lowercase =logging.get_logger(__name__) class __magic_name__ ( lowerCAmelCase ): def __init__( self , *snake_case , ...
242
1
import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStructProcessor, PixaStructTextConfig, Pix...
216
from __future__ import annotations import unittest from transformers import LEDConfig, 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 from ...test_pipeline_mixin impor...
216
1
'''simple docstring''' import numpy as np from matplotlib import pyplot as plt from sklearn.datasets import load_iris from sklearn.metrics import ConfusionMatrixDisplay from sklearn.model_selection import train_test_split from xgboost import XGBClassifier def _lowerCAmelCase ( lowerca...
359
'''simple docstring''' # A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V a...
46
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A =logging.get_logger(__name__) A ={ 'facebook/data2vec-text-base': 'https://huggingface.co/da...
34
'''simple docstring''' import os from distutils.util import strtobool def snake_case_ (_a : Union[str, Any] , _a : List[Any] ): for e in env_keys: UpperCAmelCase = int(os.environ.get(_a , -1 ) ) if val >= 0: return ...
34
1
"""simple docstring""" import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def _lowerCAmelCase ( lowercase_ ): UpperCAmelCase = FileLock(str(tmpdir / 'foo.lock' ) ) UpperCAmelCase = FileLock(str(tmpdir / 'foo...
360
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case_ = { """configuration_rember...
181
0
"""simple docstring""" def a__ ( SCREAMING_SNAKE_CASE : list[int] ): '''simple docstring''' if not numbers: return 0 if not isinstance(SCREAMING_SNAKE_CASE , (list, tuple) ) or not all( isinstance(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) ...
108
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ : Tuple = logging.get_logger(__name__) snake_case_ : Optional[int] = { "SCUT-DLVCLab/lilt-roberta-en-base": ( "https://huggingface.co/SCUT-DLVCLab/lilt-robe...
125
0
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transformers...
329
import argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() __a :str = logging.get_logger(__name__) def __snake_c...
329
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase : Union[str, Any] = { "configuration_blip_2": [ "BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP", "Blip2Config", "Blip2QFo...
42
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowercase : Any = { "configuration_chinese_clip": [ "CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "ChineseCLI...
42
1
'''simple docstring''' def UpperCamelCase__ ( lowerCAmelCase ): """simple docstring""" if edge <= 0 or not isinstance(__a , __a ): raise ValueError("""Length must be a positive.""" ) return 3 * ((25 + 10 * (5 ** (1 / 2))) *...
350
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch...
220
0
import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size from ..utils import assert_arrow_...
326
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 ( SwiftFormerConfig, SwiftFormerForImageClassification, ViTImageProcessor, ) from transformers.utils import logging logging.s...
326
1
"""simple docstring""" import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoMode...
358
import math def a ( SCREAMING_SNAKE_CASE_ : int ): """simple docstring""" assert isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ) and ( number >= 0 ), "'number' must been an int and positive" if 1...
315
0
"""simple docstring""" import os from datetime import datetime as dt from github import Github snake_case_ = [ """good first issue""", """feature request""", """wip""", ] def _lowerCAmelCase ( ): UpperCAmelCase = Github(os.environ['GITHUB...
78
"""simple docstring""" from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...sch...
78
1
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available from .timesteps import ( fastaa_timesteps, smartaa_timesteps...
254
"""simple docstring""" from ..utils import DummyObject, requires_backends class _lowerCAmelCase ( metaclass=a ): """simple docstring""" __magic_name__ :Optional[Any] = ["""onnx"""] def __init__( self , *__UpperCAmelCase , **__UpperCAmelCase ...
254
1
'''simple docstring''' from __future__ import annotations from PIL import Image # Define glider example a : Optional[int] = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, ...
56
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from ...
185
0
"""simple docstring""" from argparse import ArgumentParser from .env import EnvironmentCommand def __A ( ) -> List[Any]: __a : List[str] = ArgumentParser('''Diffusers CLI tool''' , usage='''diffusers-cli <command> [<args>]''') __a : Any ...
188
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
188
1
"""simple docstring""" import argparse import math import traceback import dateutil.parser as date_parser import requests def lowercase_ ( __UpperCAmelCase ) -> Union[str, Any]: lowerCAmelCase__ : List[Any] = {} lowerCAmelCase__ : Any = job[""...
242
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: def count_of_possible_combinations(__UpperCAmelCase ) -> int: if target < 0: return 0 if target == 0: r...
242
1
from argparse import ArgumentParser from . import BaseTransformersCLICommand def _a ( SCREAMING_SNAKE_CASE : Any ): """simple docstring""" return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) ...
358
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...
51
0
import flax.linen as nn import jax import jax.numpy as jnp class lowercase__( nn.Module ): """simple docstring""" a :int a :jnp.dtype = jnp.floataa def _lowercase ( self : List[Any] ) -> Union[str, Any]: lowercase_ = nn.Con...
30
"""simple docstring""" import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..tab...
46
0
import io import itertools import json from dataclasses import dataclass from typing import Optional import pyarrow as pa import pyarrow.json as paj import datasets from datasets.table import table_cast from datasets.utils.file_utils import readline _snake_case = datasets.utils.logging.get_logger(__name__) ...
300
class UpperCAmelCase_ : def __init__( self): '''simple docstring''' _lowerCAmelCase : Dict = 0 _lowerCAmelCase : Optional[int] = 0 _lowerCAmelCase : Tuple = {} ...
300
1
import os from datetime import datetime as dt from github import Github lowerCamelCase_ = [ '''good first issue''', '''good second issue''', '''good difficult issue''', '''enhancement''', '''new pipeline/model''', '''new scheduler''', '''wip''', ] def __magic_name__...
244
'''simple docstring''' # Algorithm for the pigeonhole sorting def a__ ( lowerCAmelCase__ ) -> Optional[Any]: UpperCAmelCase__ : Any = min(lowerCAmelCase__ ) # min() finds the minimum value UpperCAmelCase__ : Optional[int] = ...
181
0
'''simple docstring''' import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class a__ ( UpperCAmelCase__ , UpperCAmelCase__ ): @register_to_config def __init__( self : Any , *, ...
237
'''simple docstring''' import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteria...
237
1
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from transformers.utils impor...
329
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ :Dict = logging.get_logger(__name__) lowerCAmelCase__ :Optional[int] = {'''openai-gpt''': '''https://huggingface.co/openai-gpt/resolve/main/config.json'''} class __a ( UpperCAmelCas...
329
1
import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_confi...
361
'''simple docstring''' import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTe...
101
0
"""simple docstring""" _a = [ [0, 16, 13, 0, 0, 0], [0, 0, 10, 12, 0, 0], [0, 4, 0, 0, 14, 0], [0, 0, 9, 0, 0, 20], [0, 0, 0, 7, 0, 4], [0, 0, 0, 0, 0, 0], ] def _A ( UpperCamelCase_ : List[Any], UpperCamelCase_ : Optional[Any], UpperCamelCase_ ...
17
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar _UpperCamelCase : Any = TypeVar('T') class a ( Generic[T] ): def __init__( self , _lowerCamelCase ): lowercase = ...
220
0
import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ....
351
"""simple docstring""" import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever lowerCAmelCase__ = logging.getLogger(__name__) class __snake_case ( _lowercase): def ...
175
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging....
243
"""simple docstring""" from manim import * class lowercase_ ( __lowerCAmelCase ): '''simple docstring''' def lowerCAmelCase_ ( self : Dict ): _A = Rectangle(height=0.5 , width=0.5 ) _A = Rectangle(height=0.46 , ...
315
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 tr...
187
'''simple docstring''' from __future__ import annotations def _snake_case ( _SCREAMING_SNAKE_CASE : int | str ) -> bool: """simple docstring""" lowerCAmelCase = str(_SCREAMING_SNAKE_CASE ) return n == n[::-1] def _snake_c...
187
1
'''simple docstring''' import argparse import os import re import packaging.version _UpperCamelCase = '''examples/''' _UpperCamelCase = { '''examples''': (re.compile(r'''^check_min_version\("[^"]+"\)\s*$''', re.MULTILINE), '''check_min_version("VERSION")\n'''), '''init''': (r...
254
'''simple docstring''' from sklearn.metrics import fa_score import datasets _UpperCamelCase = ''' The F1 score is the harmonic mean of the precision and recall. It can be computed with the equation: F1 = 2 * (precision * recall) / (precision + recall) ''' _UpperCamelCase = ''' Args: ...
254
1
import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets lowerCAmelCase__ : List[str] ='''\ @inproceedings{popovic-2015-chrf, title = "chr{F}: character n-gram {F}-score for automatic {MT} evaluation", author = "Popovi{\'c}, Maja", booktit...
370
import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def __lowercase ( a__ ) -> List[Any]: # picklable for multiprocessing...
118
0
import inspect import unittest from transformers import DecisionTransformerConfig, 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...
188
import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def UpperCAmelCase__ ( _A : int = 3 ): '''simple docstring''' if isinstance(_A , _A ): raise TypeError('''number of qubits must be a i...
188
1
from __future__ import annotations import requests __SCREAMING_SNAKE_CASE : Tuple = set( 'approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post category clicked content_categori...
284
from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, id...
284
1
'''simple docstring''' import unittest from queue import Empty from threading import Thread from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available from transformers.testing_utils import CaptureStdout, require_torch, torch_device from ..test_modeling_common import ids_tensor ...
318
snake_case_ : Dict = { "Pillow": "Pillow", "accelerate": "accelerate>=0.11.0", "compel": "compel==0.1.8", "black": "black~=23.1", "datasets": "datasets", "filelock": "filelock", "flax": "flax>=0.4.1", "hf-doc-builder": "hf-doc-builder>=0.3.0", "huggingfa...
51
0
import os import socket from contextlib import contextmanager import torch from ..commands.config.default import write_basic_config # noqa: F401 from ..state import PartialState from .dataclasses import DistributedType from .imports import is_deepspeed_available, is_tpu_available from .transformer_engine import co...
367
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ = logging.get_logger(__name__) snake_case_ = { '''facebook/s2t-wav2vec2-large-en-de''': ( '''https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/config.json''' ), # S...
216
0
from __future__ import annotations SCREAMING_SNAKE_CASE_ = [True] * 1_0_0_0_0_0_1 SCREAMING_SNAKE_CASE_ = 2 while i * i <= 1_0_0_0_0_0_0: if seive[i]: for j in range(i * i, 1_0_0_0_0_0_1, i): SCREAMING_SNAKE_CASE_ = False ...
296
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 OptionalDependencyNotAva...
278
0
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex from .utils import require_elast...
361
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, TimestepE...
228
0
'''simple docstring''' print((lambda quine: quine % quine)("print((lambda quine: quine %% quine)(%r))"))
237
'''simple docstring''' from __future__ import annotations def UpperCamelCase ( _lowerCamelCase : list[int | str] ): create_state_space_tree(_lowerCamelCase , [] , 0 , [0 for i in range(len(_lowerCamelCase ) )] ) def ...
237
1
def __magic_name__ ( __a : int , __a : int ): '''simple docstring''' while a != 0: UpperCamelCase__ , UpperCamelCase__ = b % a, a return b def __magic_name__ ( __a : int , __a : int ): '''simple docstring''' ...
178
import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def __magic_name__ ( __a : Any ): # picklable for multiprocessing ''...
178
1
'''simple docstring''' from sklearn.metrics import matthews_corrcoef import datasets __snake_case = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classifications. It take...
97
import random from .binary_exp_mod import bin_exp_mod def UpperCamelCase ( lowerCAmelCase__ , lowerCAmelCase__=1000 ): '''simple docstring''' if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd lowercase = n - 1 ...
101
0
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass lowercase__ =(3, 9, -11, 0, 7, 5, 1, -1) lowercase__ =(4, 6, 2, 0, 8, 10, 3, -2) @dataclass class UpperCamelCase__ : _SCREAMING_SNAKE_CASE : int _SCREAMING_SNAKE_...
90
import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCamelCase__ ( __lowercase ,unittest.TestCase ): _SCREAMING_SNAKE_CASE : Union[str, Any] = Ph...
90
1
import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, ...
20
def __lowercase ( lowerCamelCase : str , lowerCamelCase : str ): def get_matched_characters(lowerCamelCase : str , lowerCamelCase : str ) -> str: UpperCamelCase_ : Tuple = [] UpperCamelCase_ : List[Any] = min(len(_stra ) , len(_stra ) ) /...
175
0
'''simple docstring''' import argparse import copy def _UpperCamelCase ( UpperCamelCase__ ): UpperCAmelCase__ : Dict = {} with open(UpperCamelCase__ ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: ...
283
'''simple docstring''' from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _snake_case ( ...
283
1
def lowerCamelCase__ ( _A ): '''simple docstring''' if len(_A ) < 2: return collection def circle_sort_util(_A , _A , _A ) -> bool: snake_case_ = False if low == high: return swapped snake_case_ = low ...
187
import numpy class UpperCAmelCase : '''simple docstring''' def __init__( self : Union[str, Any] , __lowercase : numpy.ndarray , __lowercase : numpy.ndarray ): """simple docstring""" ...
187
1
"""simple docstring""" import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging UpperCAmelCase: int = logging.get_logger(__name__) UpperCAmelCase: List[An...
336
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_visio...
336
1
lowerCamelCase : str = "0.21.0" from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_dispatch, ) from .data_loader import skip_fir...
124
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torchaudio_available from ...test_configura...
118
0
"""simple docstring""" import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow UpperCAmelCase =logging.getLogger() @unittest.skip('''T...
77
"""simple docstring""" def _A ( _a : Optional[int] ): """simple docstring""" A = [] A = set({"""(""", """[""", """{"""} ) A = set({""")""", """]""", """}"""} ) A ...
77
1
def a_ ( lowerCAmelCase_ : str ): return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(lowerCAmelCase_ ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('doctest').testmod()
284
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def a_ ( lowerCAmelCase_ : Optional[int...
284
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = { "SCUT-DLVCLab/lilt-roberta-en-base": ( "https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/resolve/main/config.json" ...
354
import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin Up...
143
0
'''simple docstring''' import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) _A : Union[str, Any] = { '''sample_size''': 32, '''in_channels''': 3, '''out_channels''': 3, ...
229
def __UpperCamelCase ( lowerCAmelCase__ : int = 5_0_0_0_0_0_0_0 ): __a : int = set() __a : str = int((limit - 2_4) ** (1 / 2) ) __a : int = set(range(3 , prime_square_limit + 1 , 2 ) ) primes.add(2 ) for p in range(3 , prime_square_limit + 1 , 2 ): if p...
216
0
'''simple docstring''' import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLICommand if ...
371
'''simple docstring''' from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging l...
48
0
import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLICommand if not is_tf_available() an...
50
from math import pi, sqrt def __A ( __lowerCamelCase ) -> float: if num <= 0: raise ValueError("""math domain error""" ) if num > 171.5: raise OverflowError("""math range error""" ) elif num - int(__lowerCamelCase ) not in (0, 0.5): raise NotImplementedError...
228
0
'''simple docstring''' from math import factorial, radians def _UpperCAmelCase ( _UpperCamelCase : float, _UpperCamelCase : int = 18, _UpperCamelCase : int = 10 ) -> float: A_ = angle_in_degrees - ((angle_in_degrees // 3_6_0.0) * 3_6_0.0...
18
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from typing import Optional import evaluate import numpy as np import torch from datasets import load_dataset from PIL import Image from torchvision.transforms import ( CenterCrop, Compose, Normalize, ...
18
1
from __future__ import annotations import math class UpperCamelCase_ : '''simple docstring''' def __init__( self , a ) -> None: snake_case_ = size # approximate the overall size of segment tree with given value snake_case_ = ...
178
import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments lowercase = logging.getLogger(__name__) @dataclass class UpperCamelCase_ ( snake_case_ ): '''simple docstr...
178
1
def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : str) -> bool: '''simple docstring''' __UpperCamelCase : Union[str, Any] = [int(_lowerCamelCase) for i in ip_va_address.split(".") if i.isdigit()] return len(_lowerCamelCase) == 4 and all(0 <= int(_lowerCa...
366
from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PI...
151
0
def lowerCamelCase_ ( UpperCamelCase__ : list ) -> list: """simple docstring""" if len(UpperCamelCase__ ) <= 1: return [tuple(UpperCamelCase__ )] __lowerCamelCase = [] def generate(UpperCamelCase__ : i...
90
import collections import inspect import unittest from transformers import FocalNetConfig 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 impo...
90
1
"""simple docstring""" import sys from collections import defaultdict class A_ : '''simple docstring''' def __init__( self ): """simple docstring""" UpperCAmelCase_ : List[Any] = [] def UpperCamelCase__ ( self , lowercase_ ): """simple docst...
23
"""simple docstring""" import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class A_ (unittest.TestCase ): '''simple docstring''' def Upp...
23
1
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase_ ( UpperCamelCase ): '''simple docstring''' __A : int = (UnCLIPScheduler,) def _snake_case ( self , **__A ): ...
283
def lowercase_( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' for i in range(len(SCREAMING_SNAKE_CASE_ ) - 1 , 0 , -1 ): lowerCamelCase : Tuple = False for j in range(SCREAMING_SNAKE_CASE_ , 0 , -1 ): if unsorted[j] < unsorted[j...
283
1
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase : Any = logging.get_logger(__name__) _lowerCamelCase : Any = { '''vocab_file''': '''vocab.json'''...
364
import contextlib from multiprocessing import Pool, RLock from tqdm.auto import tqdm from ..utils import experimental, logging _lowerCamelCase : Union[str, Any] = logging.get_logger(__name__) class lowercase : lowercase__ : str = None @experi...
206
0
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging _lowerCamelCase : Optional[Any] = logging.get_logger(__name__) _lowerCamelCase : Dict = {"voca...
336
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.mod...
336
1
"""simple docstring""" def lowerCamelCase_( _lowerCamelCase ) -> list: '''simple docstring''' if n_term == "": return [] _lowerCamelCase : list = [] for temp in range(int(_lowerCamelCase ) ): series.append(F"""1/{temp + 1}""" if series else "1" )...
340
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def lowerCamelCase_( _lowerCamelCase ) -> Tuple: '''simple docstring''' _lowerC...
340
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( Diffusio...
77
"""simple docstring""" from . import __version__ # Backward compatibility imports, to make sure all those objects can be found in file_utils from .utils import ( CLOUDFRONT_DISTRIB_PREFIX, CONFIG_NAME, DISABLE_TELEMETRY, DUMMY_INPUTS, DUMMY_MASK, ENV_VARS_TRUE_AND_AUTO_VALUES, ENV_VARS...
77
1
from ...utils import deprecate from ..controlnet.pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline # noqa: F401 deprecate( 'stable diffusion controlnet', '0.22.0', 'Importing `FlaxStableDiffusionControlNetPipeline` from diffusers.pipelines.stable_diffusion.flax_pipeli...
351
from __future__ import annotations import unittest from transformers import 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_attention_mask fro...
221
0
import gc import unittest from transformers import CTRLConfig, 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 ModelTesterMi...
303
from abc import ABC, abstractmethod from argparse import ArgumentParser class __snake_case ( _lowerCamelCase ): @staticmethod @abstractmethod def __a ( __UpperCamelCase ) -> Dict: '''simple docstring''' raise NotImplementedEr...
143
0
'''simple docstring''' import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCam...
299
'''simple docstring''' from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, SMALL_MOD...
299
1
from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_co...
327
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, is_vision_available, ) SCREAMING_SNAKE_CASE__ : List[Any] = {'processing_layoutxlm'...
48
0
"""simple docstring""" def lowerCamelCase_ ( UpperCamelCase__ : int = 1000 ): '''simple docstring''' UpperCamelCase__ = 2**power UpperCamelCase__ = 0 while n: UpperCamelCase__ , UpperCamelCase__ = ...
362
def lowerCamelCase_ ( UpperCamelCase__ : list[int], UpperCamelCase__ : list[int], UpperCamelCase__ : int ): '''simple docstring''' return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(UpperCamel...
35
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __lowerCamelCase : Optional[Any] = logging.get_logger(__name__) __lowerCamelCase : Tuple = {...
18
def _snake_case ( lowerCAmelCase : int ): """simple docstring""" SCREAMING_SNAKE_CASE_ : Tuple = int(lowerCAmelCase ) if decimal in (0, 1): # Exit cases for the recursion return str(lowerCAmelCase ) SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ : Dict ...
18
1
import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline SCREAMING_SNAKE_CASE__ = { 'n_samples': 6_4, 'horizon': 3_2, 'num_inference_steps': 2_0, 'n_guide_steps': 2, # can set to 0 for faster sampling, does not use value net...
366
'''simple docstring''' import importlib import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Union import torch from ..utils import BaseOutput SCREAMING_SNAKE_CASE__ = 'scheduler_config.json' class a_ ( ...
183
0
import numpy as np def SCREAMING_SNAKE_CASE ( __lowerCAmelCase ) -> Dict: return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
189
'''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 Dif...
151
0
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionPanoramaPipeline, ...
295
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 ...modeling_outputs import ( BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWit...
295
1
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor ...
23
'''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
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor __A : int = logging.get_logger(__name__) class __UpperCamelCase ( _A ): def __init__(self : Union[str, Any] , *__SCREAMING_SNAKE_CASE : ...
57
"""simple docstring""" from __future__ import annotations class __UpperCamelCase : def __init__(self : Optional[Any] , __SCREAMING_SNAKE_CASE : str , __SCREAMING_SNAKE_CASE : str): A , A = text, pattern A , A = len(__SCREAMING_SNAKE_C...
57
1
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging __a: Dict = logging.get_logger(__name__) __a: Dict = { '''google/umt5-small''': '''https://huggingface.co/google...
198
'''simple docstring''' import argparse import json import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( VideoMAEConfig, VideoMAEForPreTraining, VideoMAEForVideoClassification, VideoMAEImageProcessor, ) def a ( lowerCamelCase_...
206
0
import numpy as np class UpperCamelCase : def __init__( self ): A__ = (0, 0) A__ = None A__ = 0 A__ = 0 A__ = 0 def __eq__( self , UpperCAmelCase__ ): return self.position == c...
198
from __future__ import annotations from random import random class UpperCamelCase : def __init__( self , UpperCAmelCase__ = None ): A__ = value A__ = random() A__ = None A__ = None def __repr__( self )...
198
1
def _a ( UpperCamelCase_ : str ) -> list: """simple docstring""" if n_term == "": return [] lowerCAmelCase__ = [] for temp in range(int(UpperCamelCase_ ) ): series.append(F"1/{temp + 1}" if series else "1" ...
340
from collections import defaultdict def _a ( UpperCamelCase_ : int ) -> int: """simple docstring""" lowerCAmelCase__ = 1 lowerCAmelCase__ = True for v in tree[start]: if v not in visited: ret += df...
340
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers....
369
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCAmelCase : Union[str, Any] = { "configuration_roform...
202
0
"""simple docstring""" import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() __lowerCamelCas...
221
"""simple docstring""" from __future__ import annotations import unittest from transformers import 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, rand...
221
1
def _A ( SCREAMING_SNAKE_CASE : float ): """simple docstring""" if edge <= 0 or not isinstance(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): raise ValueError("Length must be a positive." ) return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2)) * (edg...
367
UpperCAmelCase : Dict = [0, 2, 4, 6, 8] UpperCAmelCase : Tuple = [1, 3, 5, 7, 9] def _A ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : list[int] , SCREAMING_SNAKE_CASE : int ): "...
148
0
import unittest from transformers import BigBirdConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax from transformers.models.big_bird.modeling_f...
299
from cva import destroyAllWindows, imread, imshow, waitKey def A__ ( __lowerCamelCase ): # getting number of pixels in the image SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ = img.shape[0], img.shape[1] # converting each pixel's color to its negative for i in range(__lowerCa...
299
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(__lowerCamelCase ) , 'Tato...
357
"""simple docstring""" 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_image_inputs if is_torch...
317
0