code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controlnet.pipeline_controlnet import StableDiffusionControlNetPipeline # noqa: F401 deprecate( "stable diffusion controlnet", "0.22.0", "Importing `StableDif...
715
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMSche...
625
0
"""simple docstring""" import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring''' def __init__( self : Dict, lowerCamelCase ...
716
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int = 4000000 ): """simple docstring""" lowerCamelCase__ : Dict =[] lowerCamelCase__ , lowerCamelCase__ : Union[str, Any] =0, 1 while b <= n: if b % 2 == 0: even_fibs.append(__lowerCamelCase ...
625
0
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary # Register SEW's fairseq modules from sew_asapp import tasks # noqa: F401 from transformers import ( SEWConfig, SEWForCTC, SEWModel, WavaVecaCTCTokenizer, WavaVe...
717
"""simple docstring""" from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configu...
625
0
"""simple docstring""" import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensorflow as tf...
718
"""simple docstring""" def snake_case__ ( __lowerCamelCase : list[list[int]] , __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : list[int] ): """simple docstring""" # 1. Validate that path exists between current and ne...
625
0
"""simple docstring""" import os import tempfile import unittest import uuid from pathlib import Path from transformers.testing_utils import get_tests_dir, require_soundfile, require_torch, require_vision from transformers.tools.agent_types import AgentAudio, AgentImage, AgentText from transformers.utils import...
719
"""simple docstring""" import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokeniz...
625
0
"""simple docstring""" from math import factorial _lowercase : Any = {str(d): factorial(d) for d in range(1_0)} def snake_case__ ( __lowerCamelCase : int ): """simple docstring""" return sum(DIGIT_FACTORIAL[d] for d in str(__lowerCamelCase ) ) def snake_ca...
720
"""simple docstring""" def snake_case__ ( __lowerCamelCase : str ): """simple docstring""" return " ".join( ''''''.join(word[::-1] ) if len(__lowerCamelCase ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() ...
625
0
"""simple docstring""" import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def snake_case__ ( __lowerCamelCase : int , __lowerCamelCase : Any , __lo...
721
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int = 10 , __lowerCamelCase : int = 22 ): """simple docstring""" lowerCamelCase__ : Optional[Any] =range(1 , __lowerCamelCase ) lowerCamelCase__ : str =range(1 , __lowerCamelCase ) ...
625
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase = { "configuration_lilt": ["LILT_PRETRAINED_CONFIG_ARCHIVE_MAP", "LiltConfig"], } try: if not is_torch_available(): raise OptionalDependenc...
700
"""simple docstring""" import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_a...
625
0
"""simple docstring""" from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fa...
701
"""simple docstring""" def snake_case__ ( __lowerCamelCase : list , __lowerCamelCase : list , __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" if index == number_of_items: ...
625
0
"""simple docstring""" import argparse import json import pickle from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import MaskFormerConfig, MaskFormerForInstanceSegmentation, MaskFormerImageProcessor, SwinConfig from tra...
702
"""simple docstring""" _lowercase : Optional[Any] = { "Pillow": "Pillow<10.0.0", "accelerate": "accelerate>=0.20.3", "av": "av==9.2.0", "beautifulsoup4": "beautifulsoup4", "black": "black~=23.1", "codecarbon": "codecarbon==1.2.0", "cookiecutter": "cookiecutter==1.7.3", ...
625
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowercase : Any = { "configuration_mobilenet_v2": [ "MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP", "MobileNetV2...
703
"""simple docstring""" def snake_case__ ( __lowerCamelCase : list[int] ): """simple docstring""" if not numbers: return 0 if not isinstance(__lowerCamelCase , (list, tuple) ) or not all( isinstance(__lowerCamelCase , __lowerCamelCase ) for number in num...
625
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase : Tuple = { "configuration_megatron_bert": ["MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MegatronBertConfig"], } try: if not is_torch_a...
704
"""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 .embeddings_flax imp...
625
0
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_uti...
705
"""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, ) _lowercase : Optional[Any] = { "conf...
625
0
"""simple docstring""" import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_se...
706
"""simple docstring""" import os def snake_case__ ( ): """simple docstring""" with open(os.path.dirname(__lowerCamelCase ) + '''/p022_names.txt''' ) as file: lowerCamelCase__ : Tuple =str(file.readlines()[0] ) lowerCamelCase__ : int =names.replace('''"''' , ''''...
625
0
"""simple docstring""" from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers impor...
707
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator class __SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : str, lowerCamelCase : int )-> None: lowerCamelCase__ : str =value ...
625
0
"""simple docstring""" from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. _lowercase : Dict = 2_0_0 # Number of elements selected in every generation of evolution. The selection takes # place from best to wor...
708
"""simple docstring""" import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel _lowercase : List[st...
625
0
"""simple docstring""" from copy import deepcopy class __SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : List[str], lowerCamelCase : list[int] | None = None, lowerCamelCase : int | None = None )-> None: if arr is...
709
"""simple docstring""" import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def snake_case__ ( __lowerCamelCase : str , __lowerCamelCase : str , __lowerCamelCase : Tuple ): """simple docstring"""...
625
0
"""simple docstring""" from __future__ import annotations def snake_case__ ( __lowerCamelCase : list[int] , __lowerCamelCase : int ): """simple docstring""" if len(__lowerCamelCase ) < k or k < 0: raise ValueError('''Invalid Input''' ...
710
"""simple docstring""" import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ConvNextConfig, UperNetConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import is_torch_a...
625
0
"""simple docstring""" import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import Padd...
711
"""simple docstring""" from ..utils import DummyObject, requires_backends class __SCREAMING_SNAKE_CASE ( metaclass=lowerCAmelCase_ ): '''simple docstring''' _a = ['onnx'] def __init__( self : List[str], *lowerCamelCase : Union[str, An...
625
0
"""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_pipeline_test, nested_...
712
"""simple docstring""" import colorsys from PIL import Image # type: ignore def snake_case__ ( __lowerCamelCase : float , __lowerCamelCase : float , __lowerCamelCase : int ): """simple docstring""" lowerCamelCase__ : Optional[Any] =x lowerC...
625
0
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int ): """simple docstring""" assert ( isinstance(__lowerCamelCase , __lowerCamelCase ) and number_of_steps > 0 ), f'''number_of_steps needs to be positive integer, your input {number_of_steps}''' if numb...
713
"""simple docstring""" import argparse import json import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( VideoMAEConfig, VideoMAEForPreTraining, VideoMAEForVideoClassification, VideoMAEImageProcessor, ) def snake_case__ ...
625
0
"""simple docstring""" import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_MO...
714
"""simple docstring""" _lowercase : str = 0 # The first color of the flag. _lowercase : Dict = 1 # The second color of the flag. _lowercase : Tuple = 2 # The third color of the flag. _lowercase : Optional[int] = (red, white, blue) def snake_case__ ( _...
625
0
"""simple docstring""" from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class __SCREAMING_SNAKE_CASE ( lowerCAmelCase_ ): '''simple docstring''' def __init__( self ...
715
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMSche...
625
0
"""simple docstring""" from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import Model...
716
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int = 4000000 ): """simple docstring""" lowerCamelCase__ : Dict =[] lowerCamelCase__ , lowerCamelCase__ : Union[str, Any] =0, 1 while b <= n: if b % 2 == 0: even_fibs.append(__lowerCamelCase ...
625
0
"""simple docstring""" import re import time from typing import Optional import IPython.display as disp from ..trainer_callback import TrainerCallback from ..trainer_utils import IntervalStrategy, has_length def snake_case__ ( __lowerCamelCase : Any ): """simple docstring""" lo...
717
"""simple docstring""" from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configu...
625
0
"""simple docstring""" class __SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : Any, lowerCamelCase : int )-> List[str]: lowerCamelCase__ : Any =n lowerCamelCase__ : Tuple =[None] * self.n lowerCamelCase__ : T...
718
"""simple docstring""" def snake_case__ ( __lowerCamelCase : list[list[int]] , __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : list[int] ): """simple docstring""" # 1. Validate that path exists between current and ne...
625
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowercase : int = logging.get_logger(__name__) _lowercase : Any = { "junnyu/roformer...
719
"""simple docstring""" import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokeniz...
625
0
"""simple docstring""" import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transformers.image_utils import...
720
"""simple docstring""" def snake_case__ ( __lowerCamelCase : str ): """simple docstring""" return " ".join( ''''''.join(word[::-1] ) if len(__lowerCamelCase ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() ...
625
0
"""simple docstring""" import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transfor...
721
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int = 10 , __lowerCamelCase : int = 22 ): """simple docstring""" lowerCamelCase__ : Optional[Any] =range(1 , __lowerCamelCase ) lowerCamelCase__ : str =range(1 , __lowerCamelCase ) ...
625
0
from ..utils import DummyObject, requires_backends class a__ ( metaclass=snake_case ): """simple docstring""" __lowerCamelCase = ['note_seq'] def __init__( self , *lowercase , **lowercase ) -> Optional[int]: '''simple docstring'...
626
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 import ModelMixin from .prior_transformer import PriorTransformer fr...
626
1
from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_res...
626
from math import factorial def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 1_0_0 ) -> int: '''simple docstring''' return sum(map(SCREAMING_SNAKE_CASE_ , str(factorial(SCREAMING_SNAKE_CASE_ ) ) ) ) if __name__ == "__main__": print(soluti...
626
1
# Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
626
lowerCAmelCase__ = """ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/""" def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: bytes ) -> bytes: '''simple docstring''' if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): A__...
626
1
import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = {"""vocab_file""": """vocab.json"""} lowerCAmelCase__ = { """vocab_file""": { """mgp-...
626
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice,...
626
1
# Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config # - generate model_cards - usef...
626
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> int: '''simple docstring''' if divisor % 5 == 0 or divisor % 2 == 0: return 0 A__ = 1 A__ = 1 while repunit: A__ = (1_0 * repunit + 1) % divisor repunit_i...
626
1
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list ) -> list: '''simple docstring''' if len(SCREAMING_SNAKE_CASE_ ) < 2: return collection def circle_sort_util(SCREAMING_SNAKE_CASE_: list , SCREAMING_SNAKE_CASE_: int , SCREAMING_S...
626
from __future__ import annotations from collections.abc import Iterator from typing import Any class a__ : """simple docstring""" def __init__( self , lowercase ) -> int: '''simple docstring''' A__ = data A__ = None class ...
626
1
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int , SCREAMING_SNAKE_CASE_: int ) -> list[str]: '''simple docstring''' if partitions <= 0: raise ValueError("partitions must be a positive number!" ) if parti...
626
import math lowerCAmelCase__ = 1_0 lowerCAmelCase__ = 7 lowerCAmelCase__ = BALLS_PER_COLOUR * NUM_COLOURS def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 2_0 ) -> str: '''simple docstring''' A__ = math.comb(SCREAMING_SNAKE_CASE_ , SCREAMING...
626
1
class a__ ( snake_case ): """simple docstring""" pass class a__ ( snake_case ): """simple docstring""" pass class a__ : """simple docstring""" def __init__( self ) -> Optional[Any]: '''simple docstring''' ...
626
from typing import Union import fire import torch from tqdm import tqdm def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: str = "cpu" , SCREAMING_SNAKE_CASE_: Union[str, None] = None ) -> None: '''simple docstring''' A_...
626
1
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str ) -> str: '''simple docstring''' return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
626
from dataclasses import dataclass, field from typing import Optional from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser @dataclass class a__ : """simple docstring""" __lowerCamelCase = field( metadata={'h...
626
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) lowerCAmelCase__ = {"""configuration_vit""": ["""VIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ViTConfig""", """V...
626
import collections import importlib.util import os import re from pathlib import Path lowerCAmelCase__ = """src/transformers""" # Matches is_xxx_available() lowerCAmelCase__ = re.compile(R"""is\_([a-z_]*)_available()""") # Catches a one-line _import_struct = {xxx} lowerCAmelCase__ = re.compile(R"""^_impo...
626
1
import argparse import collections import os import re import tempfile import pandas as pd from datasets import Dataset from huggingface_hub import hf_hub_download, upload_folder from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root ...
626
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class a__ ( snake_case ): """simple docstring""" def __init__( self , *lowercase , **lowercase ) -> ...
626
1
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: List[str] ) -> Dict: '''simple docstring''' return [ { 0: [1, 2], 1: [0, 2], 2: [0, 1, 3, 5], 3: [2, 4], 4: [3], 5: [2, 6, 8], 6: [5, ...
626
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: list[str] | None = None ) -> list[list[str]]: '''simple docstring''' A__ = word_bank or [] # create a table A__ = len(SCR...
626
1
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Dict , SCREAMING_SNAKE_CASE_: List[str] ) -> str: '''simple docstring''' A__ = "" for i in table: res += inp[i - 1] return res def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: ...
626
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_:...
626
1
import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version lowerCAmelCase__ = version.parse(importlib_metadata.version("""nltk""")) if NLTK_VERSION >= version.Version("""3.6.4"""): from nltk import word_tokenize lowerCAmelCase__ = """...
626
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Namespace ) -> Tuple: '''simple docstring''' return ConvertCommand( args.model_type , args.t...
626
1
import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Dict ...
626
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_to...
626
1
from __future__ import annotations from collections.abc import Callable def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Callable[[int | float], int | float] , SCREAMING_SNAKE_CASE_: int | float , SCREAMING_SNAKE_CASE_: int | float , SCREAMING_SNAKE_CASE_: int = 1...
626
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFCamembertModel @require_tf...
626
1
from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = {...
626
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, skip_mps from ..pipeline_params import UNCONDITION...
626
1
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class a__ ( snake_case ): """simple docstring""" __lowerCamelCase = (UnCLIPScheduler,) def UpperCamelCase ( self , **lowercase ) -> str: ...
626
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[list[str]] , SCREAMING_SNAKE_CASE_: int , ) -> ...
626
1
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def lowerCAmelCase__ ( SCREAMING_SNAKE_CAS...
626
from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, RequestCounter, ...
626
1
from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image ...
626
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py lowerCAmelCase__ = """src/transformers""" # This is to make sure the transforme...
626
1
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_utils import require_vision from transformers.utils import...
626
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch i...
626
1
import inspect import unittest class a__ ( unittest.TestCase ): """simple docstring""" def UpperCamelCase ( self ) -> List[str]: '''simple docstring''' try: import diffusers # noqa: F401 except ImportError: assert Fal...
626
import datasets from .evaluate import evaluate lowerCAmelCase__ = """\ @inproceedings{Rajpurkar2016SQuAD10, title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text}, author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang}, booktitle={EMNLP}, year={2016} } """ lowerCA...
626
1
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
626
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 import ModelMixin from .prior_transformer import PriorTransformer fr...
626
1
import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput ...
626
from math import factorial def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 1_0_0 ) -> int: '''simple docstring''' return sum(map(SCREAMING_SNAKE_CASE_ , str(factorial(SCREAMING_SNAKE_CASE_ ) ) ) ) if __name__ == "__main__": print(soluti...
626
1
import argparse import os import torch from transformers import FlavaConfig, FlavaForPreTraining from transformers.models.flava.convert_dalle_to_flava_codebook import convert_dalle_checkpoint def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Optional[Any] ) -> Dict: '''simple doc...
626
lowerCAmelCase__ = """ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/""" def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: bytes ) -> bytes: '''simple docstring''' if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): A__...
626
1
import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassificationWithTeacher, EfficientFormerIma...
626
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice,...
626
1
import argparse import json import subprocess def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int , SCREAMING_SNAKE_CASE_: List[Any] ) -> Dict: '''simple docstring''' A__ = [] A__ = ( F'curl -H "Accept: application/vnd.github+js...
626
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> int: '''simple docstring''' if divisor % 5 == 0 or divisor % 2 == 0: return 0 A__ = 1 A__ = 1 while repunit: A__ = (1_0 * repunit + 1) % divisor repunit_i...
626
1
import argparse import gc import json import os import re import torch from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedTokenizerFast, RwkvConfig from transformers.modeling_utils import WEIGHTS_INDEX_NAME, shard_checkpoint lowerCAmelCase__ = { ...
626
from __future__ import annotations from collections.abc import Iterator from typing import Any class a__ : """simple docstring""" def __init__( self , lowercase ) -> int: '''simple docstring''' A__ = data A__ = None class ...
626
1
import logging from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import arg_to_scheduler from transformers import TrainingArguments lowerCAmelCase__ = logging.getLogger(__name__) @dataclass class a__ ( snake_case ): """simple docstring""" __...
626
import math lowerCAmelCase__ = 1_0 lowerCAmelCase__ = 7 lowerCAmelCase__ = BALLS_PER_COLOUR * NUM_COLOURS def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 2_0 ) -> str: '''simple docstring''' A__ = math.comb(SCREAMING_SNAKE_CASE_ , SCREAMING...
626
1
def lowerCAmelCase__ ( ) -> Optional[Any]: '''simple docstring''' A__ = [] A__ = 1 while len(SCREAMING_SNAKE_CASE_ ) < 1e6: constant.append(str(SCREAMING_SNAKE_CASE_ ) ) i += 1 A__ = "".join(SCREAMING_SNAKE_CASE...
626
from typing import Union import fire import torch from tqdm import tqdm def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: str = "cpu" , SCREAMING_SNAKE_CASE_: Union[str, None] = None ) -> None: '''simple docstring''' A_...
626
1
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice,...
626
from dataclasses import dataclass, field from typing import Optional from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser @dataclass class a__ : """simple docstring""" __lowerCamelCase = field( metadata={'h...
626
1
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem lowerCAmelCase__ = importlib.util.find_spec("""s3fs""") is not None if _has_safs: from .safilesystem import SaFileSystem #...
626
import collections import importlib.util import os import re from pathlib import Path lowerCAmelCase__ = """src/transformers""" # Matches is_xxx_available() lowerCAmelCase__ = re.compile(R"""is\_([a-z_]*)_available()""") # Catches a one-line _import_struct = {xxx} lowerCAmelCase__ = re.compile(R"""^_impo...
626
1
import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers...
626
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class a__ ( snake_case ): """simple docstring""" def __init__( self , *lowercase , **lowercase ) -> ...
626
1
import datasets from .evaluate import evaluate lowerCAmelCase__ = """\ @inproceedings{Rajpurkar2016SQuAD10, title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text}, author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang}, booktitle={EMNLP}, year={2016} } """ lowerCA...
626
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: list[str] | None = None ) -> list[list[str]]: '''simple docstring''' A__ = word_bank or [] # create a table A__ = len(SCR...
626
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase__ = { """configuration_x_clip""": [ """XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XCLIPConfig""", """XCLIPTextConfig""", """XCLIPVisionConfig""...
626
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_:...
626
1
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.models.bert.configuration_bert import BertConfig from tra...
626
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Namespace ) -> Tuple: '''simple docstring''' return ConvertCommand( args.model_type , args.t...
626
1
class a__ : """simple docstring""" def __init__( self ) -> Optional[int]: '''simple docstring''' A__ = 0 A__ = 0 A__ = {} def UpperCamelCase ( self , lowercase ) -> Any: '''sim...
626
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_to...
626
1
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, skip_mps from ..pipeline_params import UNCONDITION...
626
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFCamembertModel @require_tf...
626
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase__ = { """configuration_clipseg""": [ """CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CLIPSegConfig""", """CLIPSegTextConfig""", """CLIPSegVisio...
626
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, skip_mps from ..pipeline_params import UNCONDITION...
626
1
import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: ndarray ) -> float: '''simple docstring''' return np.dot(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ) ...
626
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[list[str]] , SCREAMING_SNAKE_CASE_: int , ) -> ...
626
1
import os import time import numpy as np import onnxruntime as ort lowerCAmelCase__ = """1""" lowerCAmelCase__ = """0""" lowerCAmelCase__ = """1""" lowerCAmelCase__ = ort.SessionOptions() lowerCAmelCase__ = ort.GraphOptimizationLevel.ORT_DISABLE_ALL print("""Create inference session...""") lowerCAm...
626
from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, RequestCounter, ...
626
1
import inspect import os import unittest from dataclasses import dataclass import torch from accelerate import Accelerator, DistributedDataParallelKwargs, GradScalerKwargs from accelerate.state import AcceleratorState from accelerate.test_utils import execute_subprocess_async, require_cuda, require_multi_gpu from a...
626
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py lowerCAmelCase__ = """src/transformers""" # This is to make sure the transforme...
626
1
import unittest from datasets import load_dataset from transformers import BloomTokenizerFast from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class a__ ( snake_case , unittest.TestCase ): """simple ...
626
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch i...
626
1
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 import ModelMixin from .prior_transformer import PriorTransformer fr...
626
import datasets from .evaluate import evaluate lowerCAmelCase__ = """\ @inproceedings{Rajpurkar2016SQuAD10, title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text}, author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang}, booktitle={EMNLP}, year={2016} } """ lowerCA...
626
1
import collections import importlib.util import os import re from pathlib import Path lowerCAmelCase__ = """src/transformers""" # Matches is_xxx_available() lowerCAmelCase__ = re.compile(R"""is\_([a-z_]*)_available()""") # Catches a one-line _import_struct = {xxx} lowerCAmelCase__ = re.compile(R"""^_impo...
626
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 import ModelMixin from .prior_transformer import PriorTransformer fr...
626
1
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ( BitConfig, ViTHybridC...
626
from math import factorial def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 1_0_0 ) -> int: '''simple docstring''' return sum(map(SCREAMING_SNAKE_CASE_ , str(factorial(SCREAMING_SNAKE_CASE_ ) ) ) ) if __name__ == "__main__": print(soluti...
626
1
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Namespace ) -> Tuple: '''simple docstring''' return ConvertCommand( args.model_type , args.t...
626
lowerCAmelCase__ = """ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/""" def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: bytes ) -> bytes: '''simple docstring''' if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): A__...
626
1
from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str ) -> None: '''simple docstring''' A__ , A__ = analyze_text(SCREAMING_SNAKE_CASE_ ) ...
626
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice,...
626
1
import argparse import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Accelerator, DistributedTy...
626
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> int: '''simple docstring''' if divisor % 5 == 0 or divisor % 2 == 0: return 0 A__ = 1 A__ = 1 while repunit: A__ = (1_0 * repunit + 1) % divisor repunit_i...
626
1
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Union[str, Any] , SCREAMING_SNAKE_CASE_: int , SCREAMING_SNAKE_CASE_: int , SCREAMING_SNAKE_CASE_: Dict ) -> Union[str, Any]: # noqa: E741 '''simple docstring''...
626
from __future__ import annotations from collections.abc import Iterator from typing import Any class a__ : """simple docstring""" def __init__( self , lowercase ) -> int: '''simple docstring''' A__ = data A__ = None class ...
626
1
from datetime import datetime import requests from bsa import BeautifulSoup if __name__ == "__main__": lowerCAmelCase__ = input("""Enter image url: """).strip() print(f"""Downloading image from {url} ...""") lowerCAmelCase__ = BeautifulSoup(requests.get(url).content, """html.parser""") # The image URL is ...
626
import math lowerCAmelCase__ = 1_0 lowerCAmelCase__ = 7 lowerCAmelCase__ = BALLS_PER_COLOUR * NUM_COLOURS def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 2_0 ) -> str: '''simple docstring''' A__ = math.comb(SCREAMING_SNAKE_CASE_ , SCREAMING...
626
1
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Tuple ) -> List[Any]: '''simple docstring''' A__ = 1 A__ = 2 while i * i <= n: A__ = 0 while n % i == 0: n //= i multiplicity += 1 n_divisors *...
626
from typing import Union import fire import torch from tqdm import tqdm def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: str = "cpu" , SCREAMING_SNAKE_CASE_: Union[str, None] = None ) -> None: '''simple docstring''' A_...
626
1
import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version(""">=""", FSDP_PYTORCH_VERSION): import torch.distributed.checkpoint as dist_cp from torch.distributed.checkpoint.default_pla...
626
from dataclasses import dataclass, field from typing import Optional from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser @dataclass class a__ : """simple docstring""" __lowerCamelCase = field( metadata={'h...
626
1
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list ) -> list: '''simple docstring''' if len(SCREAMING_SNAKE_CASE_ ) <= 1: return lst A__ = 1 while i < len(SCREAMING_SNAKE_CASE_ ): if lst[i - 1] <= lst[i]: i += 1 ...
626
import collections import importlib.util import os import re from pathlib import Path lowerCAmelCase__ = """src/transformers""" # Matches is_xxx_available() lowerCAmelCase__ = re.compile(R"""is\_([a-z_]*)_available()""") # Catches a one-line _import_struct = {xxx} lowerCAmelCase__ = re.compile(R"""^_impo...
626
1
import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils import logging if version.parse(fairseq.__ver...
626
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class a__ ( snake_case ): """simple docstring""" def __init__( self , *lowercase , **lowercase ) -> ...
626
1
from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. lowerCAmelCase__ = 2_0_0 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst of that generation and must be smaller t...
626
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: str , SCREAMING_SNAKE_CASE_: list[str] | None = None ) -> list[list[str]]: '''simple docstring''' A__ = word_bank or [] # create a table A__ = len(SCR...
626
1
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[list[str]] , SCREAMING_SNAKE_CASE_: int , ) -> ...
626
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_: List[str] , SCREAMING_SNAKE_CASE_:...
626
1
import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import numpy as np import pandas as pd from datasets import load_dataset import transformers from transformers import ( AutoConfig, BartForSequenceClassification, DataCo...
626
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: Namespace ) -> Tuple: '''simple docstring''' return ConvertCommand( args.model_type , args.t...
626
1
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast lowerCAmelCase__ = datasets.utils.logging.get_logger(__name__) @dataclass class a__ ( datasets.BuilderConfi...
626
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_to...
626
1
import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, require_tf, require_torch from tr...
626
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import TFCamembertModel @require_tf...
626
1
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ap...
626
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, skip_mps from ..pipeline_params import UNCONDITION...
626
1
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassificat...
626
from __future__ import annotations def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[int] , SCREAMING_SNAKE_CASE_: list[list[str]] , SCREAMING_SNAKE_CASE_: int , ) -> ...
626
1
import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def lowerCAmelCase__ ( SCREAMING_SNAKE_CAS...
626
from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, RequestCounter, ...
626
1
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename lowerCAmelCase__ = """http://www.mocksite.com/file1.txt""" lowerCAm...
626
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py lowerCAmelCase__ = """src/transformers""" # This is to make sure the transforme...
626
1
import math from typing import Any, Callable, List, Optional, Tuple, Union import numpy as np import torch from ...models import TaFilmDecoder from ...schedulers import DDPMScheduler from ...utils import is_onnx_available, logging, randn_tensor if is_onnx_available(): from ..onnx_utils import OnnxRuntimeModel f...
626
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch i...
626
1
import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def lowerCAmelCase__ ( ) -> Tuple: '''simple docstring''' with offline(OfflineSimulationMo...
626
import datasets from .evaluate import evaluate lowerCAmelCase__ = """\ @inproceedings{Rajpurkar2016SQuAD10, title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text}, author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang}, booktitle={EMNLP}, year={2016} } """ lowerCA...
626
1
import argparse import re from flax.traverse_util import flatten_dict, unflatten_dict from tax import checkpoints from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration from transformers.modeling_flax_pytorch_utils import load_flax_weights_in_pytorch_model from transformers.ut...
626
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 import ModelMixin from .prior_transformer import PriorTransformer fr...
626
1
import asyncio import os import re import sys import tempfile import unittest from contextlib import contextmanager from copy import deepcopy from distutils.util import strtobool from enum import Enum from importlib.util import find_spec from pathlib import Path from unittest.mock import patch import pyarrow as pa i...
626
from math import factorial def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int = 1_0_0 ) -> int: '''simple docstring''' return sum(map(SCREAMING_SNAKE_CASE_ , str(factorial(SCREAMING_SNAKE_CASE_ ) ) ) ) if __name__ == "__main__": print(soluti...
626
1
from __future__ import annotations from collections.abc import Iterator from typing import Any class a__ : """simple docstring""" def __init__( self , lowercase ) -> int: '''simple docstring''' A__ = data A__ = None class ...
626
lowerCAmelCase__ = """ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/""" def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: bytes ) -> bytes: '''simple docstring''' if not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): A__...
626
1
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_channel_dime...
626
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice,...
626
1
import unittest from pathlib import Path from tempfile import NamedTemporaryFile, TemporaryDirectory from transformers import BertConfig, BertTokenizerFast, FeatureExtractionPipeline from transformers.convert_graph_to_onnx import ( convert, ensure_valid_input, generate_identified_filename, infer_shap...
626
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_: int ) -> int: '''simple docstring''' if divisor % 5 == 0 or divisor % 2 == 0: return 0 A__ = 1 A__ = 1 while repunit: A__ = (1_0 * repunit + 1) % divisor repunit_i...
626
1