code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def lowerCamelCase ( lowerCAmelCase : str ): """simple docstring""" __magic_name__ : Tuple = os.path.join(args.tf_model_dir , 'param...
362
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
275
0
'''simple docstring''' import os import re from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase :Union[str, Any] = logging.get_logge...
363
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaI...
275
0
'''simple docstring''' import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( B...
364
'''simple docstring''' import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_to...
275
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig lowerCAmelCase :int = { '''google/tapas-base-finetuned-sqa''': ( '''https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json''' ), '''google/tapas-base-finetuned-wtq''': ( '...
365
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str ): """simple docstring""" return "".join(chr(ord(lowerCAmelCase ) - 32 ) if 'a' <= char <= 'z' else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
275
0
'''simple docstring''' import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFe...
366
'''simple docstring''' 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, get_resize_output_image_size, normalize, rescale, resize, to_channel...
275
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available lowerCAmelCase :str = {'''tokenization_herbert''': ['''HerbertTokenizer''']} try: if not is_tokenizers_available(): raise Optional...
367
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): __magic_name__ : int = f'Input value of [number={number}] must be an integer' raise TypeError(lowerCAmelCase ) if nu...
275
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class _lowerCamelCase ( metaclass=lowercase__ ): '''simple docstring''' A_ : List[Any] = ["""note_seq"""] def __init__( self : Optional[int] , *_A : Any , **_A : ...
368
'''simple docstring''' import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( ...
275
0
'''simple docstring''' import json import os from dataclasses import dataclass from functools import partial from typing import Callable import flax.linen as nn import jax import jax.numpy as jnp import joblib import optax import wandb from flax import jax_utils, struct, traverse_util from flax.serialization impor...
369
'''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_tensor lowerCAmelCase ...
275
0
'''simple docstring''' import collections import json import os import re from typing import TYPE_CHECKING, List, Optional, Tuple import numpy as np from ...tokenization_utils_fast import PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import ...
370
'''simple docstring''' import socket def lowerCamelCase ( ): """simple docstring""" __magic_name__ : List[str] = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) __magic_name__ : Union[str, Any] = socket.gethostname() __magic_name__ : int ...
275
0
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def lowerCamelCase ( l...
371
'''simple docstring''' from __future__ import annotations from sys import maxsize from typing import Generic, TypeVar lowerCAmelCase :Any = TypeVar('''T''') def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" return (position - 1) // 2 def l...
275
0
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : Any , lowerCAmelCase : str , lowerCAmelCase : List[str] , lowerCAmelCase : str ): """simple docstring""" __magic_name__ : Optional[int] = [False] * len(lowerCAmelCase ) __magic_na...
350
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow ha...
275
0
'''simple docstring''' from statistics import mean, stdev def lowerCamelCase ( lowerCAmelCase : list , lowerCAmelCase : int = 3 ): """simple docstring""" __magic_name__ : Any = min(lowerCAmelCase ) __magic_name__ : Any = max(lowerCAme...
351
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" __magic_name__ : Optional[int] = 1 for i in range(1 , num + 1 ): fact *= i return fact def lowerCamelCase ( lowerCAmelCase : int ): """simple ...
275
0
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" return 1 if digit in (0, 1) else (digit * factorial(digit - 1 )) def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" __magic_name__ : str...
352
'''simple docstring''' from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DD...
275
0
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : float , lowerCAmelCase : float ): """simple docstring""" if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) return (bulk_modul...
353
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logging, ) ...
275
0
'''simple docstring''' import os import string import sys lowerCAmelCase :str = 1 << 8 lowerCAmelCase :Optional[Any] = { '''tab''': ord('''\t'''), '''newline''': ord('''\r'''), '''esc''': 2_7, '''up''': 6_5 + ARROW_KEY_FLAG, '''down''': 6_6 + ARROW_KEY_FLAG, ...
354
'''simple docstring''' import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor lowerCAmelCase :Tuple = logging.get_logger(__name__) class _lowerCamelCase ( lowercase__ ): '''simple docstring''' def __init__( self : Any , ...
275
0
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass class _lowerCame...
355
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCAmelCase :str = { '''configuration_vision_encoder_decoder''': ['''VisionEncoderDecoder...
275
0
'''simple docstring''' import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _lowerCamelCase ( unittest.TestC...
356
'''simple docstring''' lowerCAmelCase :Union[str, Any] = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers...
275
0
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, Trainin...
357
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str , lowerCAmelCase : Any , lowerCAmelCase : Any=False ): """simple docstring""" if isinstance(lowerCAmelCase , lowerCAmelCase ) and isinstance(lowerCAmelCase , lowerCAmelCase ): __magic_name__ : ...
275
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :Any = logging.get_logger(__name__) lowerCAmelCase :int = { '''unc-nlp/lxmert-base-uncased''': '''https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/mai...
358
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str ): """simple docstring""" if not all(x.isalpha() for x in string ): raise ValueError('String must only contain alphabetic characters.' ) __magic_name__ : int = sorted(string.lower() ) return len(l...
275
0
'''simple docstring''' import argparse import math import traceback import dateutil.parser as date_parser import requests def lowerCamelCase ( lowerCAmelCase : Any ): """simple docstring""" __magic_name__ : Dict = {} __magic_name__ : Union[str, Any] ...
359
'''simple docstring''' import math def lowerCamelCase ( lowerCAmelCase : float , lowerCAmelCase : float ): """simple docstring""" return math.pow(lowerCAmelCase , 2 ) - a def lowerCamelCase ( lowerCAmelCase : float ): """simple docstring"...
275
0
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int = 1000 ): """simple docstring""" __magic_name__ : str = 2**power __magic_name__ : Dict = str(lowerCAmelCase ) __magic_name__ : Optional[Any] = list(lowerCAmelCase ) __ma...
360
'''simple docstring''' import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _lowerCamelCase ( unittest.TestC...
275
0
import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor if is_flax_availabl...
361
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :Any = logging.get_logger(__name__) lowerCAmelCase :int = { '''unc-nlp/lxmert-base-uncased''': '''https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/mai...
275
0
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.__ve...
362
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
275
0
'''simple docstring''' import torch from accelerate import PartialState from accelerate.utils.operations import broadcast, gather, gather_object, pad_across_processes, reduce def lowerCamelCase ( lowerCAmelCase : Dict ): """simple docstring""" return (torch.arange(state.num_pro...
363
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaI...
275
0
'''simple docstring''' import argparse import json import os import re from collections import OrderedDict from os.path import basename, dirname import fairseq import torch from fairseq import hub_utils from fairseq.data.dictionary import Dictionary from transformers import FSMTConfig, FSMTForConditionalGeneration f...
364
'''simple docstring''' import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_to...
275
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase :Any = logging.get_logger(__name__) lowerCAmelCase :Tuple = { '''s-JoL/Open-Llama-V1''': '''https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json''',...
365
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str ): """simple docstring""" return "".join(chr(ord(lowerCAmelCase ) - 32 ) if 'a' <= char <= 'z' else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
275
0
'''simple docstring''' import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transf...
366
'''simple docstring''' 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, get_resize_output_image_size, normalize, rescale, resize, to_channel...
275
0
'''simple docstring''' import requests from bsa import BeautifulSoup def lowerCamelCase ( lowerCAmelCase : str , lowerCAmelCase : dict ): """simple docstring""" __magic_name__ : str = BeautifulSoup(requests.get(lowerCAmelCase , params=lowerCAmelCase )....
367
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): __magic_name__ : int = f'Input value of [number={number}] must be an integer' raise TypeError(lowerCAmelCase ) if nu...
275
0
'''simple docstring''' from typing import TYPE_CHECKING from ..models.auto import AutoModelForVisionaSeq from ..utils import requires_backends from .base import PipelineTool if TYPE_CHECKING: from PIL import Image class _lowerCamelCase ( lowercase__ ): '''simple docstring''' A_ ...
368
'''simple docstring''' import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( ...
275
0
'''simple docstring''' import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenizerBa...
369
'''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_tensor lowerCAmelCase ...
275
0
'''simple docstring''' import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_to...
370
'''simple docstring''' import socket def lowerCamelCase ( ): """simple docstring""" __magic_name__ : List[str] = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) __magic_name__ : Union[str, Any] = socket.gethostname() __magic_name__ : int ...
275
0
'''simple docstring''' import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...im...
371
'''simple docstring''' from __future__ import annotations from sys import maxsize from typing import Generic, TypeVar lowerCAmelCase :Any = TypeVar('''T''') def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" return (position - 1) // 2 def l...
275
0
def __lowerCamelCase ( __a :int = 1_0_0_0 ) -> int: """simple docstring""" A__ = -1 A__ = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c A__ = (n * n - 2...
276
import math def __lowerCamelCase ( ) -> None: """simple docstring""" A__ = input("""Enter message: """ ) A__ = int(input(F'Enter key [2-{len(__a ) - 1}]: ' ) ) A__ = input("""Encryption/Decryption [e/d]: """ ...
276
1
import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_vision, slow,...
276
import os import re import shutil import sys import tempfile import unittest import black A : Dict = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E402 # This is...
276
1
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add...
276
import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": A : List[str] = argparse.ArgumentParser( description=( '''Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned''' ...
276
1
import random def __lowerCamelCase ( __a :int , __a :float , __a :bool = False ) -> dict: """simple docstring""" A__ = {i: [] for i in range(__a )} # if probability is greater or equal than 1, then generate...
276
from string import ascii_uppercase A : List[str] = {str(ord(c) - 5_5): c for c in ascii_uppercase} def __lowerCamelCase ( __a :int , __a :int ) -> str: """simple docstring""" if isinstance(__a , __a ): raise TypeE...
276
1
import unittest from knapsack import greedy_knapsack as kp class A (unittest.TestCase ): '''simple docstring''' def a_ ( self : Optional[Any] ) -> Union[str, Any]: """simple docstring""" A__ = ...
276
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A : Optional[Any] = {'''configuration_vit_mae''': ['''VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMAECon...
276
1
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : Tuple = {'''configuration_focalnet''': ['''FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FocalNetConfig''']} try: if not i...
276
import unittest import numpy as np def __lowerCamelCase ( __a :np.ndarray , __a :np.ndarray , __a :np.ndarray , __a :np.ndarray | None = None , ) -> np.ndarray: """simple docstring""" A__ = np.s...
276
1
import math def __lowerCamelCase ( __a :list , __a :int ) -> int: """simple docstring""" A__ = len(__a ) A__ = int(math.floor(math.sqrt(__a ) ) ) A__ = 0 while arr[min(__a , __a ...
276
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
276
1
import json import os import shutil import tempfile from unittest import TestCase from transformers import BartTokenizer, BartTokenizerFast, DPRQuestionEncoderTokenizer, DPRQuestionEncoderTokenizerFast from transformers.models.bart.configuration_bart import BartConfig from transformers.models.bert....
276
import argparse import math import traceback import dateutil.parser as date_parser import requests def __lowerCamelCase ( __a :str ) -> Optional[int]: """simple docstring""" A__ = {} A__ = job["""started_at"""] A...
276
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available A : Dict = { '''configuration_transfo_xl''': ['''TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TransfoXLConfig'''], '''tokenization_transfo_xl''':...
276
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_configuration_common...
276
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available A : Any = { '''configuration_pix2struct''': [ '''PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Pix2StructConfig''', '''P...
276
from ...configuration_utils import PretrainedConfig from ...utils import logging A : Dict = logging.get_logger(__name__) A : Dict = { '''google/pegasus-large''': '''https://huggingface.co/google/pegasus-large/resolve/main/config.json''', # See all PEGASUS models at https://h...
276
1
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 A : Any = '''\ @misc{chen2021evaluating, title={Evaluating Large Lan...
276
# 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 r...
276
1
import math def __lowerCamelCase ( ) -> None: """simple docstring""" A__ = input("""Enter message: """ ) A__ = int(input(F'Enter key [2-{len(__a ) - 1}]: ' ) ) A__ = input("""Encryption/Decryption [e/d]: """ ...
276
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, ...
276
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING A : Optional[int] = logging.get_logger(__name__) ...
276
import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transforme...
276
1
import argparse import math import traceback import dateutil.parser as date_parser import requests def __lowerCamelCase ( __a :str ) -> Optional[int]: """simple docstring""" A__ = {} A__ = job["""started_at"""] A...
276
from typing import TYPE_CHECKING from ...utils import _LazyModule A : Optional[Any] = {'''processing_wav2vec2_with_lm''': ['''Wav2Vec2ProcessorWithLM''']} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys A : List[s...
276
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : Optional[Any] = {'''configuration_ibert''': ['''IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''IBertConfig''', '''IBertOnnxConfig''']} try: if not is_torch_available(...
276
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, get_resize_output_image_size, normalize, rescale, resize, to_channel_dim...
276
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available A : Tuple = { '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], '''tokenization_xlm''': ['''...
276
def __lowerCamelCase ( __a :float , __a :list[float] ) -> float: """simple docstring""" if discount_rate < 0: raise ValueError("""Discount rate cannot be negative""" ) if not cash_flows: raise ValueError("""Cash flows list cannot be emp...
276
1
def __lowerCamelCase ( __a :list ) -> list: """simple docstring""" if len(__a ) < 2: return collection def circle_sort_util(__a :list , __a :int , __a :int ) -> bool: A__ = False if low == high: ...
276
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Tuple = logging.get_logger(__name__) A : Optional[int] = { '''roberta-base''': '''https://huggin...
276
1
import inspect import os import torch from transformers import AutoModel from transformers.testing_utils import mockenv_context from transformers.trainer_utils import set_seed import accelerate from accelerate.accelerator import Accelerator from accelerate.state import AcceleratorState from acc...
276
def __lowerCamelCase ( __a :int = 3 , __a :int = 7 , __a :int = 1_0_0_0_0_0_0 ) -> int: """simple docstring""" A__ = 0 A__ = 1 for current_denominator in range(1 , limit + 1 ): A__ = cu...
276
1
from __future__ import annotations import time A : Any = list[tuple[int, int]] A : Any = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0], [0, ...
276
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __lowerCamelCase ( __a :int ) -> int: """simple docstring""" A__ = prime_factors(__a ) if is_square_free(__a ): return -1 if l...
276
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) A : int = { '''configuration_swiftformer''': [ '''SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SwiftFormerConfig''', '...
276
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask ...
276
1
from ...configuration_utils import PretrainedConfig from ...utils import logging A : List[Any] = logging.get_logger(__name__) A : Dict = { '''microsoft/markuplm-base''': '''https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json''', '''microsoft/markuplm-larg...
276
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A : Optional[Any] = logging.get_logger(__name__) A : List[str] = { '''huggingface/time-series-transformer-tourism-monthly''': ( '''https://hugging...
276
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available A : int = {'''configuration_speech_encoder_decoder''': ['''SpeechEncoderDecoderConfig''']} try: if not is_torch_available(): raise Optio...
276
import math def __lowerCamelCase ( __a :int ) -> bool: """simple docstring""" A__ = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(__a ) def __lowerCamelCase ( _...
276
1
import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokenizer from transformers.models.mbar...
276
import math def __lowerCamelCase ( ) -> None: """simple docstring""" A__ = input("""Enter message: """ ) A__ = int(input(F'Enter key [2-{len(__a ) - 1}]: ' ) ) A__ = input("""Encryption/Decryption [e/d]: """ ...
276
1
import argparse 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_seed from accelerate imp...
276
import os import re import shutil import sys import tempfile import unittest import black A : Dict = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E402 # This is...
276
1
from abc import ABC, abstractmethod from argparse import ArgumentParser class A (SCREAMING_SNAKE_CASE ): '''simple docstring''' @staticmethod @abstractmethod def a_ ( __lowerCAmelCase : ArgumentParser ) -> List[Any]: ...
276
import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": A : List[str] = argparse.ArgumentParser( description=( '''Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned''' ...
276
1
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class A (datasets.BeamBasedBuilder ): '''simple docstring''' def a_ ( ...
276
from string import ascii_uppercase A : List[str] = {str(ord(c) - 5_5): c for c in ascii_uppercase} def __lowerCamelCase ( __a :int , __a :int ) -> str: """simple docstring""" if isinstance(__a , __a ): raise TypeE...
276
1
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTester...
276
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A : Optional[Any] = {'''configuration_vit_mae''': ['''VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMAECon...
276
1
# NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controlnet.pipeline_co...
276
import unittest import numpy as np def __lowerCamelCase ( __a :np.ndarray , __a :np.ndarray , __a :np.ndarray , __a :np.ndarray | None = None , ) -> np.ndarray: """simple docstring""" A__ = np.s...
276
1
def __lowerCamelCase ( __a :float , __a :float ) -> float: """simple docstring""" return price * (1 + tax_rate) if __name__ == "__main__": print(F'''{price_plus_tax(1_0_0, 0.25) = }''') print(F'''{price_plus_tax(125.50, 0.05) = }''') ...
276
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
276
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Dict = { '''configuration_lxmert''': ['''LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''LxmertCo...
276
import argparse import math import traceback import dateutil.parser as date_parser import requests def __lowerCamelCase ( __a :str ) -> Optional[int]: """simple docstring""" A__ = {} A__ = job["""started_at"""] A...
276
1
from sklearn.metrics import matthews_corrcoef import datasets A : List[Any] = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classifications. It takes into account tr...
276
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_configuration_common...
276
1
A : Any = '''Alexander Joslin''' import operator as op from .stack import Stack def __lowerCamelCase ( __a :str ) -> int: """simple docstring""" A__ = {"""*""": op.mul, """/""": op.truediv, """+""": op.add, """-""": op.sub} ...
276
from ...configuration_utils import PretrainedConfig from ...utils import logging A : Dict = logging.get_logger(__name__) A : Dict = { '''google/pegasus-large''': '''https://huggingface.co/google/pegasus-large/resolve/main/config.json''', # See all PEGASUS models at https://h...
276
1
from __future__ import annotations import math import numpy as np from numpy.linalg import norm def __lowerCamelCase ( __a :np.ndarray , __a :np.ndarray ) -> float: """simple docstring""" return math.sqrt(sum(pow(a - b , 2 ...
276
# 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 r...
276
1
import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import TokenizerTesterMi...
276
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, ...
276
1
import argparse import os import re import packaging.version A : Any = '''examples/''' A : List[Any] = { '''examples''': (re.compile(R'''^check_min_version\("[^"]+"\)\s*$''', re.MULTILINE), '''check_min_version("VERSION")\n'''), '''init''': (re.compile(R'''^__version__\s+=...
276
import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transforme...
276
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A : List[str] = {'''configuration_sew''': ['''SEW_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SEWConfig''']} try: if not is_torch_available(): raise OptionalDepen...
276
from typing import TYPE_CHECKING from ...utils import _LazyModule A : Optional[Any] = {'''processing_wav2vec2_with_lm''': ['''Wav2Vec2ProcessorWithLM''']} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys A : List[s...
276
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 r...
276
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, get_resize_output_image_size, normalize, rescale, resize, to_channel_dim...
276
1
from random import shuffle import tensorflow as tf from numpy import array def __lowerCamelCase ( __a :List[Any] , __a :Dict ) -> str: """simple docstring""" A__ = int(__a ) assert noofclusters < len(__a ) # F...
276
def __lowerCamelCase ( __a :float , __a :list[float] ) -> float: """simple docstring""" if discount_rate < 0: raise ValueError("""Discount rate cannot be negative""" ) if not cash_flows: raise ValueError("""Cash flows list cannot be emp...
276
1
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from .....
276
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Tuple = logging.get_logger(__name__) A : Optional[int] = { '''roberta-base''': '''https://huggin...
276
1
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor A : List[Any] = logging.get_logger(__name__) class A (SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__( self : Optional[int] ...
276
def __lowerCamelCase ( __a :int = 3 , __a :int = 7 , __a :int = 1_0_0_0_0_0_0 ) -> int: """simple docstring""" A__ = 0 A__ = 1 for current_denominator in range(1 , limit + 1 ): A__ = cu...
276
1
A : Tuple = ''' # Transformers 설치 방법 ! pip install transformers datasets # 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요. # ! pip install git+https://github.com/huggingface/transformers.git ''' A : Optional[int] = [{'''type''': '''code''', '''content''': INSTALL_CONTENT}] A : int ...
276
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __lowerCamelCase ( __a :int ) -> int: """simple docstring""" A__ = prime_factors(__a ) if is_square_free(__a ): return -1 if l...
276
1
import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class A (unittest.TestCase ): ...
276
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask ...
276
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) A : Optional[Any] = { '''configuration_blip''': [ '''BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''', ...
276
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A : Optional[Any] = logging.get_logger(__name__) A : List[str] = { '''huggingface/time-series-transformer-tourism-monthly''': ( '''https://hugging...
276
1
from maths.prime_factors import prime_factors def __lowerCamelCase ( __a :int ) -> int: """simple docstring""" if not isinstance(__a , __a ): A__ = F'Input value of [number={number}] must be an integer' raise TypeError(...
276
import math def __lowerCamelCase ( __a :int ) -> bool: """simple docstring""" A__ = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(__a ) def __lowerCamelCase ( _...
276
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, get_resize_output_image_size, normalize, rescale, resize, to_channel_dim...
276
import math def __lowerCamelCase ( ) -> None: """simple docstring""" A__ = input("""Enter message: """ ) A__ = int(input(F'Enter key [2-{len(__a ) - 1}]: ' ) ) A__ = input("""Encryption/Decryption [e/d]: """ ...
276
1
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor A : Dict = logging.get_logger(__name__) class A (SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__( self : Optional[Any] , ...
276
import os import re import shutil import sys import tempfile import unittest import black A : Dict = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E402 # This is...
276
1
from maths.prime_check import is_prime def __lowerCamelCase ( __a :int ) -> int: """simple docstring""" if not isinstance(__a , __a ): A__ = F'Input value of [number={number}] must be an integer' raise TypeError(__a )...
276
import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": A : List[str] = argparse.ArgumentParser( description=( '''Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned''' ...
276
1
import math def __lowerCamelCase ( __a :int ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all mult...
276
from string import ascii_uppercase A : List[str] = {str(ord(c) - 5_5): c for c in ascii_uppercase} def __lowerCamelCase ( __a :int , __a :int ) -> str: """simple docstring""" if isinstance(__a , __a ): raise TypeE...
276
1
def __lowerCamelCase ( __a :str ) -> list[int]: """simple docstring""" A__ = [0 for i in range(len(__a ) )] # initialize interval's left pointer and right pointer A__ , A__ = 0, 0 for i in range(1 , len(__a )...
276
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A : Optional[Any] = {'''configuration_vit_mae''': ['''VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMAECon...
276
1
import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() A : Optional[int] = logging.get_logger(__name__) def __lowerCamelCase ( __a :Dict ) ...
276
import unittest import numpy as np def __lowerCamelCase ( __a :np.ndarray , __a :np.ndarray , __a :np.ndarray , __a :np.ndarray | None = None , ) -> np.ndarray: """simple docstring""" A__ = np.s...
276
1
from ..utils import DummyObject, requires_backends class A (metaclass=SCREAMING_SNAKE_CASE ): '''simple docstring''' __lowerCamelCase : Optional[int] = ['''torch''', '''torchsde'''] def __init__( self : Dict , *__lowerCAmelC...
276
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
276
1
from collections.abc import Generator from math import sin def __lowerCamelCase ( __a :bytes ) -> bytes: """simple docstring""" if len(__a ) != 3_2: raise ValueError("""Input must be of length 32""" ) A__ = b"""""" for ...
276
import argparse import math import traceback import dateutil.parser as date_parser import requests def __lowerCamelCase ( __a :str ) -> Optional[int]: """simple docstring""" A__ = {} A__ = job["""started_at"""] A...
276
1
from ...configuration_utils import PretrainedConfig from ...utils import logging A : List[str] = logging.get_logger(__name__) A : Union[str, Any] = { '''microsoft/trocr-base-handwritten''': ( '''https://huggingface.co/microsoft/trocr-base-handwritten/resolve/main/config....
276
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_configuration_common...
276
1
import unittest from transformers import SPIECE_UNDERLINE, ReformerTokenizer, ReformerTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common imp...
276
from ...configuration_utils import PretrainedConfig from ...utils import logging A : Dict = logging.get_logger(__name__) A : Dict = { '''google/pegasus-large''': '''https://huggingface.co/google/pegasus-large/resolve/main/config.json''', # See all PEGASUS models at https://h...
276
1
import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings.warn(e) warnings.warn( ...
276
# 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 r...
276
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Optional[Any] = { '''configuration_a...
276
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, ...
276
1
import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py A : Optional[int] = '''.''' if __name__ == "__main__": A : str = os.path.join(REPO_PATH, '''utils/documentation_tests.txt''...
276
import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transforme...
276
1
import numpy as np def __lowerCamelCase ( __a :np.ndarray , __a :float ) -> np.ndarray: """simple docstring""" return np.where(vector > 0 , __a , (alpha * (np.exp(__a ) - 1)) ) if __name__ == "__main__": impor...
276
from typing import TYPE_CHECKING from ...utils import _LazyModule A : Optional[Any] = {'''processing_wav2vec2_with_lm''': ['''Wav2Vec2ProcessorWithLM''']} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys A : List[s...
276
1
def __lowerCamelCase ( __a :int , __a :int ) -> float: """simple docstring""" return base * power(__a , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('''Raise base to the power of exponent using recursion...''...
276
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, get_resize_output_image_size, normalize, rescale, resize, to_channel_dim...
276
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : Tuple = {'''configuration_opt''': ['''OPT_PRETRAINED_CONFIG_ARCHIVE_MAP'''...
276
def __lowerCamelCase ( __a :float , __a :list[float] ) -> float: """simple docstring""" if discount_rate < 0: raise ValueError("""Discount rate cannot be negative""" ) if not cash_flows: raise ValueError("""Cash flows list cannot be emp...
276
1
from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration A : List[Any] = HfArgumentParser(InitializationArguments) A : Optional[int] = parser.parse_args() # Load codeparrot tokenizer tr...
276
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Tuple = logging.get_logger(__name__) A : Optional[int] = { '''roberta-base''': '''https://huggin...
276
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available, ) A : Optional[Any] = { '''configuration_speecht5''': [ '''SPEECHT5_PRETRAINED_CONFIG_ARCHIVE_MAP''', ...
276
def __lowerCamelCase ( __a :int = 3 , __a :int = 7 , __a :int = 1_0_0_0_0_0_0 ) -> int: """simple docstring""" A__ = 0 A__ = 1 for current_denominator in range(1 , limit + 1 ): A__ = cu...
276
1
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available from .timesteps import ( fastaa_timesteps, smartaa_timesteps, smarta...
276
from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __lowerCamelCase ( __a :int ) -> int: """simple docstring""" A__ = prime_factors(__a ) if is_square_free(__a ): return -1 if l...
276
1
import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokenization_co...
276
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask ...
276
1
import pytest from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs @pytest.mark.parametrize( """kwargs, expected""" , [ ({"""num_shards""": 0, """max_num_jobs""": 1}, []), ({"""num_shards""": 1_0, """max_num...
276
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A : Optional[Any] = logging.get_logger(__name__) A : List[str] = { '''huggingface/time-series-transformer-tourism-monthly''': ( '''https://hugging...
276
1
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_i...
276
import math def __lowerCamelCase ( __a :int ) -> bool: """simple docstring""" A__ = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(__a ) def __lowerCamelCase ( _...
276
1
import argparse import gc import json import os 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 acceler...
276
import math def __lowerCamelCase ( ) -> None: """simple docstring""" A__ = input("""Enter message: """ ) A__ = int(input(F'Enter key [2-{len(__a ) - 1}]: ' ) ) A__ = input("""Encryption/Decryption [e/d]: """ ...
276
1
import logging import os from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union from filelock import FileLock from transformers import PreTrainedTokenizer, is_tf_available, is_torch_available A : List[Any] = logging.getLogger(__name__) @da...
276
import os import re import shutil import sys import tempfile import unittest import black A : Dict = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E402 # This is...
276
1