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
"""simple docstring""" import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_gpta import GPTa...
553
"""simple docstring""" import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logg...
103
0
'''simple docstring''' import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) fr...
653
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available snake_case = {'''tokenization_herbert''': ['''HerbertTokenizer''']} try: if not is_tokenizers_available(): raise Op...
103
0
'''simple docstring''' from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class lowerCamelCase__ ( yaml.SafeLoader ): """simple docstring""" def lowerCAmelCase_ ( self : T...
331
"""simple docstring""" from itertools import product def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> list[int]: _snake_case = sides_number _snake_case = max_face_number * dice_number _snake_case = [0] * (max_total + 1) _snake...
103
0
from abc import ABC, abstractmethod from typing import List, Optional class A ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__( self : List[str]): self.test() def UpperCAmelCase__ ( self : List[Any]): _lowercas...
226
"""simple docstring""" import inspect import unittest from transformers import MobileNetVaConfig 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_con...
103
0
import warnings from typing import List from unittest.mock import Mock import torch from torch.utils.data import DataLoader, IterableDataset, TensorDataset from accelerate.accelerator import Accelerator from accelerate.utils.dataclasses import DistributedType class _snake_case ( __SCREAMING_S...
12
"""simple docstring""" from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class UpperCAmelCase ( yaml.SafeLoader ): def __UpperCAmelCase ( self : Tuple , __lowerCamelCase : List[str] ...
103
0
def _A (UpperCamelCase : Dict , UpperCamelCase : Tuple ) ->int: '''simple docstring''' return 1 if input_a == input_a else 0 def _A () ->None: '''simple docstring''' assert xnor_gate(0 , 0 ) == 1 assert xnor_gate(0 , 1 ) == 0 a...
157
"""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.or...
103
0
"""simple docstring""" from json import JSONDecodeError # Workaround for requests.exceptions.JSONDecodeError import requests def _SCREAMING_SNAKE_CASE (_UpperCAmelCase : Tuple = "isbn/0140328726" ): lowerCAmelCase = olid.strip().strip('/' ) # Remove leading/trailing whitespace & slashes...
4
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is trul...
103
0
import torch from ..models.auto import AutoModelForSequenceClassification, AutoTokenizer from .base import PipelineTool class _UpperCamelCase( __SCREAMING_SNAKE_CASE ): __SCREAMING_SNAKE_CASE : Optional[Any] = '''facebook/bart-large-mnli''' __SCREAMING_S...
47
"""simple docstring""" from math import sqrt def snake_case ( lowerCAmelCase_ = 1000000 ) -> int: _snake_case = 0 _snake_case = 0 _snake_case = 42 while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_sides in range(2...
103
0
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): import tor...
170
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...
103
0
'''simple docstring''' from maths.prime_factors import prime_factors def __lowerCamelCase ( __snake_case : Dict ) -> int: """simple docstring""" if not isinstance(lowerCAmelCase_, lowerCAmelCase_ ): A__ : Dict =f"Input value of [number={number}]...
215
"""simple docstring""" 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 FlaxX...
103
0
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class A( unittest.TestCase ): """s...
355
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torcha...
103
0
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docs...
553
"""simple docstring""" import operator def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ = False , lowerCAmelCase_ = None ) -> list: _snake_case = operator.lt if reverse else operator.gt _snake_case = solution or [] if not arr: retu...
103
0
'''simple docstring''' import operator as op __lowerCamelCase : Optional[int] = '''scaler.pt''' __lowerCamelCase : Tuple = '''pytorch_model''' __lowerCamelCase : Dict = '''random_states''' __lowerCamelCase : Dict = '''optimiz...
653
"""simple docstring""" import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.mode...
103
0
'''simple docstring''' import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available fr...
331
"""simple docstring""" from copy import deepcopy class UpperCAmelCase : def __init__( self : Optional[Any] , __lowerCamelCase : list[int] | None = None , __lowerCamelCase : int | None = None ): """simple docstring""" ...
103
0
from typing import Any def __lowerCAmelCase ( __magic_name__ ): if not input_list: return [] _lowercase: List[str] = [input_list.count(lowerCAmelCase_ ) for value in input_list] _lowercase: Any = max(lowerCAmelCase_ ) # Gets the maximum count in the in...
226
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic...
103
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available lowerCamelCase__ : Dict = { """configuration_gpt_neo""": ["""GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTNeoConfig""", """GPTNeoOnnxConfig"""], } tr...
12
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenizatio...
103
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _lowercase = { '''configuration_owlvit''': [ '''OWLVIT_PRETR...
157
"""simple docstring""" from ...configuration_utils import PretrainedConfig class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): A__ : str = '''bert-generation''' def __init__( self : Tuple , __lowerCamelCase : Optional[int]=5_0_3_5_8 ...
103
0
"""simple docstring""" import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class a ( __SCREAMING_SNAKE_CASE ): snake_case__ = (DDPMScheduler,) def UpperCamelCase__ ( self , **_snake_case ): "...
4
"""simple docstring""" from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=__SCREAMING_SNAKE_CASE ): A__ : Optional[int] = ['''torch''', '''scipy'''] def __init__( self : Any , *__lowerCamelCase : List[...
103
0
import collections import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = ...
47
"""simple docstring""" def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> int: return 1 if input_a == input_a else 0 def snake_case ( ) -> None: assert xnor_gate(0 , 0 ) == 1 assert xnor_gate(0 , 1 ) == 0 assert xnor_gate(1 , ...
103
0
import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def lowercase__( A , A , A , A=5 ): # Adapted from https://github.com/pytorch/fairseq/blob/master/fairseq/models/roberta/hub_interface.py assert masked_input.count('<mask>' ) == 1 s...
170
"""simple docstring""" import os from pathlib import Path def snake_case ( ) -> Tuple: from torch.utils.cpp_extension import load _snake_case = Path(lowerCAmelCase_ ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' _snake_case = ...
103
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __snake_case : Any = { 'configuration_rag': ['RagConfig'], 'retrieval_rag': ['RagRetriever'], 'tokenization_rag': ['RagTokenize...
215
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixi...
103
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCamelCase__ :Any = { """configuration_bridgetower""": [ """BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Bridg...
355
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): @staticmethod @abstractmethod def __UpperCAmelCase ( __lowerCamelCase : ArgumentParser ): "...
103
0
"""simple docstring""" import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tenso...
553
"""simple docstring""" import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logg...
103
0
'''simple docstring''' import fcntl import os import socket import torch import torch.distributed as dist def __UpperCAmelCase ( *__magic_name__ )-> Tuple: """simple docstring""" with open(lowerCAmelCase_ ,"r" ) as fh: fcntl.flock(lower...
653
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available snake_case = {'''tokenization_herbert''': ['''HerbertTokenizer''']} try: if not is_tokenizers_available(): raise Op...
103
0
'''simple docstring''' import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, ...
331
"""simple docstring""" from itertools import product def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> list[int]: _snake_case = sides_number _snake_case = max_face_number * dice_number _snake_case = [0] * (max_total + 1) _snake...
103
0
def __lowerCAmelCase ( __magic_name__ = 4_0_0_0_0_0_0 ): _lowercase: str = [] _lowercase , _lowercase: Optional[int] = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(lowerCAmelCase_ ) _lowercase , _lowercase: List[str] = b, a + b...
226
"""simple docstring""" import inspect import unittest from transformers import MobileNetVaConfig 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_con...
103
0
from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ConfigTester...
12
"""simple docstring""" from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class UpperCAmelCase ( yaml.SafeLoader ): def __UpperCAmelCase ( self : Tuple , __lowerCamelCase : List[str] ...
103
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_bart import BartTokenizer _lowerc...
157
"""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.or...
103
0
"""simple docstring""" __UpperCamelCase : str = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers...
4
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is trul...
103
0
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_...
47
"""simple docstring""" from math import sqrt def snake_case ( lowerCAmelCase_ = 1000000 ) -> int: _snake_case = 0 _snake_case = 0 _snake_case = 42 while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_sides in range(2...
103
0
import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py lowerCamelCase : List[str] ...
170
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...
103
0
'''simple docstring''' import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_availab...
215
"""simple docstring""" 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 FlaxX...
103
0
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, loggin...
355
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torcha...
103
0
"""simple docstring""" class __UpperCamelCase : # Public class to implement a graph def __init__( self : int , UpperCAmelCase : int , UpperCAmelCase : int , UpperCAmelCase : list[list[bool]] ) -> Any: lowerCAmelCase :Dict = r...
553
"""simple docstring""" import operator def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ = False , lowerCAmelCase_ = None ) -> list: _snake_case = operator.lt if reverse else operator.gt _snake_case = solution or [] if not arr: retu...
103
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_availabl...
653
"""simple docstring""" import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.mode...
103
0
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_ro...
331
"""simple docstring""" from copy import deepcopy class UpperCAmelCase : def __init__( self : Optional[Any] , __lowerCamelCase : list[int] | None = None , __lowerCamelCase : int | None = None ): """simple docstring""" ...
103
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE : Optional[Any] = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE : Optional[int] = { 'asapp/sew-tiny-100k': 'https://huggingface.co...
226
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic...
103
0
import inspect import re from hashlib import shaaaa from typing import Dict, List from .arrow import arrow from .audiofolder import audiofolder from .csv import csv from .imagefolder import imagefolder from .json import json from .pandas import pandas from .parquet import parquet from .sql import sql # ...
12
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenizatio...
103
0
import sys _lowercase = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''12540698747158523863050715693290963295227443043557''' '''668966489504452445231617318564...
157
"""simple docstring""" from ...configuration_utils import PretrainedConfig class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): A__ : str = '''bert-generation''' def __init__( self : Tuple , __lowerCamelCase : Optional[int]=5_0_3_5_8 ...
103
0
"""simple docstring""" from math import sqrt def _SCREAMING_SNAKE_CASE (_UpperCAmelCase : Any = 100_0000 ): lowerCAmelCase = 0 lowerCAmelCase = 0 lowerCAmelCase = 42 while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_sides in range(2 , 2 * max_cuboid...
4
"""simple docstring""" from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=__SCREAMING_SNAKE_CASE ): A__ : Optional[int] = ['''torch''', '''scipy'''] def __init__( self : Any , *__lowerCamelCase : List[...
103
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.t...
47
"""simple docstring""" def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> int: return 1 if input_a == input_a else 0 def snake_case ( ) -> None: assert xnor_gate(0 , 0 ) == 1 assert xnor_gate(0 , 1 ) == 0 assert xnor_gate(1 , ...
103
0
import inspect import unittest from transformers import SegformerConfig, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_commo...
170
"""simple docstring""" import os from pathlib import Path def snake_case ( ) -> Tuple: from torch.utils.cpp_extension import load _snake_case = Path(lowerCAmelCase_ ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' _snake_case = ...
103
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class lowerCamelCase ( metaclass=__SCREAMING_SNAKE_CASE ): '''simple docstring''' __snake_case = ['''torch''', '''scipy'''] def __init__( self : Any , *lowerCAmelCase_ : List[Any] ...
215
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixi...
103
0
"""simple docstring""" def A_ ( snake_case__ = 10 , snake_case__ = 22 ) -> int: _UpperCamelCase :Optional[Any] = range(1 , lowerCAmelCase_ ) _UpperCamelCase :int = range(1 , lowerCAmelCase_ ) return sum( 1 for power in po...
355
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): @staticmethod @abstractmethod def __UpperCAmelCase ( __lowerCamelCase : ArgumentParser ): "...
103
0
"""simple docstring""" from __future__ import annotations import inspect import unittest from typing import List, Tuple from transformers import RegNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_avai...
553
"""simple docstring""" import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logg...
103
0
'''simple docstring''' class A_ : """simple docstring""" def __init__( self :Union[str, Any] , lowerCAmelCase__ :int ) -> Optional[Any]: '''simple docstring''' snake_case_ : Any = size ...
653
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available snake_case = {'''tokenization_herbert''': ['''HerbertTokenizer''']} try: if not is_tokenizers_available(): raise Op...
103
0
'''simple docstring''' import itertools import os from collections import Counter, defaultdict from concurrent.futures import ThreadPoolExecutor, as_completed import numpy as np import datasets from .execute import check_correctness UpperCamelCase_ : str = """\ @misc{chen20...
331
"""simple docstring""" from itertools import product def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> list[int]: _snake_case = sides_number _snake_case = max_face_number * dice_number _snake_case = [0] * (max_total + 1) _snake...
103
0
def __lowerCAmelCase ( __magic_name__ , __magic_name__ ): while a != 0: _lowercase , _lowercase: List[Any] = b % a, a return b def __lowerCAmelCase ( __magic_name__ , __magic_name__ ): if gcd(lowerCAmelCase_ , lowerCAmelCase_ ) != 1: _low...
226
"""simple docstring""" import inspect import unittest from transformers import MobileNetVaConfig 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_con...
103
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_sentencepie...
12
"""simple docstring""" from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class UpperCAmelCase ( yaml.SafeLoader ): def __UpperCAmelCase ( self : Tuple , __lowerCamelCase : List[str] ...
103
0
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 _lowercase = logging.get...
157
"""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.or...
103
0
"""simple docstring""" from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class...
4
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is trul...
103
0
from ..models.whisper import WhisperForConditionalGeneration, WhisperProcessor from .base import PipelineTool class _UpperCamelCase( __SCREAMING_SNAKE_CASE ): __SCREAMING_SNAKE_CASE : str = '''openai/whisper-base''' __SCREAMING_SNAKE_CASE : List[Any]...
47
"""simple docstring""" from math import sqrt def snake_case ( lowerCAmelCase_ = 1000000 ) -> int: _snake_case = 0 _snake_case = 0 _snake_case = 42 while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_sides in range(2...
103
0
import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup lowerCamelCase : List[str] = logging.get_logger(__name__) class snak...
170
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...
103
0
'''simple docstring''' __snake_case : Optional[Any] = [ 'DownloadConfig', 'DownloadManager', 'DownloadMode', 'StreamingDownloadManager', ] from .download_config import DownloadConfig from .download_manager import DownloadManager, DownloadMode from .streaming_download_manager import ...
215
"""simple docstring""" 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 FlaxX...
103
0
"""simple docstring""" import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel UpperCamelCase__ :Union[str, Any] = HfApi() UpperCamelCase__ :str = {} # fmt: off UpperCamelCase__ :Optional[int] = torch.tensor([ -0.7_515, -1.6_883, 0.2_420, ...
355
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torcha...
103
0
"""simple docstring""" from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class __UpperCamelCase : def __init__( self : Union[str, Any] , UpperCAmelCase : Collection[float] | None = None ) -...
553
"""simple docstring""" import operator def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ = False , lowerCAmelCase_ = None ) -> list: _snake_case = operator.lt if reverse else operator.gt _snake_case = solution or [] if not arr: retu...
103
0
'''simple docstring''' from __future__ import annotations def __UpperCAmelCase ( __magic_name__ ,__magic_name__ = None ,__magic_name__ = None ,__magic_name__ = False ,)-> tuple[int, float, str]: """simple docstring""" snake_case_ : Any = ...
653
"""simple docstring""" import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.mode...
103
0
'''simple docstring''' import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin f...
331
"""simple docstring""" from copy import deepcopy class UpperCAmelCase : def __init__( self : Optional[Any] , __lowerCamelCase : list[int] | None = None , __lowerCamelCase : int | None = None ): """simple docstring""" ...
103
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE : Optional[int] = { 'configuration_pegasus_x': ['PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PegasusXConfig'], } try: if not is_torch_available(...
226
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic...
103
0
import argparse import tensorflow as tf import torch from transformers import BertConfig, BertForMaskedLM from transformers.models.bert.modeling_bert import ( BertIntermediate, BertLayer, BertOutput, BertPooler, BertSelfAttention, BertSelfOutput, ) from transformers.utils impor...
12
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenizatio...
103
0
"""simple docstring""" from functools import lru_cache def _lowerCamelCase ( UpperCAmelCase_ : int ) -> set: """simple docstring""" A__ = 2 A__ = set() while i * i <= n: if n % i: i += 1 else: n //...
104
"""simple docstring""" from statistics import mean import numpy as np def _lowerCamelCase ( UpperCAmelCase_ : list, UpperCAmelCase_ : list, UpperCAmelCase_ : list, UpperCAmelCase_ : int ) -> list: """simple docstring""" A_...
104
1
"""simple docstring""" from ...processing_utils import ProcessorMixin class UpperCamelCase__ ( _lowerCAmelCase ): """simple docstring""" A__ : Tuple = "SpeechT5FeatureExtractor" A__ : List[Any] = "SpeechT5Tokenizer" ...
104
"""simple docstring""" import math from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { """facebook/data2vec-base-960h""": """https://huggingface.co/facebook/data2vec-...
104
1
"""simple docstring""" import random def _lowerCamelCase ( UpperCAmelCase_ : int, UpperCAmelCase_ : float, UpperCAmelCase_ : bool = False ) -> dict: """simple docstring""" A__ = {i: [] for i in range(UpperCAmelCase_ ...
104
"""simple docstring""" import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase = logging.get_logger(__na...
104
1
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : bytes ) -> str: """simple docstring""" return "".join([hex(UpperCAmelCase_ )[2:].zfill(2 ).upper() for byte in list(UpperCAmelCase_ )] ) def _lowerCamelCase ...
104
"""simple docstring""" import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers...
104
1
"""simple docstring""" import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings ...
104
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase = {"""configuration_wavlm""": ["""WAVLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """WavLMConfig"""]} try: if not is_torch_a...
104
1
"""simple docstring""" import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransf...
104
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : bytes ) -> str: """simple docstring""" return "".join([hex(UpperCAmelCase_ )[2:].zfill(2 ).upper() for byte in list(UpperCAmelCase_ )] ) def _lowerCamelCase ...
104
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common im...
104
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_uti...
104
1
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : str, UpperCAmelCase_ : str ) -> bool: """simple docstring""" A__ = len(UpperCAmelCase_ ) A__ = len(UpperCAmelCase_ ) A__ = ...
104
"""simple docstring""" import torch import torch.nn as nn from transformers.modeling_utils import ModuleUtilsMixin from transformers.models.ta.modeling_ta import TaBlock, TaConfig, TaLayerNorm from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMix...
104
1
"""simple docstring""" class UpperCamelCase__ : """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE__ = "" , SCREAMING_SNAKE_CASE__ = False ) -> None: # Mapping from the first character of the prefix of the node A__ = ...
104
"""simple docstring""" from __future__ import annotations def _lowerCamelCase ( UpperCAmelCase_ : float, UpperCAmelCase_ : float, UpperCAmelCase_ : float, ) -> tuple: """simple docstring""" if (electron_conc, hole_conc, intrinsic_conc)...
104
1
"""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 UpperCamelCase = logging.get_logger(__name__)...
104
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) UpperCamelCase = { """configuration_perceiver""": ["""PE...
104
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) UpperCamelCase = { """configuration_perceiver""": ["""PE...
104
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_ef...
104
1
"""simple docstring""" from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def _lowerCamelCase ( UpperCAmelCase_ : str, UpperCAmelCase_ : complex, UpperCAmelCase_ : str = "x", UpperCAmelCase_ : float = 10**-10, UpperCAme...
104
"""simple docstring""" from ..utils import ( OptionalDependencyNotAvailable, is_flax_available, is_scipy_available, is_torch_available, is_torchsde_available, ) try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDepen...
104
1
"""simple docstring""" import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torc...
104
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer UpperCamelCase = {"""vocab_file""": """vocab.txt"...
104
1
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : str ) -> list: """simple docstring""" return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(UpperCAmelCase_ ) ) if txt[a].isalpha() ] if...
104
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : int ) -> int: """simple docstring""" assert ( isinstance(UpperCAmelCase_, UpperCAmelCase_ ) and number_of_steps > 0 ), F"""number_of_steps needs to be positive integer, yo...
104
1
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : int = 1000000 ) -> int: """simple docstring""" A__ = set(range(3, UpperCAmelCase_, 2 ) ) primes.add(2 ) for p in range(3, UpperCAmelCase_, 2 ): if...
104
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : int ) -> int: """simple docstring""" if not isinstance(UpperCAmelCase_, UpperCAmelCase_ ): raise ValueError("Input must be an integer" ) if input_num <= 0: raise Value...
104
1
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer UpperCamelCase = {"""vocab_file""": """vocab.txt"...
104
"""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 f...
104
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....
104
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : Optional[Any] ) -> Dict: """simple docstring""" A__ = [] A__ = set({"(", "[", "{"} ) A__ = set({")", "]", "}"} ) A__ ...
104
1
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureExtracti...
104
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension ...
104
1
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TextClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, req...
104
"""simple docstring""" class UpperCamelCase__ : """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE__ = "" , SCREAMING_SNAKE_CASE__ = False ) -> None: # Mapping from the first character of the prefix of the node A__ = ...
104
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 S...
104
"""simple docstring""" import unittest from transformers.utils.backbone_utils import ( BackboneMixin, get_aligned_output_features_output_indices, verify_out_features_out_indices, ) class UpperCamelCase__ ( unittest.TestCase ): """simple docstri...
104
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase = {"""configuration_sew""": ["""SEW_PRETRAINED_CONFIG_ARCHIVE_MAP""", """SEWConfig"""]} try: if not is_torch_availab...
104
"""simple docstring""" import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor UpperCamelCase = logging.get_logger(__name__) class UpperCamelCase__ ( _lowerCAmelCase ): """simple docstring""" d...
104
1
"""simple docstring""" from functools import lru_cache @lru_cache def _lowerCamelCase ( UpperCAmelCase_ : int ) -> int: """simple docstring""" if num < 0: raise ValueError("Number should not be negative." ) return 1 if num in (0, 1...
104
"""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, LevitForImageClassificationWithTeach...
104
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCamelCase = { """configuration_mega""": ["""MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MegaConfig""", """Meg...
104
"""simple docstring""" from statistics import mean import numpy as np def _lowerCamelCase ( UpperCAmelCase_ : list, UpperCAmelCase_ : list, UpperCAmelCase_ : list, UpperCAmelCase_ : int ) -> list: """simple docstring""" A_...
104
1
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( HubertConfig, HubertForCTC, HubertModel, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcesso...
104
"""simple docstring""" import math from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { """facebook/data2vec-base-960h""": """https://huggingface.co/facebook/data2vec-...
104
1
"""simple docstring""" from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import Iterab...
104
"""simple docstring""" import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase = logging.get_logger(__na...
104
1
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : int = 50 ) -> int: """simple docstring""" A__ = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2, 5 ...
104
"""simple docstring""" import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers...
104
1
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase = { """configuration_autoformer""": [ """AUTOFORMER_PRETRAINED_CONFIG_A...
104
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase = {"""configuration_wavlm""": ["""WAVLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """WavLMConfig"""]} try: if not is_torch_a...
104
1
"""simple docstring""" 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, n...
104
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : bytes ) -> str: """simple docstring""" return "".join([hex(UpperCAmelCase_ )[2:].zfill(2 ).upper() for byte in list(UpperCAmelCase_ )] ) def _lowerCamelCase ...
104
1
"""simple docstring""" from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = ...
104
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_uti...
104
1
"""simple docstring""" UpperCamelCase = 8.314_4598 def _lowerCamelCase ( UpperCAmelCase_ : float, UpperCAmelCase_ : float ) -> float: """simple docstring""" if temperature < 0: raise Exception("Temperature cannot be less tha...
104
"""simple docstring""" import torch import torch.nn as nn from transformers.modeling_utils import ModuleUtilsMixin from transformers.models.ta.modeling_ta import TaBlock, TaConfig, TaLayerNorm from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMix...
104
1
"""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""" from __future__ import annotations def _lowerCamelCase ( UpperCAmelCase_ : float, UpperCAmelCase_ : float, UpperCAmelCase_ : float, ) -> tuple: """simple docstring""" if (electron_conc, hole_conc, intrinsic_conc)...
104
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCamelCase = { """configuration_falcon""": ["""FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FalconConfig"""],...
104
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) UpperCamelCase = { """configuration_perceiver""": ["""PE...
104
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, ) UpperCamelCase = { """configuration_...
104
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_ef...
104
1
"""simple docstring""" import math def _lowerCamelCase ( UpperCAmelCase_ : int ) -> bool: """simple docstring""" return math.sqrt(UpperCAmelCase_ ) * math.sqrt(UpperCAmelCase_ ) == num def _lowerCamelCase ( UpperCAmel...
104
"""simple docstring""" from ..utils import ( OptionalDependencyNotAvailable, is_flax_available, is_scipy_available, is_torch_available, is_torchsde_available, ) try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDepen...
104
1
"""simple docstring""" import random import unittest import torch from diffusers import IFInpaintingPipeline 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 ...
104
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer UpperCamelCase = {"""vocab_file""": """vocab.txt"...
104
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule UpperCamelCase = {"""processing_wav2vec2_with_lm""": ["""Wav2Vec2ProcessorWithLM"""]} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: i...
104
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : int ) -> int: """simple docstring""" assert ( isinstance(UpperCAmelCase_, UpperCAmelCase_ ) and number_of_steps > 0 ), F"""number_of_steps needs to be positive integer, yo...
104
1
"""simple docstring""" import enum import shutil import sys UpperCamelCase , UpperCamelCase = shutil.get_terminal_size() UpperCamelCase = {"""UP""": """A""", """DOWN""": """B""", """RIGHT""": """C""", """LEFT""": """D"""} class UpperCamelCase_...
104
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : int ) -> int: """simple docstring""" if not isinstance(UpperCAmelCase_, UpperCAmelCase_ ): raise ValueError("Input must be an integer" ) if input_num <= 0: raise Value...
104
1
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : Union[str, Any] ) -> Optional[Any]: # noqa: E741 """simple docstring""" A__ = len(UpperCAmelCase_ ) A__ = 0 A__ = [0] * n A__ ...
104
"""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 f...
104
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { """google/canine-s""": """https://huggingface.co/google/canine-s/resolve/main/config.json""", ...
104
"""simple docstring""" def _lowerCamelCase ( UpperCAmelCase_ : Optional[Any] ) -> Dict: """simple docstring""" A__ = [] A__ = set({"(", "[", "{"} ) A__ = set({")", "]", "}"} ) A__ ...
104
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { ...
104
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension ...
104
1