code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar __UpperCAmelCase = TypeVar('''KEY''') __UpperCAmelCase = TypeVar('''VAL''') @dataclass(frozen=a__ , slots=a__ ) class lowerCAmelCase_ ( Generic[KEY, VA...
40
'''simple docstring''' from typing import List import numpy as np def a_ ( __snake_case : dict ) -> int: """simple docstring""" lowerCamelCase_ ={key: len(__snake_case ) for key, value in gen_kwargs.items() if isinstance(__snake_case , __snake_case )} if le...
676
0
'''simple docstring''' def _A ( A__ = 50 ): """simple docstring""" __lowercase = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length + 1 ): ways_number[row_length] += ways_n...
41
'''simple docstring''' import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""...
676
0
'''simple docstring''' import doctest from collections import deque import numpy as np class UpperCAmelCase : '''simple docstring''' def __init__( self ) -> None: '''simple docstring''' lowerCamelCase_ = [2, 1, 2, -1] lowerCamelCase_ = [1...
42
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : str = logging.get_logger(__name__) a_ : int = { """RUCAIBox/mvp""": """https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json""", } class __Uppe...
676
0
from datetime import datetime import matplotlib.pyplot as plt import torch def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" for param in module.parameters(): lowercase__ = False def _a ( ): """simple docstring""" lowercase__ = '''cuda''...
43
'''simple docstring''' 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 a_ : int = logging.get_logger(__name__) a_ : str = {"""vocab...
676
0
'''simple docstring''' def A_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ): """simple docstring""" _lowerCamelCase : str = len(_lowerCAmelCase ) + 1 _lowerCamelCase : Dict = len(_lowerCAmelCase ) + 1 # dp is a 2d matrix...
44
'''simple docstring''' from collections.abc import Sequence def a_ ( __snake_case : Sequence[float] , __snake_case : float ) -> float: """simple docstring""" return sum(c * (x**i) for i, c in enumerate(__snake_case ) ) def a_ ( __snake_case : Se...
676
0
from __future__ import annotations UpperCamelCase = 8.988E9 # units = N * m^s * C^-2 def A ( lowercase__ : float , lowercase__ : float , lowercase__ : float , lowercase__ : float ) -> dict[str, float]: UpperCamelCase__ :Optional[int] = abs(chargea * chargea ) i...
45
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __UpperCamelCase ( lowerCamelCase__ ): lowercase : Optional[int] =['image_processor', 'tokenizer'] lowercase : ...
676
0
"""simple docstring""" from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test impor...
46
'''simple docstring''' from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image ...
676
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE__ = {'''configuration_xlnet''': ['''XLNET_P...
47
'''simple docstring''' import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def a_ ( __snake_case : Optional[int] , __snake_case : Union[str, Any] , __sn...
676
0
'''simple docstring''' import logging import os import quant_trainer import torch from torch.utils.data import DataLoader from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput UpperCAmelCase__ : str = logging.getLogger(__name__) if is_torch_...
48
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Union[str, Any] = logging.get_logger(__name__) a_ : Optional[int] = { """BAAI/AltCLIP""": """https://huggingface.co/BAAI/AltC...
676
0
"""simple docstring""" import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, ) from ..t...
49
'''simple docstring''' import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mo...
676
0
'''simple docstring''' from __future__ import annotations UpperCamelCase : Optional[int] = 10 def A__ ( __lowerCAmelCase : list[int] ): lowerCamelCase__ = 1 lowerCamelCase__ = max(__lowerCAmelCase ) while placement <= max_digit: ...
50
'''simple docstring''' import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .utils import logging a_ :...
676
0
'''simple docstring''' import logging import os from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional from tqdm import auto as tqdm_lib a__ : str ...
51
'''simple docstring''' def a_ ( __snake_case : str , __snake_case : str ) -> str: """simple docstring""" lowerCamelCase_ =len(__snake_case ) lowerCamelCase_ =len(__snake_case ) lowerCamelCase_ =( first_str_length if first_str_length...
676
0
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotSmallConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin ...
52
'''simple docstring''' # Copyright 2023 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 ...
676
0
from __future__ import annotations import math from collections.abc import Callable def a_ ( lowerCAmelCase_ : Callable[[int | float], int | float], lowerCAmelCase_ : int | float, lowerCAmelCase_ : int | float, lowerCAmelCase_ : int = 100, ): __lowerCAmelCase...
53
'''simple docstring''' import functools def a_ ( __snake_case : str , __snake_case : str ) -> int: """simple docstring""" lowerCamelCase_ =len(__snake_case ) lowerCamelCase_ =len(__snake_case ) @functools.cache def min_distance(__sna...
676
0
from __future__ import annotations import os from collections.abc import Mapping __lowercase : List[str] =tuple[int, int] class A : def __init__( self: Any , _lowerCAmelCase: set[int] , _lowerCAmelCase: Mapping[EdgeT, int] ) -> None: ...
54
'''simple docstring''' def a_ ( __snake_case : int ) -> bool: """simple docstring""" if not isinstance(__snake_case , __snake_case ): lowerCamelCase_ =F'''Input value of [number={number}] must be an integer''' raise TypeError(__snake_case ) ...
676
0
import os from typing import Dict, List, Tuple, TypeVar, Union SCREAMING_SNAKE_CASE :Optional[Any] = TypeVar('T') SCREAMING_SNAKE_CASE :Dict = Union[List[T], Tuple[T, ...]] SCREAMING_SNAKE_CASE :Optional[Any] = Union[T, List[T], Dict[str, T]] SCREAMING_SNAKE_CASE ...
55
'''simple docstring''' from __future__ import annotations a_ : int = list[list[int]] # assigning initial values to the grid a_ : Matrix = [ [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...
676
0
'''simple docstring''' from __future__ import annotations _a : Dict = list[tuple[int, int]] _a : str = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0,...
56
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Union[str, Any] = logging.get_logger(__name__) a_ : Tuple = { """huggingface/informer-tourism-monthly""": ( """https://hugg...
676
0
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switc...
57
'''simple docstring''' from __future__ import annotations def a_ ( __snake_case : int ) -> list[int]: """simple docstring""" lowerCamelCase_ =[True] * limit lowerCamelCase_ =False lowerCamelCase_ =False lowerCamelCase_ =True for i i...
676
0
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from dif...
58
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __UpperCamelCase ( lowerCamelCase__ ): def __i...
676
0
__A = { "Pillow": "Pillow<10.0.0", "accelerate": "accelerate>=0.20.3", "av": "av==9.2.0", "beautifulsoup4": "beautifulsoup4", "black": "black~=23.1", "codecarbon": "codecarbon==1.2.0", "cookiecutter": "cookiecutter==1.7.3", "dataclasses": "dataclasses", "datasets...
59
'''simple docstring''' from maths.prime_check import is_prime def a_ ( __snake_case : int ) -> int: """simple docstring""" if not isinstance(__snake_case , __snake_case ): lowerCamelCase_ =F'''Input value of [number={number}] must be an integer''' ...
676
0
import math import sys def lowerCamelCase_ ( _UpperCamelCase ) -> str: """simple docstring""" snake_case_ : Any = '''''' try: with open(_UpperCamelCase , '''rb''' ) as binary_file: snake_case_ : Dict ...
60
'''simple docstring''' # DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import B...
676
0
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class __lowerCamelCase : """simple docstring""" snake_case__ = 42 snake_case__ = None ...
61
'''simple docstring''' def a_ ( __snake_case : int , __snake_case : int ) -> str: """simple docstring""" if not isinstance(__snake_case , __snake_case ): raise ValueError('''iterations must be defined as integers''' ) if not isinstance(__snak...
676
0
import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processor import AttnAdde...
62
'''simple docstring''' from typing import List import numpy as np def a_ ( __snake_case : dict ) -> int: """simple docstring""" lowerCamelCase_ ={key: len(__snake_case ) for key, value in gen_kwargs.items() if isinstance(__snake_case , __snake_case )} if le...
676
0
def lowerCamelCase__ ( __lowerCamelCase : Dict , __lowerCamelCase : Tuple ): __UpperCAmelCase : Optional[Any] = """""" for i in table: res += inp[i - 1] return res def lowerCamelCase__ ( __lowerCamelCase : Tuple ...
63
'''simple docstring''' import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""...
676
0
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space_optuna, default_hp_...
64
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : str = logging.get_logger(__name__) a_ : int = { """RUCAIBox/mvp""": """https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json""", } class __Uppe...
676
0
"""simple docstring""" import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from transformer...
65
'''simple docstring''' 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 a_ : int = logging.get_logger(__name__) a_ : str = {"""vocab...
676
0
import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) UpperCamelCase = { "sample_size": 32, "in_channels": 3, "out_channels": 3, "layers_per_block": 2, "num_class_embeds": 1_000, "blo...
66
'''simple docstring''' from collections.abc import Sequence def a_ ( __snake_case : Sequence[float] , __snake_case : float ) -> float: """simple docstring""" return sum(c * (x**i) for i, c in enumerate(__snake_case ) ) def a_ ( __snake_case : Se...
676
0
import math def SCREAMING_SNAKE_CASE__ ( snake_case__ :int ) -> list[int]: _lowercase = [] _lowercase = 2 _lowercase = int(math.sqrt(snake_case__ ) ) # Size of every segment _lowercase = [True] * (end + 1) _lowercase =...
67
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __UpperCamelCase ( lowerCamelCase__ ): lowercase : Optional[int] =['image_processor', 'tokenizer'] lowercase : ...
676
0
from __future__ import annotations __A = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def lowercase__ ( A_: list[list[int]] , A_: list[int] , A_: list[int] , A_: int , A_: list[list[int]] , ) -> ...
68
'''simple docstring''' from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image ...
676
0
'''simple docstring''' 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 ...
69
'''simple docstring''' import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def a_ ( __snake_case : Optional[int] , __snake_case : Union[str, Any] , __sn...
676
0
from sklearn.metrics import matthews_corrcoef import datasets lowerCamelCase : Optional[Any] = "\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass classifi...
70
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Union[str, Any] = logging.get_logger(__name__) a_ : Optional[int] = { """BAAI/AltCLIP""": """https://huggingface.co/BAAI/AltC...
676
0
'''simple docstring''' import json import sys def a__ ( _SCREAMING_SNAKE_CASE : Optional[Any] , _SCREAMING_SNAKE_CASE : int ) -> Tuple: """simple docstring""" with open(_SCREAMING_SNAKE_CASE , encoding="utf-8" ) as f: UpperCAmelCase_ : ...
71
'''simple docstring''' import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mo...
676
0
'''simple docstring''' # Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def UpperCamelCase ( lowercase_ : Tuple , lowercase_ : Union[str, Any] , lowercase_ : Optional[int] , lowercase_ : Dict ) -> Optional[Any]: '''s...
72
'''simple docstring''' import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .utils import logging a_ :...
676
0
from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Dict = logging.get_logger(__name__) a_ : List[str] = { 'studio-ousia/luke-base': 'https://huggingface.co/studio-ousia/luke-base/resolve/main/config.json', 'studio-ousia/luke-large': ...
73
'''simple docstring''' def a_ ( __snake_case : str , __snake_case : str ) -> str: """simple docstring""" lowerCamelCase_ =len(__snake_case ) lowerCamelCase_ =len(__snake_case ) lowerCamelCase_ =( first_str_length if first_str_length...
676
0
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf lowercase_ = logging.get_logger(__name__) @dataclass c...
74
'''simple docstring''' # Copyright 2023 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 ...
676
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import EsmConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_...
75
'''simple docstring''' import functools def a_ ( __snake_case : str , __snake_case : str ) -> int: """simple docstring""" lowerCamelCase_ =len(__snake_case ) lowerCamelCase_ =len(__snake_case ) @functools.cache def min_distance(__sna...
676
0
"""simple docstring""" import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class UpperCAmelCase_ : UpperCamelCase =None def _lowerCamelCase ( self ) -> str: __lowercase : Union[s...
76
'''simple docstring''' def a_ ( __snake_case : int ) -> bool: """simple docstring""" if not isinstance(__snake_case , __snake_case ): lowerCamelCase_ =F'''Input value of [number={number}] must be an integer''' raise TypeError(__snake_case ) ...
676
0
"""simple docstring""" def _UpperCamelCase ( UpperCamelCase ) -> str: """simple docstring""" __UpperCAmelCase : int = [] __UpperCAmelCase : Optional[int] = [] __UpperCAmelCase : Union[str, Any] = ...
77
'''simple docstring''' from __future__ import annotations a_ : int = list[list[int]] # assigning initial values to the grid a_ : Matrix = [ [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...
676
0
'''simple docstring''' SCREAMING_SNAKE_CASE_: List[str] ={ 'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.', 'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..', 'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.', 'S': '...', 'T': '-', '...
78
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Union[str, Any] = logging.get_logger(__name__) a_ : Tuple = { """huggingface/informer-tourism-monthly""": ( """https://hugg...
676
0
from collections import deque from .hash_table import HashTable class UpperCAmelCase_ ( __lowerCamelCase ): def __init__( self , *_lowerCAmelCase , **_lowerCAmelCase ): super().__init__(*_lowerCAmelCase , **_lowerCAmelCase ) ...
79
'''simple docstring''' from __future__ import annotations def a_ ( __snake_case : int ) -> list[int]: """simple docstring""" lowerCamelCase_ =[True] * limit lowerCamelCase_ =False lowerCamelCase_ =False lowerCamelCase_ =True for i i...
676
0
import unittest from transformers import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device if is_torch_available(): import torch from transformers import AutoModelForImageClassification if is_vision_available(): ...
80
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __UpperCamelCase ( lowerCamelCase__ ): def __i...
676
0
from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common...
81
'''simple docstring''' from maths.prime_check import is_prime def a_ ( __snake_case : int ) -> int: """simple docstring""" if not isinstance(__snake_case , __snake_case ): lowerCamelCase_ =F'''Input value of [number={number}] must be an integer''' ...
676
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase = logging.get_logger(__name__) lower...
82
'''simple docstring''' # DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import B...
676
0
"""simple docstring""" from typing import List import numpy as np def snake_case_ ( A_ : dict ): '''simple docstring''' _lowerCamelCase : List[Any] = {key: len(A_ ) for key, value in gen_kwargs.items() if isinstance(A_, A_ )} if le...
83
'''simple docstring''' def a_ ( __snake_case : int , __snake_case : int ) -> str: """simple docstring""" if not isinstance(__snake_case , __snake_case ): raise ValueError('''iterations must be defined as integers''' ) if not isinstance(__snak...
676
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
84
'''simple docstring''' from typing import List import numpy as np def a_ ( __snake_case : dict ) -> int: """simple docstring""" lowerCamelCase_ ={key: len(__snake_case ) for key, value in gen_kwargs.items() if isinstance(__snake_case , __snake_case )} if le...
676
0
import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( BarkCoarseConfig, Bar...
85
'''simple docstring''' import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""...
676
0
def __snake_case ( __UpperCamelCase : str ,__UpperCamelCase : int ): """simple docstring""" return [sentence[i : i + ngram_size] for i in range(len(__UpperCamelCase ) - ngram_size + 1 )] if __name__ == "__main__": from doctest import testmod testmod(...
86
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : str = logging.get_logger(__name__) a_ : int = { """RUCAIBox/mvp""": """https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json""", } class __Uppe...
676
0
import numpy as np def SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ ) -> np.ndarray: """simple docstring""" return np.where(vector > 0 , lowercase_ , (alpha * (np.exp(lowercase_ ) - 1)) ) if __name__ == "__main__": import doctest doctest...
87
'''simple docstring''' 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 a_ : int = logging.get_logger(__name__) a_ : str = {"""vocab...
676
0
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowercase__ ( metaclass=A_ ): __UpperCAmelCase = ['''torch''', '''scipy'''] def __init__( self , *SCREAMING_SNAKE_CASE , **SCREAMING_SNAKE_CASE) -> str: ...
88
'''simple docstring''' from collections.abc import Sequence def a_ ( __snake_case : Sequence[float] , __snake_case : float ) -> float: """simple docstring""" return sum(c * (x**i) for i, c in enumerate(__snake_case ) ) def a_ ( __snake_case : Se...
676
0
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin from .feature_extraction_wavaveca import WavaVecaFeatureExtractor from .tokenization_wavaveca import WavaVecaCTCTokenizer class _lowerCamelCase( _a ): lowercase_ : Dict = """Wa...
89
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __UpperCamelCase ( lowerCamelCase__ ): lowercase : Optional[int] =['image_processor', 'tokenizer'] lowercase : ...
676
0
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/...
90
'''simple docstring''' from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image ...
676
0
"""simple docstring""" import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvision.t...
91
'''simple docstring''' import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def a_ ( __snake_case : Optional[int] , __snake_case : Union[str, Any] , __sn...
676
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { """sh...
92
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Union[str, Any] = logging.get_logger(__name__) a_ : Optional[int] = { """BAAI/AltCLIP""": """https://huggingface.co/BAAI/AltC...
676
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __A = { """configuration_falcon""": ["""FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FalconConfig"""], } try: if not is_torch_a...
93
'''simple docstring''' import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mo...
676
0
'''simple docstring''' import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils ...
94
'''simple docstring''' import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .utils import logging a_ :...
676
0
"""simple docstring""" from typing import Dict, List, Optional, Tuple, Union import torch from ...models import AutoencoderKL, TransformeraDModel from ...schedulers import KarrasDiffusionSchedulers from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput clas...
95
'''simple docstring''' def a_ ( __snake_case : str , __snake_case : str ) -> str: """simple docstring""" lowerCamelCase_ =len(__snake_case ) lowerCamelCase_ =len(__snake_case ) lowerCamelCase_ =( first_str_length if first_str_length...
676
0
"""simple docstring""" import math from datetime import datetime, timedelta def a ( __UpperCAmelCase : int ) -> datetime: __magic_name__: str = year % 1_9 __magic_name__: Any = year % 4 __magic_name__: Dict = ...
96
'''simple docstring''' # Copyright 2023 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 ...
676
0
import multiprocessing import os from typing import BinaryIO, Optional, Union import fsspec from .. import Dataset, Features, NamedSplit, config from ..formatting import query_table from ..packaged_modules.json.json import Json from ..utils import logging from ..utils.typing import NestedDataStructureLike...
97
'''simple docstring''' import functools def a_ ( __snake_case : str , __snake_case : str ) -> int: """simple docstring""" lowerCamelCase_ =len(__snake_case ) lowerCamelCase_ =len(__snake_case ) @functools.cache def min_distance(__sna...
676
0
'''simple docstring''' from math import pi, sqrt, tan def a__ ( lowercase : float ) -> float: """simple docstring""" if side_length < 0: raise ValueError('''surface_area_cube() only accepts non-negative values''' ) return 6 * side_length**2 ...
98
'''simple docstring''' def a_ ( __snake_case : int ) -> bool: """simple docstring""" if not isinstance(__snake_case , __snake_case ): lowerCamelCase_ =F'''Input value of [number={number}] must be an integer''' raise TypeError(__snake_case ) ...
676
0
import warnings from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeatur...
99
'''simple docstring''' from __future__ import annotations a_ : int = list[list[int]] # assigning initial values to the grid a_ : Matrix = [ [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...
676
0
from typing import Dict, Optional import numpy as np import datasets _A : Optional[int] = """ IoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union between the predicted segmentation and the ground truth. For binary (two classes) or multi-c...
100
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Union[str, Any] = logging.get_logger(__name__) a_ : Tuple = { """huggingface/informer-tourism-monthly""": ( """https://hugg...
676
0
import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformers.tokenization_utils impor...
101
'''simple docstring''' from __future__ import annotations def a_ ( __snake_case : int ) -> list[int]: """simple docstring""" lowerCamelCase_ =[True] * limit lowerCamelCase_ =False lowerCamelCase_ =False lowerCamelCase_ =True for i i...
676
0
"""simple docstring""" from math import ceil, sqrt def UpperCamelCase (SCREAMING_SNAKE_CASE = 100_0000 ): UpperCamelCase : int = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: Uppe...
102
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __UpperCamelCase ( lowerCamelCase__ ): def __i...
676
0
"""simple docstring""" from __future__ import annotations import math import random from typing import Any class UpperCAmelCase : def __init__( self : Any ): """simple docstring""" _snake_case = [] _snake_case = 0 ...
103
'''simple docstring''' from maths.prime_check import is_prime def a_ ( __snake_case : int ) -> int: """simple docstring""" if not isinstance(__snake_case , __snake_case ): lowerCamelCase_ =F'''Input value of [number={number}] must be an integer''' ...
676
0
"""simple docstring""" import numpy as np from PIL import Image def _lowerCamelCase ( UpperCAmelCase_ : np.ndarray, UpperCAmelCase_ : int, UpperCAmelCase_ : int ) -> np.ndarray: """simple docstring""" A__ = np.array(...
104
'''simple docstring''' # DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import B...
676
0
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mvp import MvpTokenizer UpperCam...
105
'''simple docstring''' def a_ ( __snake_case : int , __snake_case : int ) -> str: """simple docstring""" if not isinstance(__snake_case , __snake_case ): raise ValueError('''iterations must be defined as integers''' ) if not isinstance(__snak...
676
0
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, slow fr...
106
'''simple docstring''' from typing import List import numpy as np def a_ ( __snake_case : dict ) -> int: """simple docstring""" lowerCamelCase_ ={key: len(__snake_case ) for key, value in gen_kwargs.items() if isinstance(__snake_case , __snake_case )} if le...
676
0
'''simple docstring''' import importlib.util import json import os import warnings from dataclasses import dataclass, field import torch from ..training_args import TrainingArguments from ..utils import cached_property, is_sagemaker_dp_enabled, logging _UpperCAmelCase : Tuple = logging.ge...
107
'''simple docstring''' import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""...
676
0
import re def _SCREAMING_SNAKE_CASE ( __snake_case ) -> bool: _UpperCAmelCase = re.compile( r"""^(?:0|94|\+94|0{2}94)""" r"""7(0|1|2|4|5|6|7|8)""" r"""(-| |)""" r"""\d{7}$""" ) return bool(re.search(__snake_case , __snake_case ) ) if __name__ ==...
108
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : str = logging.get_logger(__name__) a_ : int = { """RUCAIBox/mvp""": """https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json""", } class __Uppe...
676
0
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets a = "\\n@inproceedings{popovic-2015-chrf,\n title = \"chr{F}: character n-gram {F}-score for automatic {MT} evaluation\",\n author = \"Popovi{\'c}, Maja\",\n booktitle = \"Pro...
109
'''simple docstring''' 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 a_ : int = logging.get_logger(__name__) a_ : str = {"""vocab...
676
0
'''simple docstring''' from statistics import mean import numpy as np def snake_case__ ( _A: list , _A: list , _A: list , _A: int ) -> list: '''simple docstring''' lowerCAmelCase = 0 # Number of processes finished lowerCAmelCase = 0 # Display...
370
'''simple docstring''' from collections.abc import Sequence def a_ ( __snake_case : Sequence[float] , __snake_case : float ) -> float: """simple docstring""" return sum(c * (x**i) for i, c in enumerate(__snake_case ) ) def a_ ( __snake_case : Se...
676
0
from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, slow from ..test_model...
484
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __UpperCamelCase ( lowerCamelCase__ ): lowercase : Optional[int] =['image_processor', 'tokenizer'] lowercase : ...
676
0
"""simple docstring""" def __UpperCAmelCase ( __lowerCamelCase ) -> int: return 1 if digit in (0, 1) else (digit * factorial(digit - 1 )) def __UpperCAmelCase ( __lowerCamelCase ) -> bool: lowercase__ : Optional[Any] = 0 low...
560
'''simple docstring''' from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image ...
676
0
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase__ ( lowerCamelCase__ ): """simple docstring""" lowerCAmelCase__ : Optional[int] = ['image_processor', 'tokenizer'] lowerCAmelCase__ :...
221
'''simple docstring''' import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def a_ ( __snake_case : Optional[int] , __snake_case : Union[str, Any] , __sn...
676
0
'''simple docstring''' from math import pow, sqrt def snake_case ( *snake_case : float ) -> bool: """simple docstring""" lowerCAmelCase = len(__snake_case ) > 0 and all(value > 0.0 for value in values ) return result def snake_case ( snake_case : flo...
284
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Union[str, Any] = logging.get_logger(__name__) a_ : Optional[int] = { """BAAI/AltCLIP""": """https://huggingface.co/BAAI/AltC...
676
0
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_torch_...
614
'''simple docstring''' import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mo...
676
0
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> bool: __UpperCAmelCase = len(__snake_case ) __UpperCAmelCase = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )] # for each arr value, a sum of zero(0) can be formed by not ta...
126
'''simple docstring''' import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .utils import logging a_ :...
676
0
"""simple docstring""" import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_para...
129
'''simple docstring''' def a_ ( __snake_case : str , __snake_case : str ) -> str: """simple docstring""" lowerCamelCase_ =len(__snake_case ) lowerCamelCase_ =len(__snake_case ) lowerCamelCase_ =( first_str_length if first_str_length...
676
0
'''simple docstring''' from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowerCAmelCase = logging.get_logger(__name__) def _SCREAMING_SNAKE_CASE ( UpperCamelCase ): """simple docstring""" if isinstance(__snake_c...
565
'''simple docstring''' # Copyright 2023 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 ...
676
0
"""simple docstring""" def __A (_SCREAMING_SNAKE_CASE ) ->bool: """simple docstring""" if not isinstance(__snake_case , __snake_case ): lowerCAmelCase__ :List[Any] = F"Input value of [number={number}] must be an integer" raise TypeError(__snake_case ) ...
93
'''simple docstring''' import functools def a_ ( __snake_case : str , __snake_case : str ) -> int: """simple docstring""" lowerCamelCase_ =len(__snake_case ) lowerCamelCase_ =len(__snake_case ) @functools.cache def min_distance(__sna...
676
0
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch ...
311
'''simple docstring''' def a_ ( __snake_case : int ) -> bool: """simple docstring""" if not isinstance(__snake_case , __snake_case ): lowerCamelCase_ =F'''Input value of [number={number}] must be an integer''' raise TypeError(__snake_case ) ...
676
0
'''simple docstring''' import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class a__( unittest.TestCase ): '''simple docstring''' def a_ ( self): """simple docstring""" lowerC...
370
'''simple docstring''' from __future__ import annotations a_ : int = list[list[int]] # assigning initial values to the grid a_ : Matrix = [ [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...
676
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) __A = {"""configuration_beit""": ["""BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BeitConfig""", """BeitOnnxConfig"""]} t...
484
'''simple docstring''' from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Union[str, Any] = logging.get_logger(__name__) a_ : Tuple = { """huggingface/informer-tourism-monthly""": ( """https://hugg...
676
0
"""simple docstring""" def __UpperCAmelCase ( __lowerCamelCase ) -> bool: lowercase__ : Optional[int] = n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(27)) print(perfect_cube(4))
560
'''simple docstring''' from __future__ import annotations def a_ ( __snake_case : int ) -> list[int]: """simple docstring""" lowerCamelCase_ =[True] * limit lowerCamelCase_ =False lowerCamelCase_ =False lowerCamelCase_ =True for i i...
676
0
from __future__ import annotations a_ = list[list[int]] # assigning initial values to the grid a_ = [ [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], [0, 5, 0, 0, 9, 0, 6, 0, 0]...
221
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __UpperCamelCase ( lowerCamelCase__ ): def __i...
676
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImageProc...
284
'''simple docstring''' from maths.prime_check import is_prime def a_ ( __snake_case : int ) -> int: """simple docstring""" if not isinstance(__snake_case , __snake_case ): lowerCamelCase_ =F'''Input value of [number={number}] must be an integer''' ...
676
0
'''simple docstring''' import unittest from transformers.testing_utils import CaptureStdout from transformers.tools.python_interpreter import evaluate def __UpperCamelCase( _A : Tuple ): '''simple docstring''' return x + 2 class _lowercase ( unittest.TestCase ): '''simpl...
614
'''simple docstring''' # DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import B...
676
0
'''simple docstring''' import tempfile import unittest import numpy as np import transformers from transformers import GPTaTokenizer, GPTJConfig, is_flax_available, is_torch_available from transformers.testing_utils import is_pt_flax_cross_test, require_flax, tooslow from ...generation.test_flax_utils impo...
126
'''simple docstring''' def a_ ( __snake_case : int , __snake_case : int ) -> str: """simple docstring""" if not isinstance(__snake_case , __snake_case ): raise ValueError('''iterations must be defined as integers''' ) if not isinstance(__snak...
676
0
"""simple docstring""" import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger __magic_name__ = """<<<<<<< This should probably be modified because it mentions: """ __magic_n...
129
'''simple docstring''' from typing import List import numpy as np def a_ ( __snake_case : dict ) -> int: """simple docstring""" lowerCamelCase_ ={key: len(__snake_case ) for key, value in gen_kwargs.items() if isinstance(__snake_case , __snake_case )} if le...
676
0
'''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...
565
'''simple docstring''' import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""...
676
0
"""simple docstring""" import math import time from typing import Dict, List, Optional from torch.utils.data import Dataset from transformers import SeqaSeqTrainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False):...
93
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : str = logging.get_logger(__name__) a_ : int = { """RUCAIBox/mvp""": """https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json""", } class __Uppe...
676
0
def A ( _SCREAMING_SNAKE_CASE ) -> bool: if p < 2: raise ValueError("p should not be less than 2!" ) elif p == 2: return True lowerCamelCase : Optional[int] = 4 lowerCamelCase : Union[str, Any] = (1...
311
'''simple docstring''' 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 a_ : int = logging.get_logger(__name__) a_ : str = {"""vocab...
676
0
'''simple docstring''' import sys __lowercase = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """6689...
370
'''simple docstring''' from collections.abc import Sequence def a_ ( __snake_case : Sequence[float] , __snake_case : float ) -> float: """simple docstring""" return sum(c * (x**i) for i, c in enumerate(__snake_case ) ) def a_ ( __snake_case : Se...
676
0
import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from_submodules, ) from accelerate.test_utils import requi...
484
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __UpperCamelCase ( lowerCamelCase__ ): lowercase : Optional[int] =['image_processor', 'tokenizer'] lowercase : ...
676
0
"""simple docstring""" from datetime import datetime import requests def __UpperCAmelCase ( __lowerCamelCase ) -> bytes: lowercase__ : str = '''https://downloadgram.net/wp-json/wppress/video-downloader/video?url=''' lowercase__ : Tuple ...
560
'''simple docstring''' from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image ...
676
0
def __lowerCAmelCase ( A_ : int ) -> str: __UpperCAmelCase = [False] * len(__snake_case ) __UpperCAmelCase = [-1] * len(__snake_case ) def dfs(A_ : Union[str, Any] , A_ : Dict ): __UpperCAmelCase = True __UpperCAm...
221
'''simple docstring''' import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def a_ ( __snake_case : Optional[int] , __snake_case : Union[str, Any] , __sn...
676
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) _UpperCamelCase : List[Any] = { """configuration_trocr""": ["""TROCR_PR...
284
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Union[str, Any] = logging.get_logger(__name__) a_ : Optional[int] = { """BAAI/AltCLIP""": """https://huggingface.co/BAAI/AltC...
676
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFCa...
614
'''simple docstring''' import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mo...
676
0
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase )-> list[int]: __UpperCAmelCase = [True] * limit __UpperCAmelCase = False __UpperCAmelCase = False __UpperCAmelCase = True for i in range(3 , int(limit**0.5 + ...
126
'''simple docstring''' import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .utils import logging a_ :...
676
0
"""simple docstring""" from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, Tens...
129
'''simple docstring''' def a_ ( __snake_case : str , __snake_case : str ) -> str: """simple docstring""" lowerCamelCase_ =len(__snake_case ) lowerCamelCase_ =len(__snake_case ) lowerCamelCase_ =( first_str_length if first_str_length...
676
0