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""" from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case = logging.get_logger(__name__) snake_case = { # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert } class UpperCAm...
103
"""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
1
"""simple docstring""" import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from t...
103
"""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
1
"""simple docstring""" from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import Gr...
103
"""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
1
"""simple docstring""" 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, BertSel...
103
"""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
1
"""simple docstring""" 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...
103
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available snake_case = { '''configuration_gpt_neo''': ['''GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoConfig''', '''GPT...
103
"""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
1
"""simple docstring""" import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): A__ : Any = (DDPMScheduler,) def __UpperCAmelCase ( self : Dict ...
103
"""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
1
"""simple docstring""" def snake_case ( lowerCAmelCase_ = 4000000 ) -> int: _snake_case = [] _snake_case , _snake_case = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(lowerCAmelCase_ ) _snake_case , _snake_case = b, a + b ...
103
"""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
1
"""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
"""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
1
"""simple docstring""" from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from...
103
"""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
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 ....
103
"""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
1
"""simple docstring""" from __future__ import annotations def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , ) -> None: _snake_case = len(lowerCAmelCase_ ) # If row is equal t...
103
"""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
1
"""simple docstring""" from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_a...
103
"""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
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/lic...
103
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): @staticmethod @abstractmethod def __UpperCAmelCase ( __lowerCamelCase : ArgumentParser ): "...
103
1
"""simple docstring""" from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils impor...
103
"""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
1
"""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 snake_case = '''▁''' snake_case = {'''...
103
"""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
1
"""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
"""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
1
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, s...
103
"""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
1
"""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 snake_case = logging.get_logger(__name__) ...
103
"""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
1
"""simple docstring""" from __future__ import annotations snake_case = '''Muhammad Umer Farooq''' snake_case = '''MIT''' snake_case = '''1.0.0''' snake_case = '''Muhammad Umer Farooq''' snake_case = '''contact@muhammadumerfarooq.me''' snake_...
103
"""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
1
"""simple docstring""" from __future__ import annotations from math import pi, sqrt def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> tuple: if inductance <= 0: raise ValueError('''Inductance cannot be 0 or negative''' ) elif capacitance <= 0: ...
103
"""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
1
"""simple docstring""" import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from i...
103
"""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
1
"""simple docstring""" import unittest from transformers import AutoTokenizer, FalconConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import Config...
103
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case = { '''configurati...
103
"""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
1
"""simple docstring""" import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_model...
103
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available snake_case = {'''configuration_speech_encoder_decoder''': ['''SpeechEncoderDecoderConfig''']} try: if not is_tor...
103
"""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
1
"""simple docstring""" snake_case = { '''a''': '''AAAAA''', '''b''': '''AAAAB''', '''c''': '''AAABA''', '''d''': '''AAABB''', '''e''': '''AABAA''', '''f''': '''AABAB''', '''g''': '''AABBA''', '''h''': '''AABBB''', '''i''': '''ABAAA''', '''...
103
"""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
1
"""simple docstring""" def snake_case ( lowerCAmelCase_ = 10**12 ) -> int: _snake_case = 1 _snake_case = 0 _snake_case = 1 _snake_case = 1 while numerator <= 2 * min_total - 1: prev_numerator += 2 * numerator numerator += 2 *...
103
"""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
1
"""simple docstring""" 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 snake_case = logging.get_logger(__name__) snake_case ...
103
"""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
1
"""simple docstring""" # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/lic...
103
"""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
1
"""simple docstring""" import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCAmelCase ( __SCREAMING_SNAKE_CASE,unittest.TestCase ): ...
103
"""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
1
"""simple docstring""" def snake_case ( lowerCAmelCase_ ) -> list: if len(lowerCAmelCase_ ) <= 1: return [tuple(lowerCAmelCase_ )] _snake_case = [] def generate(lowerCAmelCase_ , lowerCAmelCase_ ): _snake_case = [0] * n res.append(tup...
103
"""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
1
"""simple docstring""" import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets snake_case = '''\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns ...
103
"""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
1
"""simple docstring""" import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, ...
103
"""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
1
"""simple docstring""" import baseaa def snake_case ( lowerCAmelCase_ ) -> bytes: return baseaa.baaencode(string.encode('''utf-8''' ) ) def snake_case ( lowerCAmelCase_ ) -> str: return baseaa.baadecode(lowerCAmelCase_ ).decode('''utf-8''' ) if...
103
"""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
1
"""simple docstring""" def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ) -> float: return round(float(moles / volume ) * nfactor ) def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ) -> float: r...
103
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): @staticmethod @abstractmethod def __UpperCAmelCase ( __lowerCamelCase : ArgumentParser ): "...
103
1
"""simple docstring""" from .data_collator import ( DataCollatorForLanguageModeling, DataCollatorForPermutationLanguageModeling, DataCollatorForSeqaSeq, DataCollatorForSOP, DataCollatorForTokenClassification, DataCollatorForWholeWordMask, DataCollatorWithPadding, ...
103
"""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
1
"""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 ...
103
"""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
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, is_vision_available, ) snake_case = { ...
103
"""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
1
"""simple docstring""" from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def snake_case ( lowerCAmelCase_ ) -> int: _snake_case = prime_factors(lowerCAmelCase_ ) if is_square_free(lowerCAmelCase_ ): return -1 if l...
103
"""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
1
"""simple docstring""" def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> int: while a != 0: _snake_case , _snake_case = b % a, a return b def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> int: if gcd(lowerCAm...
103
"""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
1
"""simple docstring""" from random import shuffle import tensorflow as tf from numpy import array def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> List[Any]: _snake_case = int(lowerCAmelCase_ ) assert noofclusters < len(lowerCAmelCase_ ) # F...
103
"""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
1
"""simple docstring""" from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils imp...
103
"""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
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case = logging.get_logger(__name__) snake_case = { '''alibaba-damo/mgp-str-base''': '''https://huggingface.co/alibaba-damo/mgp-str-base/resolve/main/config...
103
"""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
1
"""simple docstring""" import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json ...
103
"""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
1
"""simple docstring""" from __future__ import annotations import math import random from typing import Any class UpperCAmelCase : def __init__( self : Any ): """simple docstring""" _snake_case = [] _snake_case = 0 ...
103
"""simple docstring""" 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
1
"""simple docstring""" from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_te...
103
"""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
1
"""simple docstring""" import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel snake_case = HfApi() snake_case = {} # fmt: off snake_case = torch.tensor([ -0.7_5_1_5, -1.6_8_8_3, 0.2_4_2_0, 0.0_3_0_0, 0.6_3_4...
103
"""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
1
"""simple docstring""" import operator as op snake_case = '''scaler.pt''' snake_case = '''pytorch_model''' snake_case = '''random_states''' snake_case = '''optimizer''' snake_case = '''scheduler''' snake_case = '''pytorch_model.b...
103
"""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
1
"""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 Ten...
103
"""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
1
"""simple docstring""" def snake_case ( lowerCAmelCase_ ) -> str: return " ".join( ''''''.join(word[::-1] ) if len(lowerCAmelCase_ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(reverse...
103
"""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
1
"""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
"""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
1
"""simple docstring""" def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ) -> int: if len(lowerCAmelCase_ ) != len(lowerCAmelCase_ ): raise ValueError('''The length of profit and weight must be same.''' ) if max_weight <= 0: raise ValueErr...
103
"""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
1
"""simple docstring""" def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ) -> Union[str, Any]: if height >= 1: move_tower(height - 1 , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ) move_disk(l...
103
"""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
1
"""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_avail...
103
"""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
1
"""simple docstring""" class UpperCAmelCase : def __init__( self : str , __lowerCamelCase : Optional[int] , __lowerCamelCase : Dict , __lowerCamelCase : Union[str, Any] ): """simple docstring""" _snake_case ...
103
"""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
1
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mobilebert import MobileBertTokenizer snake_case = lo...
103
"""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
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.or...
103
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): @staticmethod @abstractmethod def __UpperCAmelCase ( __lowerCamelCase : ArgumentParser ): "...
103
1
"""simple docstring""" import copy import tempfile import unittest from huggingface_hub import HfFolder, delete_repo from parameterized import parameterized from requests.exceptions import HTTPError from transformers import AutoConfig, GenerationConfig from transformers.testing_utils imp...
103
"""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
1
"""simple docstring""" import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffu...
103
"""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
1
"""simple docstring""" import argparse import datetime def snake_case ( lowerCAmelCase_ ) -> str: _snake_case = { '''0''': '''Sunday''', '''1''': '''Monday''', '''2''': '''Tuesday''', '''3''': '''Wednesday''', '''4''': '''Thursday...
103
"""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
1
"""simple docstring""" def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> float: def get_matched_characters(lowerCAmelCase_ , lowerCAmelCase_ ) -> str: _snake_case = [] _snake_case = min(len(_stra ) , len(_stra ) ) // 2 for i, ...
103
"""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
1
"""simple docstring""" import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .uti...
103
"""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
1
"""simple docstring""" def snake_case ( lowerCAmelCase_ ) -> str: if number > 0: raise ValueError('''input must be a negative integer''' ) _snake_case = len(bin(lowerCAmelCase_ )[3:] ) _snake_case = bin(abs(lowerCAmelCase_ ) - (1 << binary_number_length) )...
103
"""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
1
"""simple docstring""" from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging snake_case = logging.get_logger(__name__) snake_case = { '''nielsr/canine-s''': 2_0_4_8, } # Unico...
103
"""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
1
"""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
"""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
1
"""simple docstring""" from __future__ import annotations import os from typing import Any import requests snake_case = '''https://api.github.com''' # https://docs.github.com/en/free-pro-team@latest/rest/reference/users#get-the-authenticated-user snake_case = BASE_...
103
"""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
1
"""simple docstring""" import json from typing import TYPE_CHECKING, 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 ...
103
"""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
1
"""simple docstring""" import os from datetime import datetime as dt from github import Github snake_case = [ '''good first issue''', '''good second issue''', '''good difficult issue''', '''enhancement''', '''new pipeline/model''', '''new scheduler''...
103
"""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
1
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils...
103
"""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
1
"""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_ge...
103
"""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
1
"""simple docstring""" class UpperCAmelCase : # Public class to implement a graph def __init__( self : int , __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : list[list[bool]] ): """simple docs...
103
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case = { '''configuration_informer''': [ '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP...
103
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case = { '''configuration_time_series_transformer''': [ '''TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', ...
103
"""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
1
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case = logging.get_logger(__name__) snake_case = { '''facebook/wav2vec2-base-960h''': '''https://huggingface.co/facebo...
103
"""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
1
"""simple docstring""" import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def snake_case ( lowerCAmelCase_ , lowerCAmelCase_=1 ) -> List[str]: if n_shave_prefix_segments >= 0: return ".".join(pat...
103
"""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
1
"""simple docstring""" import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin snake_case = get_tests_dir('''fixt...
103
"""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
1
"""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 snake_case = '''\ @misc{chen2021evaluat...
103
"""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
1
"""simple docstring""" from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo snake_case = '''\ @misc{wu2016googles, title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machin...
103
"""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
1
"""simple docstring""" def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> str: if number < 0 or shift_amount < 0: raise ValueError('''both inputs must be positive integers''' ) _snake_case = str(bin(lowerCAmelCase_ ) ) binary_number += "0" * shift_amo...
103
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): @staticmethod @abstractmethod def __UpperCAmelCase ( __lowerCamelCase : ArgumentParser ): "...
103
1
"""simple docstring""" from abc import ABC, abstractmethod from typing import List, Optional class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): def __init__( self : List[str] ): """simple docstring""" # test for the above condition self.te...
103
"""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
1
"""simple docstring""" from collections import deque class UpperCAmelCase : def __init__( self : Dict , __lowerCamelCase : str , __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" ...
103
"""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
1
"""simple docstring""" def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ) -> int: if exponent == 1: return base if exponent % 2 == 0: _snake_case = _modexpt(lowerCAmelCase_ , exponent // 2 , lowerCAmelCase_ ) % modul...
103
"""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
1
"""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
"""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
1
"""simple docstring""" import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepie...
103
"""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
1
"""simple docstring""" 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, ImageClassifierOutputWit...
103
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) snake_case = {'''configuration_fnet''': ['''FNET_PRETRAI...
103
"""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
1
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_OBJECT_DETECTION_MAPPING, AutoFeatureExtractor, AutoModelForObjectDetection, ObjectDetectionPipeline, is_vision_available, pipeline, ) from transformers.testing_utils import ( is_pipe...
103
"""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
1
"""simple docstring""" import argparse import os import re import packaging.version snake_case = '''examples/''' snake_case = { '''examples''': (re.compile(r'''^check_min_version\("[^"]+"\)\s*$''', re.MULTILINE), '''check_min_version("VERSION")\n'''), '''ini...
103
"""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
1
"""simple docstring""" # Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ) -> Union[str, Any]: _snake_case = { '''en''': '''Machine learning is grea...
103
"""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
1
"""simple docstring""" import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils impo...
103
"""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
1
"""simple docstring""" import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transfor...
103
"""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
1
"""simple docstring""" def snake_case ( lowerCAmelCase_ = 1000000 ) -> int: _snake_case = set(range(3 , lowerCAmelCase_ , 2 ) ) primes.add(2 ) for p in range(3 , lowerCAmelCase_ , 2 ): if p not in primes: continue primes.differe...
103
"""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
1
"""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
"""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
1
"""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
"""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
1
"""simple docstring""" import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class UpperCAm...
103
"""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
1
"""simple docstring""" import argparse import pathlib import fairseq import torch from fairseq.models.roberta import RobertaModel as FairseqRobertaModel from fairseq.modules import TransformerSentenceEncoderLayer from packaging import version from transformers import XLMRobertaConfig, XL...
103
"""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
1
"""simple docstring""" snake_case = [0, 2, 4, 6, 8] snake_case = [1, 3, 5, 7, 9] def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ) -> int: if remaining_length == 0: if digits[0] == 0 or digit...
103
"""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
1
"""simple docstring""" import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, l...
103
"""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
1
"""simple docstring""" import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def snake_case ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_=5 ) -> List[str]: # Adapted from https://github.com/pytorch/fair...
103
"""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
1