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
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : int = logging.get_logger(__name__) _UpperCAmelCase : str = { """asapp/sew-tiny-100k""": """https://huggingface.co/asapp/sew-tiny-100k/resolv...
355
from bisect import bisect from itertools import accumulate def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ) -> Tuple: lowerCamelCase__ : Optional[int] = sorted(zip(_UpperCAmelCase , _UpperCAmelCase ...
45
0
import socket def SCREAMING_SNAKE_CASE ( ) -> str: lowerCamelCase__ : List[str] = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) lowerCamelCase__ : Optional[int] = socket.gethostname() lowerCamelCase__ : str = 1_2312 sock.connect((host, po...
356
import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @require_sentencepiece @require_t...
45
0
def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase ) -> str: lowerCamelCase__ : Union[str, Any] = '' for word_or_phrase in separated: if not isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise Exception('join() accepts o...
357
def SCREAMING_SNAKE_CASE ( _UpperCAmelCase ) -> str: if number > 0: raise ValueError('input must be a negative integer' ) lowerCamelCase__ : str = len(bin(_UpperCAmelCase )[3:] ) lowerCamelCase__ : Dict = bin(abs(_UpperCAmelCase ) - (1 << binary_number_...
45
0
from math import asin, atan, cos, radians, sin, sqrt, tan _UpperCAmelCase : str = 6378137.0 _UpperCAmelCase : Union[str, Any] = 6356752.314245 _UpperCAmelCase : Tuple = 6_37_81_37 def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase ,...
358
def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase ) -> float: if digit_amount > 0: return round(number - int(_UpperCAmelCase ) , _UpperCAmelCase ) return number - int(_UpperCAmelCase ) if __name__ == "__main__": print(decimal_isolate(1.53, 0)...
45
0
import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def SCREAMING_SNAKE_CASE ( _UpperCAmelCase ) -> str: lowerCamelCase__ : Optional[int] = [ 'decoder.version', 'decoder.output_project...
359
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCAmelCase : List[Any] = { """configuration_trajectory_transformer""": [ """TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TrajectoryTran...
45
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_co...
360
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCAmelCase : int = { """configuration_bigbird_pegasus""": [ """BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BigBirdPegasusConfig""", ""...
45
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase : List[Any] = logging.get_logger(__name__) _UpperCAmelCase : Optional[in...
361
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_multi_gpu, ) log...
45
0
import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @require_sentencepiece @require_t...
362
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import List import timm import torch import torch.nn as nn from huggingface_hub import hf_hub_download from torch import Tensor from transformers import AutoImageProcessor, Res...
45
0
"""simple docstring""" from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline _UpperCAmelCase : Optional[int] = logging.get_l...
363
def SCREAMING_SNAKE_CASE ( _UpperCAmelCase ) -> float: return 10 - x * x def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase ) -> float: # Bolzano theory in order to find if there is a root between a and b if equation(_UpperCAmelCase ) * equation(_Up...
45
0
from __future__ import annotations def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ) -> dict[str, float]: if (voltage, current, resistance).count(0 ) != 1: raise ValueError('One and only one argument must be 0' ) if resistance < 0: ...
364
from __future__ import annotations def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase ) -> bool: lowerCamelCase__ : List[Any] = get_failure_array(_UpperCAmelCase ) # 2) Step through text searching for pattern lowerCamelCase__ , lowerCamelCase__ ...
45
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Any = logging.get_logger(__name__) _UpperCAmelCase : Optional[Any] = { """microsoft/markuplm-base""": """https://huggingface.co/microsoft/markuplm-base/resolve/main/config.js...
365
from collections import deque class lowerCAmelCase : def __init__( self : str , UpperCAmelCase : str , UpperCAmelCase : int , UpperCAmelCase : int ) -> None: lowerCamelCase__ : Optional[int] = process_name # process name ...
45
0
"""simple docstring""" from __future__ import annotations def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ) -> None: lowerCamelCase__ : Optional[Any] = len(_UpperCAmelC...
366
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start_docstrin...
45
0
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from timm import create_model from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import BitConfig...
367
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder _UpperCAmelCase : Any = datasets.utils.logging.get_logger(__name__) class lowerCAmelCase ( folder_based_builder.FolderBasedBuilderConfig...
45
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingStrategy, logging from .tokenization_realm import RealmTokenizer _UpperCAmelCas...
368
from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class lowerCAmelCase ( yaml.SafeLoader ): def A_ ( self : List[str] , UpperCAmelCase : Dict ) -> Optional[Any]: lowerCamelCase__ : List[A...
45
0
import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosity_info() _UpperCAmelCase : Tuple = ...
369
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) _UpperCAmelCase : Tuple = { """configuration_perceiver""": ["""PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MA...
45
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCAmelCase : int = { """configuration_bigbird_pegasus""": [ """BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BigBirdPegasusConfig""", ""...
370
import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class lowerCAmelCase ( pl.LightningModule ): def __init__( self : List[str] , UpperCAmelCase : Optional[Any] ) ...
45
0
from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, 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_tens...
371
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _UpperCAmelCase : List[str] = { """configuration_m2m_100""": ["""M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP""", """M2M100Config""", """M2M100OnnxConfig"...
45
0
import os def SCREAMING_SNAKE_CASE ( ) -> Dict: lowerCamelCase__ : int = os.path.dirname(os.path.realpath(_UpperCAmelCase ) ) lowerCamelCase__ : Optional[int] = os.path.join(_UpperCAmelCase , 'triangle.txt' ) with open(_UpperCAmelCase ) as f: ...
350
from __future__ import annotations def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ) -> None: lowerCamelCase__ : Optional[Any] = len(_UpperCAmelCase ) # If row is eq...
45
0
import csv import tweepy # Twitter API credentials _UpperCAmelCase : Dict = """""" _UpperCAmelCase : int = """""" _UpperCAmelCase : Tuple = """""" _UpperCAmelCase : List[str] = """""" def SCREAMING_SNAKE_CASE ( _UpperCAmelCase : int ...
351
def SCREAMING_SNAKE_CASE ( _UpperCAmelCase ) -> bool: if not isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise ValueError('Input series is not valid, valid series - [2, 4, 6]' ) if len(_UpperCAmelCase ) == 0: raise ValueError('Input list must be a non empt...
45
0
import json import os import tempfile import unittest import numpy as np from datasets import load_dataset from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common impo...
352
import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase : Any = logging.get_logger(__name__) _UpperCAmelCase : Optional[int] = { """vocab_file""": """vo...
45
0
import inspect import os import unittest from dataclasses import dataclass import torch from accelerate import Accelerator, DistributedDataParallelKwargs, GradScalerKwargs from accelerate.state import AcceleratorState from accelerate.test_utils import execute_subprocess_async, require_cuda, require_multi_gpu fro...
353
from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase : List[Any] = logging.get_logger(__name__) _UpperCAmelCase : U...
45
0
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if i...
354
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_available(): import t...
45
0
_UpperCAmelCase : Dict = { """meter""": """m""", """kilometer""": """km""", """megametre""": """Mm""", """gigametre""": """Gm""", """terametre""": """Tm""", """petametre""": """Pm""", """exametre""": """Em""", """zettametre""": """Zm""", """yottametre""": """Ym...
355
from bisect import bisect from itertools import accumulate def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ) -> Tuple: lowerCamelCase__ : Optional[int] = sorted(zip(_UpperCAmelCase , _UpperCAmelCase ...
45
0
import inspect import unittest from math import floor from transformers import CvtConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_common import ...
356
import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @require_sentencepiece @require_t...
45
0
from collections import deque def SCREAMING_SNAKE_CASE ( _UpperCAmelCase ) -> Tuple: lowerCamelCase__ : Union[str, Any] = len(_UpperCAmelCase ) lowerCamelCase__ : Tuple = deque() lowerCamelCase__ : Union[str, Any] = [False for _ in range(_Upper...
357
def SCREAMING_SNAKE_CASE ( _UpperCAmelCase ) -> str: if number > 0: raise ValueError('input must be a negative integer' ) lowerCamelCase__ : str = len(bin(_UpperCAmelCase )[3:] ) lowerCamelCase__ : Dict = bin(abs(_UpperCAmelCase ) - (1 << binary_number_...
45
0
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, ...
358
def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase ) -> float: if digit_amount > 0: return round(number - int(_UpperCAmelCase ) , _UpperCAmelCase ) return number - int(_UpperCAmelCase ) if __name__ == "__main__": print(decimal_isolate(1.53, 0)...
45
0
import math import os import sys def SCREAMING_SNAKE_CASE ( _UpperCAmelCase ) -> str: lowerCamelCase__ : Any = '' try: with open(_UpperCAmelCase , 'rb' ) as binary_file: lowerCamelCase__ : List[Any] = binary_file.read() for dat in d...
359
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCAmelCase : List[Any] = { """configuration_trajectory_transformer""": [ """TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TrajectoryTran...
45
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 app...
360
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCAmelCase : int = { """configuration_bigbird_pegasus""": [ """BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BigBirdPegasusConfig""", ""...
45
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, loa...
361
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_multi_gpu, ) log...
45
0
from collections.abc import Generator def SCREAMING_SNAKE_CASE ( ) -> Generator[int, None, None]: lowerCamelCase__ : Union[str, Any] = 0, 1 while True: lowerCamelCase__ : Union[str, Any] = b, a + b yield b def SCREAMING_SNAKE_CASE ( _UpperCAme...
362
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import List import timm import torch import torch.nn as nn from huggingface_hub import hf_hub_download from torch import Tensor from transformers import AutoImageProcessor, Res...
45
0
"""simple docstring""" def SCREAMING_SNAKE_CASE ( _UpperCAmelCase ) -> list: # bit count represents no. of bits in the gray code if bit_count < 0: raise ValueError('The given input must be positive' ) # get the generated string sequence lowerCamelCase__ : List[s...
363
def SCREAMING_SNAKE_CASE ( _UpperCAmelCase ) -> float: return 10 - x * x def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase ) -> float: # Bolzano theory in order to find if there is a root between a and b if equation(_UpperCAmelCase ) * equation(_Up...
45
0
import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset _UpperCAmelCase : List[Any] = {1: (1, 1), 2: (2, 1), 3: (3, 1), 4: (2, 2), 5: (5, 1)...
364
from __future__ import annotations def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase ) -> bool: lowerCamelCase__ : List[Any] = get_failure_array(_UpperCAmelCase ) # 2) Step through text searching for pattern lowerCamelCase__ , lowerCamelCase__ ...
45
0
from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets _UpperCAmelCase : int = """\ @inproceedings{wang2019glue, title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding}, author={Wang, Alex ...
365
from collections import deque class lowerCAmelCase : def __init__( self : str , UpperCAmelCase : str , UpperCAmelCase : int , UpperCAmelCase : int ) -> None: lowerCamelCase__ : Optional[int] = process_name # process name ...
45
0
"""simple docstring""" from argparse import ArgumentParser from . import BaseTransformersCLICommand def SCREAMING_SNAKE_CASE ( _UpperCAmelCase ) -> Dict: return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) class ...
366
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start_docstrin...
45
0
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class lowerCAmelCase ( __UpperCamelCase ): UpperCAmelCase__ = """Speech2TextFeatureExtractor""" UpperCAmelCase__ = """Speech2TextTokenizer""" def __init__( self ...
367
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder _UpperCAmelCase : Any = datasets.utils.logging.get_logger(__name__) class lowerCAmelCase ( folder_based_builder.FolderBasedBuilderConfig...
45
0
def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase ) -> str: return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase=0 ) -> Dict: return sorted(_UpperCAmelCase , key=...
368
from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class lowerCAmelCase ( yaml.SafeLoader ): def A_ ( self : List[str] , UpperCAmelCase : Dict ) -> Optional[Any]: lowerCamelCase__ : List[A...
45
0
import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex _UpperCAmelCase : Any = logging.getLogger(__name__) class lowerCAmelCase : def __init__( self : List[Any...
369
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) _UpperCAmelCase : Tuple = { """configuration_perceiver""": ["""PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MA...
45
0
import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPriorPipeline, PriorTransfo...
370
import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class lowerCAmelCase ( pl.LightningModule ): def __init__( self : List[str] , UpperCAmelCase : Optional[Any] ) ...
45
0
from typing import Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention from ...modeling_utils import Pr...
371
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _UpperCAmelCase : List[str] = { """configuration_m2m_100""": ["""M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP""", """M2M100Config""", """M2M100OnnxConfig"...
45
0
'''simple docstring''' def _lowerCAmelCase ( lowercase = 1 , lowercase = 1000 ) -> int: __lowerCAmelCase = 1 __lowerCAmelCase = 0 for divide_by_number in range(lowercase , digit + 1 ): __lowerCAmelCase = [] __lowerCAmelCase ...
46
'''simple docstring''' # 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-...
46
1
'''simple docstring''' # 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-...
46
'''simple docstring''' from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddin...
46
1
'''simple docstring''' import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloyd_if import IFWate...
46
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : int = logging.get_logger(__name__) _a : List[str] = { """edbeeching/decision-transformer-gym-hopper-medium""": ( """https://huggingface.co/edbeeching/decision-transfor...
46
1
'''simple docstring''' from abc import ABC, abstractmethod from typing import Optional, Union from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit from ..utils.typing import NestedDataStructureLike, PathLike class _UpperCAmelCase ( lowerCAmelCa...
46
'''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 _a : Dict = logging.get_logger(__name__) _a : Optional[i...
46
1
'''simple docstring''' from math import isqrt, loga def _lowerCAmelCase ( lowercase ) -> list[int]: __lowerCAmelCase = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , lowercase...
46
'''simple docstring''' import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available(): import onnxrun...
46
1
'''simple docstring''' from math import factorial def _lowerCAmelCase ( lowercase = 20 ) -> int: __lowerCAmelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... __lowerCAmelCase = n // 2 return int(factori...
46
'''simple docstring''' import warnings from functools import wraps from typing import Callable def _lowerCAmelCase ( lowercase ) -> Callable: @wraps(lowercase ) def _inner_fn(*lowercase , **lowercase ): warnings.warn( (f'\'{fn.__name__}\' is expe...
46
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LIC...
46
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.util...
46
1
'''simple docstring''' from typing import Union import fire import torch from tqdm import tqdm def _lowerCAmelCase ( lowercase , lowercase = "cpu" , lowercase = None ) -> None: __lowerCAmelCase = torch.load(lowercase , map_location=lowercase ) for k...
46
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _a : List[Any] = {"""configuration_focalnet""": ["""FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FocalNetConfig"""]} ...
46
1
'''simple docstring''' from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddin...
46
'''simple docstring''' import numpy as np from transformers import Pipeline def _lowerCAmelCase ( lowercase ) -> List[str]: __lowerCAmelCase = np.max(lowercase , axis=-1 , keepdims=lowercase ) __lowerCAmelCase = np.exp(outputs - maxes ) ...
46
1
'''simple docstring''' import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import evaluate import numpy as np from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelFo...
46
'''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
1
'''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 YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.se...
46
'''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 _lowerCAmelCase ( lowercase , lowercase , lowercase ) -> List[st...
46
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _a : Union[str, Any] = { """configuration_roberta_prelayernorm""": [ """ROBERTA_PR...
46
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _a : List[Any] = { """configuration_squeezebert""": [ """SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Sque...
46
1
'''simple docstring''' def _lowerCAmelCase ( lowercase = 200 ) -> int: __lowerCAmelCase = [1, 2, 5, 10, 20, 50, 100, 200] __lowerCAmelCase = [0] * (pence + 1) __lowerCAmelCase = 1 # base case: 1 way to make 0 pence for coin in coins: for i...
46
'''simple docstring''' import random def _lowerCAmelCase ( lowercase ) -> bool: __lowerCAmelCase = num - 1 __lowerCAmelCase = 0 while s % 2 == 0: __lowerCAmelCase = s // 2 t += 1 for _ in range(5 ): __lowerCAmelCase ...
46
1
'''simple docstring''' import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow...
46
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tenso...
46
1
'''simple docstring''' from math import isclose, sqrt def _lowerCAmelCase ( lowercase , lowercase , lowercase ) -> tuple[float, float, float]: __lowerCAmelCase = point_y / 4 / point_x __lowerCAmelCase = 2 * normal_gradient / (1 + normal_gradient * n...
46
'''simple docstring''' from __future__ import annotations from numpy import array, cos, cross, floataa, radians, sin from numpy.typing import NDArray def _lowerCAmelCase ( lowercase , lowercase , lowercase = False ) -> list[float]: if radian_mode: return [magnitu...
46
1
'''simple docstring''' import warnings from .generation import TFGenerationMixin class _UpperCAmelCase ( lowerCAmelCase_ ): # warning at import time warnings.warn( """Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will """ ...
46
'''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 : List[str] = """▁""" _a : Optional[int] = {"""vocab_file""...
46
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _a : str = { """configuration_electra""": ["""ELECTRA_PRETRAI...
46
'''simple docstring''' import warnings from .generation import TFGenerationMixin class _UpperCAmelCase ( lowerCAmelCase_ ): # warning at import time warnings.warn( """Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will """ ...
46
1
'''simple docstring''' import inspect import unittest from transformers import YolosConfig 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 imp...
46
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _a : List[str] = {"""configuration_ibert""": ["""IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """IBertConfig""", """IBertOnnxConfig"""]} try: if not is_torch_...
46
1
'''simple docstring''' import argparse from pathlib import Path import torch from packaging import version from torch.onnx import export from diffusers import AutoencoderKL _a : List[Any] = version.parse(version.parse(torch.__version__).base_version) < version.parse("""1.11""") def ...
46
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available _a : Union[str, Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailabl...
46
1
'''simple docstring''' import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_...
46
'''simple docstring''' import sys def _lowerCAmelCase ( lowercase ) -> List[str]: __lowerCAmelCase = len(lowercase ) __lowerCAmelCase = [[0 for x in range(lowercase )] for x in range(lowercase )] __lowerCAmelCase = [[0 for x in range...
46
1
'''simple docstring''' import argparse import json from collections import OrderedDict from functools import partial from pathlib import Path import timm import torch from huggingface_hub import hf_hub_download from transformers import LevitConfig, LevitForImageClassificationWithTeacher, LevitImageProces...
46
'''simple docstring''' from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _UpperCAmelCase ( lowerCAmelCase_ ): def lowerCamelCase__ ( self ): '''simple docstring''' return [ {"co...
46
1
'''simple docstring''' from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand _a : str = logging.get_logger(__name__) # pylint: disable=invalid-name def ...
46
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tenso...
46
1
'''simple docstring''' import string def _lowerCAmelCase ( lowercase ) -> None: for key in range(len(string.ascii_uppercase ) ): __lowerCAmelCase = """""" for symbol in message: if symbol in string.ascii_uppercase: __lowerCAmelC...
46
'''simple docstring''' # 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-...
46
1
'''simple docstring''' 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_c...
46
'''simple docstring''' from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddin...
46
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor _a : Tuple = logging.get_logger(__name__) class _UpperCAmelCase ( lowerCAmelCase_ ): def __init__( self,*__SCREAMING_SNAKE_CASE,**__SCREAMING_SN...
46
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : int = logging.get_logger(__name__) _a : List[str] = { """edbeeching/decision-transformer-gym-hopper-medium""": ( """https://huggingface.co/edbeeching/decision-transfor...
46
1
'''simple docstring''' # This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just f...
46
'''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 _a : Dict = logging.get_logger(__name__) _a : Optional[i...
46
1
'''simple docstring''' def _lowerCAmelCase ( lowercase ) -> list: def merge(lowercase , lowercase ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0] else right).pop(0 ) yield from left yield fr...
46
'''simple docstring''' import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available(): import onnxrun...
46
1
'''simple docstring''' import argparse import logging import os import datasets import tensorflow as tf from transformers import AutoTokenizer _a : Optional[int] = logging.getLogger(__name__) def _lowerCAmelCase ( ) -> Optional[Any]: __lowerCAmelCase = argparse...
46
'''simple docstring''' import warnings from functools import wraps from typing import Callable def _lowerCAmelCase ( lowercase ) -> Callable: @wraps(lowercase ) def _inner_fn(*lowercase , **lowercase ): warnings.warn( (f'\'{fn.__name__}\' is expe...
46
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : int = logging.get_logger(__name__) _a : List[str] = { """edbeeching/decision-transformer-gym-hopper-medium""": ( """https://huggingface.co/edbeeching/decision-transfor...
46
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.util...
46
1
'''simple docstring''' 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 Genera...
46
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _a : List[Any] = {"""configuration_focalnet""": ["""FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FocalNetConfig"""]} ...
46
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : List[str] = logging.get_logger(__name__) _a : Union[str, Any] = { """facebook/s2t-wav2vec2-large-en-de""": ( """https://huggingface.co/facebook/s2t-wav2vec2-large-en-d...
46
'''simple docstring''' import numpy as np from transformers import Pipeline def _lowerCAmelCase ( lowercase ) -> List[str]: __lowerCAmelCase = np.max(lowercase , axis=-1 , keepdims=lowercase ) __lowerCAmelCase = np.exp(outputs - maxes ) ...
46
1
'''simple docstring''' import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...t...
46
'''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
1
'''simple docstring''' def _lowerCAmelCase ( lowercase ) -> float: __lowerCAmelCase = 0 while len(lowercase ) > 1: __lowerCAmelCase = 0 # Consider two files with minimum cost to be merged for _ in range(2 ): __lowerCAmelCase ...
46
'''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 _lowerCAmelCase ( lowercase , lowercase , lowercase ) -> List[st...
46
1
'''simple docstring''' import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging _a : int = logging.get_logger(__name__) _a : Optional[Any] = { """facebook/encodec_24khz""": """https://huggingface.co/...
46
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _a : List[Any] = { """configuration_squeezebert""": [ """SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Sque...
46
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tenso...
46
'''simple docstring''' import random def _lowerCAmelCase ( lowercase ) -> bool: __lowerCAmelCase = num - 1 __lowerCAmelCase = 0 while s % 2 == 0: __lowerCAmelCase = s // 2 t += 1 for _ in range(5 ): __lowerCAmelCase ...
46
1
'''simple docstring''' from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from f...
46
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tenso...
46
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LIC...
46
'''simple docstring''' from __future__ import annotations from numpy import array, cos, cross, floataa, radians, sin from numpy.typing import NDArray def _lowerCAmelCase ( lowercase , lowercase , lowercase = False ) -> list[float]: if radian_mode: return [magnitu...
46
1
'''simple docstring''' import argparse import glob import logging import os import sys import time from collections import defaultdict from pathlib import Path from typing import Dict, List, Tuple import numpy as np import pytorch_lightning as pl import torch from callbacks import SeqaSeqLoggingCallback, ...
46
'''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 : List[str] = """▁""" _a : Optional[int] = {"""vocab_file""...
46
1
'''simple docstring''' def _lowerCAmelCase ( lowercase = 100 ) -> int: __lowerCAmelCase = n * (n + 1) * (2 * n + 1) / 6 __lowerCAmelCase = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__main__": print(f'{solution()...
46
'''simple docstring''' import warnings from .generation import TFGenerationMixin class _UpperCAmelCase ( lowerCAmelCase_ ): # warning at import time warnings.warn( """Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will """ ...
46
1
'''simple docstring''' def _lowerCAmelCase ( lowercase ) -> bool: __lowerCAmelCase = 0 for ch in input_str: __lowerCAmelCase = ord(lowercase ) __lowerCAmelCase = pow(2 , lowercase ) # If we already turned on bit for curren...
46
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _a : List[str] = {"""configuration_ibert""": ["""IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """IBertConfig""", """IBertOnnxConfig"""]} try: if not is_torch_...
46
1
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import Patch...
46
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available _a : Union[str, Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailabl...
46
1
'''simple docstring''' _a : Dict = """ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/""" def _lowerCAmelCase ( lowercase ) -> bytes: # Make sure the supplied data is a bytes-like object if not isinstance(lowercase , lowercase ): __lower...
46
'''simple docstring''' import sys def _lowerCAmelCase ( lowercase ) -> List[str]: __lowerCAmelCase = len(lowercase ) __lowerCAmelCase = [[0 for x in range(lowercase )] for x in range(lowercase )] __lowerCAmelCase = [[0 for x in range...
46
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _a : Dict = logging.get_logger(__name__) _a : Optional[Any] = { """junnyu/roformer_ch...
46
'''simple docstring''' from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _UpperCAmelCase ( lowerCAmelCase_ ): def lowerCamelCase__ ( self ): '''simple docstring''' return [ {"co...
46
1
'''simple docstring''' import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets _a : Optional[int] = datasets.logging.get_logger(__name__) _a : Optional[Any] = """\ @InProceeding...
46
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tenso...
46
1
'''simple docstring''' import unittest from transformers import AutoConfig, AutoTokenizer, BertConfig, TensorType, is_flax_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, slow if is_flax_available(): import jax from transformers.models.auto.modeling_flax_auto ...
46
'''simple docstring''' # 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-...
46
1
'''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 PaddingStrateg...
46
'''simple docstring''' from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddin...
46
1
'''simple docstring''' import random from typing import Any def _lowerCAmelCase ( lowercase ) -> list[Any]: for _ in range(len(lowercase ) ): __lowerCAmelCase = random.randint(0 , len(lowercase ) - 1 ) __lowerCAmelCase = random....
46
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _a : int = logging.get_logger(__name__) _a : List[str] = { """edbeeching/decision-transformer-gym-hopper-medium""": ( """https://huggingface.co/edbeeching/decision-transfor...
46
1
'''simple docstring''' import torch def _lowerCAmelCase ( ) -> Tuple: if torch.cuda.is_available(): __lowerCAmelCase = torch.cuda.device_count() else: __lowerCAmelCase = 0 print(f'Successfully ran on {num_gpus} GPUs' ) if __name__ == "__mai...
46
'''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 _a : Dict = logging.get_logger(__name__) _a : Optional[i...
46
1
'''simple docstring''' import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transformers impor...
46
'''simple docstring''' import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available(): import onnxrun...
46
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _a : int = { """configuration_nllb_moe""": [ """NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NllbMoeConfig""", ] } try: if not i...
46
'''simple docstring''' import warnings from functools import wraps from typing import Callable def _lowerCAmelCase ( lowercase ) -> Callable: @wraps(lowercase ) def _inner_fn(*lowercase , **lowercase ): warnings.warn( (f'\'{fn.__name__}\' is expe...
46
1
'''simple docstring''' import argparse import requests import torch from PIL import Image from transformers import ViTMAEConfig, ViTMAEForPreTraining, ViTMAEImageProcessor def _lowerCAmelCase ( lowercase ) -> Any: if "cls_token" in name: __lowerCAmelCase = name...
46
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.util...
46
1
'''simple docstring''' _a : int = """0.18.2""" from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_available, is_k_diffusion_version, ...
46
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _a : List[Any] = {"""configuration_focalnet""": ["""FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FocalNetConfig"""]} ...
46
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class _UpperCAmelCase ( metaclass=lowerCAmelCase_ ): a : List[str] =["""speech"""] def __init__( self,*__SCREAMING_SNAKE_CASE,**__SCREAMING_SNAKE_CASE ): '''simple docstr...
46
'''simple docstring''' import numpy as np from transformers import Pipeline def _lowerCAmelCase ( lowercase ) -> List[str]: __lowerCAmelCase = np.max(lowercase , axis=-1 , keepdims=lowercase ) __lowerCAmelCase = np.exp(outputs - maxes ) ...
46
1
'''simple docstring''' import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient _a : Optional[Any] = WebClient(token=os.environ["""CI_SLACK_BOT_TOKEN"""]) def _lowerC...
46
'''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
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _a : int = { """configuration_bridgetower""": [ """BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BridgeTowerCon...
46
'''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 _lowerCAmelCase ( lowercase , lowercase , lowercase ) -> List[st...
46
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available _a : List[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: p...
46
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _a : List[Any] = { """configuration_squeezebert""": [ """SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Sque...
46
1
'''simple docstring''' def _lowerCAmelCase ( lowercase , lowercase ) -> float: def get_matched_characters(lowercase , lowercase ) -> str: __lowerCAmelCase = [] __lowerCAmelCase = min(len(_stra ) , len(_stra ) ) // 2 fo...
46
'''simple docstring''' import random def _lowerCAmelCase ( lowercase ) -> bool: __lowerCAmelCase = num - 1 __lowerCAmelCase = 0 while s % 2 == 0: __lowerCAmelCase = s // 2 t += 1 for _ in range(5 ): __lowerCAmelCase ...
46
1
'''simple docstring''' import warnings from functools import wraps from typing import Callable def _lowerCAmelCase ( lowercase ) -> Callable: @wraps(lowercase ) def _inner_fn(*lowercase , **lowercase ): warnings.warn( (f'\'{fn.__name__}\' is expe...
46
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tenso...
46
1
'''simple docstring''' import os import sys _a : Union[str, Any] = os.path.join(os.path.dirname(__file__), """src""") sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, Auto...
46
'''simple docstring''' from __future__ import annotations from numpy import array, cos, cross, floataa, radians, sin from numpy.typing import NDArray def _lowerCAmelCase ( lowercase , lowercase , lowercase = False ) -> list[float]: if radian_mode: return [magnitu...
46
1
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms imp...
46
'''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 : List[str] = """▁""" _a : Optional[int] = {"""vocab_file""...
46
1
'''simple docstring''' 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_rob...
46
'''simple docstring''' import warnings from .generation import TFGenerationMixin class _UpperCAmelCase ( lowerCAmelCase_ ): # warning at import time warnings.warn( """Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will """ ...
46
1