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 json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __snake_case : Optional[Any] =logging.get_logger(__name__) __snake_case : Optional[Any] ={'vocab_file': 'vocab.json'} __snake_case : Optional[int] ={ 'v...
94
import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase__ ( lowerCamelCase_ : ndarray): '''simple docstring''' return np.dot(lowerCamelCase_ ,lowerCamelCase_) class lowerCamelCase__ : '''simple docstri...
94
1
from __future__ import annotations def lowerCAmelCase__ ( lowerCamelCase_ : float ,lowerCamelCase_ : float ,lowerCamelCase_ : float ,): '''simple docstring''' if (electron_conc, hole_conc, intrinsic_conc).count(0) != 1: raise ValueError('''You cannot supply more or less tha...
94
import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int] ,lowerCamelCase_ : List[Any]=1024 ,lowerCamelCase_ : in...
94
1
from __future__ import annotations __snake_case : Optional[Any] =tuple[int, int, int] __snake_case : str =tuple[str, str, str] # used alphabet -------------------------- # from string.ascii_uppercase __snake_case : List[Any] ='ABCDEFGHIJKLMNOPQRSTUVWXYZ' # -------------------------- default selec...
94
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Dataset from tra...
94
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __snake_case : Optional[int] ={ 'configuration_squeezebert': [ 'SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SqueezeBertConfig', 'Squeeze...
94
import string import numpy def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : int): '''simple docstring''' return b if a == 0 else greatest_common_divisor(b % a ,lowerCamelCase_) class lowerCamelCase__ : '''simple docstring''' snake_case_ =string...
94
1
import os from typing import Dict, List, Tuple, TypeVar, Union __snake_case : Union[str, Any] =TypeVar('T') __snake_case : Tuple =Union[List[T], Tuple[T, ...]] __snake_case : Union[str, Any] =Union[T, List[T], Dict[str, T]] __snake_case : Tuple =Union[str, bytes, os.PathLike]
94
__snake_case : Any ='\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' __snake_case : Tuple =[{'type':...
94
1
def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : int): '''simple docstring''' return int((input_a, input_a).count(1) != 0) def lowerCAmelCase__ ( ): '''simple docstring''' assert or_gate(0 ,0) == 0 assert or_gate(0 ,1) == 1 assert or_gate(...
94
import unittest import numpy as np from transformers.testing_utils import is_flaky, 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(): ...
94
1
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ =(DDPMParallelScheduler,) def lowerCAmelCase__ (self ,**__lowerCamelCase ) -> ...
94
import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPriorPipeline, PriorTransform...
94
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, PILImageResamp...
94
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1000): '''simple docstring''' lowerCAmelCase__ , lowerCAmelCase__ : int = 1, 1 lowerCAmelCase__ : Any = 2 while True: lowerCAmelCase__ : Optional[Any] = 0 ...
94
1
import math from collections.abc import Iterator from itertools import takewhile def lowerCAmelCase__ ( lowerCamelCase_ : int): '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: ...
94
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __snake_case : Any ={ 'configuration_blenderbot_small': [ 'BLENDERBOT_SMALL_PRETRAINED_C...
94
1
from maths.prime_factors import prime_factors def lowerCAmelCase__ ( lowerCamelCase_ : int): '''simple docstring''' if not isinstance(lowerCamelCase_ ,lowerCamelCase_): lowerCAmelCase__ : Dict = f"""Input value of [number={number}] must be an integer""" ...
94
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTest...
94
1
import numpy as np from scipy.spatial.distance import cdist from sklearn.metrics import fa_score import datasets __snake_case : Tuple ='\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchmarks and Pre-trained Multilingual Language Models for Indi...
94
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ViltForMaskedLM, ViltF...
94
1
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_...
94
def lowerCAmelCase__ ( lowerCamelCase_ : str = "The quick brown fox jumps over the lazy dog" ,): '''simple docstring''' lowerCAmelCase__ : Any = set() # Replace all the whitespace in our sentence lowerCAmelCase__ : List[Any] = input_str.re...
94
1
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def lowerCAmelCase__ ( ): '''simple docstring''' print('''Making key files...''') make_key_files('''rsa''' ,1024) print('''Key f...
94
def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : int): '''simple docstring''' while b: lowerCAmelCase__ , lowerCAmelCase__ : Optional[Any] = b, a % b return a def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase...
94
1
from jiwer import compute_measures import datasets __snake_case : Any ='\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From WER and RIL to MER and WIL: improved evaluation measures for...
94
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1000000): '''simple docstring''' lowerCAmelCase__ : int = set(range(3 ,lowerCamelCase_ ,2)) primes.add(2) for p in range(3 ,lowerCamelCase_ ,2): if p not in primes: continue primes.differ...
94
1
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ ="""ClapFeatureExtractor""" snake_case_ =("""RobertaTokenizer""", """RobertaTokenizerFast""") de...
94
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : Any =logging.get_logger(__name__) __snake_case : Tuple ={ 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at https://huggi...
94
1
import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast 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 import TokenizerTesterMixin __snake...
94
from math import factorial def lowerCAmelCase__ ( lowerCamelCase_ : int = 100): '''simple docstring''' return sum(map(lowerCamelCase_ ,str(factorial(lowerCamelCase_)))) if __name__ == "__main__": print(solution(int(input('Enter the Number: ').strip())))
94
1
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin __snake_case : Dict ='\nHugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot app targeted at teenagers.[2...
94
import random import unittest import torch from diffusers import IFInpaintingSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( TEXT_G...
94
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : List[str] =logging.get_logger(__name__) __snake_case : Union[str, Any] ={ 'microsoft/markuplm-base': 'https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json', 'microsoft/markuplm-lar...
94
import flax.linen as nn import jax import jax.numpy as jnp class lowerCamelCase__ ( nn.Module): '''simple docstring''' snake_case_ =42 snake_case_ =jnp.floataa def lowerCAmelCase__ (self ) -> List[str]: """simple docstring""" lowerCAmelCase...
94
1
from timeit import timeit def lowerCAmelCase__ ( lowerCamelCase_ : int): '''simple docstring''' if number < 0: raise ValueError('''the value of input must not be negative''') lowerCAmelCase__ : Any = 0 while number: number &= number - 1 ...
94
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __snake_case : Optional[int] ={ 'configuration_vision_text_dual_encoder': ['VisionTextDualEncoderConfig'], 'processing_vi...
94
1
import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput def lowerCAmelCase__...
94
from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration __snake_case : Dict =HfArgumentParser(InitializationArguments) __snake_case : Tuple =parser.parse_args() # Load codeparrot tokenizer trained for Pyth...
94
1
from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerate_available, is_accele...
94
def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : str): '''simple docstring''' lowerCAmelCase__ : Optional[Any] = len(lowerCamelCase_) lowerCAmelCase__ : str = len(lowerCamelCase_) lowerCAmelCase__ : Union[str, Any] ...
94
1
import math class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase=0 ) -> Optional[Any]: # a graph with Node 0,1,...,N-1 """simple docstring""" lowerCAmelCase__ : int = n lowerCAmelCase__ : List[str] ...
94
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __snake_case : str ={ 'configuration_conditional_detr': [ 'CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ConditionalDetrConfig', 'Conditi...
94
1
import warnings from .generation import TFGenerationMixin class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' warnings.warn( """Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will """ """be removed in Transformers ...
94
import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase__ ( lowerCamelCase_ : ndarray): '''simple docstring''' return np.dot(lowerCamelCase_ ,lowerCamelCase_) class lowerCamelCase__ : '''simple docstri...
94
1
from __future__ import annotations def lowerCAmelCase__ ( lowerCamelCase_ : dict ,lowerCamelCase_ : str): '''simple docstring''' lowerCAmelCase__ , lowerCAmelCase__ : Optional[Any] = set(lowerCamelCase_), [start] while stack: lowerCAmelCase__ ...
94
import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int] ,lowerCamelCase_ : List[Any]=1024 ,lowerCamelCase_ : in...
94
1
import os from distutils.util import strtobool def lowerCAmelCase__ ( lowerCamelCase_ : Tuple ,lowerCamelCase_ : List[str]): '''simple docstring''' for e in env_keys: lowerCAmelCase__ : str = int(os.environ.get(lowerCamelCase_ ,-1)) if val >= 0: ...
94
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Dataset from tra...
94
1
def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : bool = False): '''simple docstring''' if not isinstance(lowerCamelCase_ ,lowerCamelCase_): lowerCAmelCase__ : int = f"""Expected string as input, found {type(lowerCamelCase_)}""" raise Val...
94
import string import numpy def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : int): '''simple docstring''' return b if a == 0 else greatest_common_divisor(b % a ,lowerCamelCase_) class lowerCamelCase__ : '''simple docstring''' snake_case_ =string...
94
1
import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow __snake_case : Union[str, Any] =logging.getLogger() @unittest.skip("""Temporarily disable the doc test...
94
__snake_case : Any ='\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' __snake_case : Tuple =[{'type':...
94
1
from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration __snake_case : Dict =HfArgumentParser(InitializationArguments) __snake_case : Tuple =parser.parse_args() # Load codeparrot tokenizer trained for Pyth...
94
import unittest import numpy as np from transformers.testing_utils import is_flaky, 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(): ...
94
1
import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteS...
94
import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPriorPipeline, PriorTransform...
94
1
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTest...
94
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1000): '''simple docstring''' lowerCAmelCase__ , lowerCAmelCase__ : int = 1, 1 lowerCAmelCase__ : Any = 2 while True: lowerCAmelCase__ : Optional[Any] = 0 ...
94
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 __snake_case : str =datasets.utils.logging.get_logger(__name__) @dataclass class lowerCamelCase__ ( dat...
94
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __snake_case : Any ={ 'configuration_blenderbot_small': [ 'BLENDERBOT_SMALL_PRETRAINED_C...
94
1
import argparse import logging import os import sys import numpy as np import onnxruntime import torch from bart_onnx.generation_onnx import BARTBeamSearchGenerator from bart_onnx.reduce_onnx_size import remove_dup_initializers import transformers from transformers import BartForConditionalGeneration, BartTokeniz...
94
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTest...
94
1
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ ="""Speech2TextFeatureExtractor""" snake_case_ ="""Speech2TextTokenizer""" def __init__(self ...
94
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ViltForMaskedLM, ViltF...
94
1
import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase ,__lowerCamelCase ,__lowerCamelCase ) -> Dict: """simple docstring""" if dst_width < 0 or dst_height ...
94
def lowerCAmelCase__ ( lowerCamelCase_ : str = "The quick brown fox jumps over the lazy dog" ,): '''simple docstring''' lowerCAmelCase__ : Any = set() # Replace all the whitespace in our sentence lowerCAmelCase__ : List[Any] = input_str.re...
94
1
from datasets.utils.patching import _PatchedModuleObj, patch_submodule from . import _test_patching def lowerCAmelCase__ ( ): '''simple docstring''' import os as original_os from os import path as original_path from os import rename as original_rename from os.path import dir...
94
def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : int): '''simple docstring''' while b: lowerCAmelCase__ , lowerCAmelCase__ : Optional[Any] = b, a % b return a def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase...
94
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __snake...
94
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1000000): '''simple docstring''' lowerCAmelCase__ : int = set(range(3 ,lowerCamelCase_ ,2)) primes.add(2) for p in range(3 ,lowerCamelCase_ ,2): if p not in primes: continue primes.differ...
94
1
import baseaa def lowerCAmelCase__ ( lowerCamelCase_ : str): '''simple docstring''' return baseaa.baaencode(string.encode('''utf-8''')) def lowerCAmelCase__ ( lowerCamelCase_ : bytes): '''simple docstring''' return baseaa.baadecode(lowerCamelCase_).decode(...
94
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : Any =logging.get_logger(__name__) __snake_case : Tuple ={ 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at https://huggi...
94
1
from typing import List, Optional, Union import numpy as np from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging __snake_case : Union[str, Any] =logging.get_logger(__name__) ...
94
from math import factorial def lowerCAmelCase__ ( lowerCamelCase_ : int = 100): '''simple docstring''' return sum(map(lowerCamelCase_ ,str(factorial(lowerCamelCase_)))) if __name__ == "__main__": print(solution(int(input('Enter the Number: ').strip())))
94
1
def lowerCAmelCase__ ( lowerCamelCase_ : list): '''simple docstring''' lowerCAmelCase__ : Optional[int] = len(lowerCamelCase_) for i in range(1 ,lowerCamelCase_): lowerCAmelCase__ : int = collection[i] lowerCAmelCase__ : ...
94
import random import unittest import torch from diffusers import IFInpaintingSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( TEXT_G...
94
1
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class lowerCamelCase__ ( unittest.TestCase): '''simpl...
94
import flax.linen as nn import jax import jax.numpy as jnp class lowerCamelCase__ ( nn.Module): '''simple docstring''' snake_case_ =42 snake_case_ =jnp.floataa def lowerCAmelCase__ (self ) -> List[str]: """simple docstring""" lowerCAmelCase...
94
1
from __future__ import annotations def lowerCAmelCase__ ( lowerCamelCase_ : list[int]): '''simple docstring''' lowerCAmelCase__ : List[str] = len(lowerCamelCase_) // 2 # choose the middle 3 elements lowerCAmelCase__ : Dict = lst[m - ...
94
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __snake_case : Optional[int] ={ 'configuration_vision_text_dual_encoder': ['VisionTextDualEncoderConfig'], 'processing_vi...
94
1
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, Wav...
94
from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration __snake_case : Dict =HfArgumentParser(InitializationArguments) __snake_case : Tuple =parser.parse_args() # Load codeparrot tokenizer trained for Pyth...
94
1
from __future__ import annotations import collections import pprint from pathlib import Path def lowerCAmelCase__ ( lowerCamelCase_ : str): '''simple docstring''' return "".join(sorted(lowerCamelCase_)) def lowerCAmelCase__ ( lowerCamelCase_ : str): '''simple ...
94
def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : str): '''simple docstring''' lowerCAmelCase__ : Optional[Any] = len(lowerCamelCase_) lowerCAmelCase__ : str = len(lowerCamelCase_) lowerCAmelCase__ : Union[str, Any] ...
94
1
def lowerCAmelCase__ ( lowerCamelCase_ : Optional[Any] ,lowerCamelCase_ : Union[str, Any]): '''simple docstring''' lowerCAmelCase__ : Any = 0 while b > 0: if b & 1: res += a a += a b >>= 1 return res def lowerCA...
94
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __snake_case : str ={ 'configuration_conditional_detr': [ 'CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ConditionalDetrConfig', 'Conditi...
94
1
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo __snake_case : Any ='\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui Wu and ...
94
import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase__ ( lowerCamelCase_ : ndarray): '''simple docstring''' return np.dot(lowerCamelCase_ ,lowerCamelCase_) class lowerCamelCase__ : '''simple docstri...
94
1
from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass __snake_case : Dict =(3, 9, -1_1, 0, 7, 5, 1, -1) __snake_case : Optional[int] =(4, 6, 2, 0, 8, 1_0, 3, -2) @dataclass class lowerCamelCase__ : '''simple docstring''' s...
94
import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int] ,lowerCamelCase_ : List[Any]=1024 ,lowerCamelCase_ : in...
94
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : Any =logging.get_logger(__name__) __snake_case : Tuple ={ 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at https://huggi...
94
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Dataset from tra...
94
1
import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_available, is_tf_available, logging from .benchm...
94
import string import numpy def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : int): '''simple docstring''' return b if a == 0 else greatest_common_divisor(b % a ,lowerCamelCase_) class lowerCamelCase__ : '''simple docstring''' snake_case_ =string...
94
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __snake_case : List[str] ={ 'configuration_x_clip': [ 'XCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XCLIPConfig', 'XCLIPTextConfig', 'XCLIPVisionConfig', ],...
94
__snake_case : Any ='\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' __snake_case : Tuple =[{'type':...
94
1
import io import json import unittest from parameterized import parameterized from transformers import FSMTForConditionalGeneration, FSMTTokenizer from transformers.testing_utils import get_tests_dir, require_torch, slow, torch_device from utils import calculate_bleu __snake_case : Union[str, Any] =get_tes...
94
import unittest import numpy as np from transformers.testing_utils import is_flaky, 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(): ...
94
1
from pathlib import PurePosixPath from typing import Optional import fsspec from fsspec import AbstractFileSystem from huggingface_hub.hf_api import DatasetInfo from ..utils.file_utils import get_authentication_headers_for_url from ..utils.hub import hf_hub_url class lowerCamelCase__ ( lowerCamelCa...
94
import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPriorPipeline, PriorTransform...
94
1
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __snake_case : Union[str, Any] ={ 'configuration_mctct': ['MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MCTCTConfig'], 'feature_extraction_mctct': ['MCTCTFeatureExtractor'], 'processi...
94
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1000): '''simple docstring''' lowerCAmelCase__ , lowerCAmelCase__ : int = 1, 1 lowerCAmelCase__ : Any = 2 while True: lowerCAmelCase__ : Optional[Any] = 0 ...
94
1
def lowerCAmelCase__ ( ): '''simple docstring''' for n in range(1 ,1000000): yield n * (n + 1) // 2 def lowerCAmelCase__ ( lowerCamelCase_ : int): '''simple docstring''' lowerCAmelCase__ : Union[str, Any] = 1 lowerCAmelCase__ ...
94
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __snake_case : Any ={ 'configuration_blenderbot_small': [ 'BLENDERBOT_SMALL_PRETRAINED_C...
94
1
from __future__ import annotations def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : list[str] | None = None ,lowerCamelCase_ : dict[str, float] | None = None ,lowerCamelCase_ : bool = False ,): '''simple docstring''' lowerCAmelCase__ : str = c...
94
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTest...
94
1
from __future__ import annotations __snake_case : Optional[int] =[-1_0, -5, 0, 5, 5.1, 1_1, 1_3, 2_1, 3, 4, -2_1, -1_0, -5, -1, 0] __snake_case : Tuple =[-5, 0, 5, 5.1, 1_1, 1_3, 2_1, -1, 4, -1, -1_0, -5, -1, 0, -1] def lowerCAmelCase__ ( lowerCamelCase_ : list[float]): '''simple...
94
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ViltForMaskedLM, ViltF...
94
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available __snake_case : List[Any] ={'configuration_speech_encoder_decoder': ['SpeechEncoderDecoderConfig']} try: if not is_torch_available(): raise OptionalDe...
94
def lowerCAmelCase__ ( lowerCamelCase_ : str = "The quick brown fox jumps over the lazy dog" ,): '''simple docstring''' lowerCAmelCase__ : Any = set() # Replace all the whitespace in our sentence lowerCAmelCase__ : List[Any] = input_str.re...
94
1
def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : int): '''simple docstring''' if not isinstance(lowerCamelCase_ ,lowerCamelCase_): raise ValueError('''iterations must be defined as integers''') if not isinstance(lowerCamelCase_ ,lowerCamelCase_) or not number >= ...
94
def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : int): '''simple docstring''' while b: lowerCAmelCase__ , lowerCAmelCase__ : Optional[Any] = b, a % b return a def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase...
94
1
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.u...
94
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1000000): '''simple docstring''' lowerCAmelCase__ : int = set(range(3 ,lowerCamelCase_ ,2)) primes.add(2) for p in range(3 ,lowerCamelCase_ ,2): if p not in primes: continue primes.differ...
94
1
import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(lowerCamelCase__) , """Tatoeba di...
94
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : Any =logging.get_logger(__name__) __snake_case : Tuple ={ 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at https://huggi...
94
1
from __future__ import annotations from random import random class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase = None ) -> List[str]: """simple docstring""" lowerCAmelCase__ : List[str] = value lowerCAm...
94
from math import factorial def lowerCAmelCase__ ( lowerCamelCase_ : int = 100): '''simple docstring''' return sum(map(lowerCamelCase_ ,str(factorial(lowerCamelCase_)))) if __name__ == "__main__": print(solution(int(input('Enter the Number: ').strip())))
94
1
import argparse import json from typing import List from ltp import LTP from transformers.models.bert.tokenization_bert import BertTokenizer def lowerCAmelCase__ ( lowerCamelCase_ : Any): '''simple docstring''' if ( (cp >= 0X4E00 and cp <= 0X9FFF) or (cp >= 0X3400 and...
94
import random import unittest import torch from diffusers import IFInpaintingSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( TEXT_G...
94
1
import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING from ...tokenization_uti...
94
import flax.linen as nn import jax import jax.numpy as jnp class lowerCamelCase__ ( nn.Module): '''simple docstring''' snake_case_ =42 snake_case_ =jnp.floataa def lowerCAmelCase__ (self ) -> List[str]: """simple docstring""" lowerCAmelCase...
94
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : int =logging.get_logger(__name__) __snake_case : Tuple ={ 'abeja/gpt-neox-japanese-2.7b': 'https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/main/config.json', } class lowerCamelCase__ ...
94
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __snake_case : Optional[int] ={ 'configuration_vision_text_dual_encoder': ['VisionTextDualEncoderConfig'], 'processing_vi...
94
1
import random from typing import Any def lowerCAmelCase__ ( lowerCamelCase_ : list): '''simple docstring''' for _ in range(len(lowerCamelCase_)): lowerCAmelCase__ : Optional[Any] = random.randint(0 ,len(lowerCamelCase_) - 1) lowerCAmelCase__ : ...
94
from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration __snake_case : Dict =HfArgumentParser(InitializationArguments) __snake_case : Tuple =parser.parse_args() # Load codeparrot tokenizer trained for Pyth...
94
1
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before toke...
94
def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : str): '''simple docstring''' lowerCAmelCase__ : Optional[Any] = len(lowerCamelCase_) lowerCAmelCase__ : str = len(lowerCamelCase_) lowerCAmelCase__ : Union[str, Any] ...
94
1
from __future__ import annotations from math import pow, sqrt def lowerCAmelCase__ ( lowerCamelCase_ : float ,lowerCamelCase_ : float ,lowerCamelCase_ : float): '''simple docstring''' if (resistance, reactance, impedance).count(0) != 1: raise ValueError('''One and only one...
94
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __snake_case : str ={ 'configuration_conditional_detr': [ 'CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ConditionalDetrConfig', 'Conditi...
94
1
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_toke...
94
import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase__ ( lowerCamelCase_ : ndarray): '''simple docstring''' return np.dot(lowerCamelCase_ ,lowerCamelCase_) class lowerCamelCase__ : '''simple docstri...
94
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __snake_case : int ={'configuration_opt': ['OPT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'OPTConfig']} try: ...
94
import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int] ,lowerCamelCase_ : List[Any]=1024 ,lowerCamelCase_ : in...
94
1
import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_torchaudio_available from ...test_confi...
94
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Dataset from tra...
94
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 ...
94
import string import numpy def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : int): '''simple docstring''' return b if a == 0 else greatest_common_divisor(b % a ,lowerCamelCase_) class lowerCamelCase__ : '''simple docstring''' snake_case_ =string...
94
1
def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : int): '''simple docstring''' while b: lowerCAmelCase__ , lowerCAmelCase__ : Optional[Any] = b, a % b return a def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase...
94
__snake_case : Any ='\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' __snake_case : Tuple =[{'type':...
94
1
__snake_case : Union[str, Any] ='Input must be a string of 8 numbers plus letter' __snake_case : int ='TRWAGMYFPDXBNJZSQVHLCKE' def lowerCAmelCase__ ( lowerCamelCase_ : str): '''simple docstring''' if not isinstance(lowerCamelCase_ ,lowerCamelCase_): lowerCAmelCase__ ...
94
import unittest import numpy as np from transformers.testing_utils import is_flaky, 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(): ...
94
1
from manim import * class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' def lowerCAmelCase__ (self ) -> int: """simple docstring""" lowerCAmelCase__ : Any = Rectangle(height=0.5 ,width=0.5 ) lowerCAmelCase__ ...
94
import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPriorPipeline, PriorTransform...
94
1
def lowerCAmelCase__ ( lowerCamelCase_ : list): '''simple docstring''' if len(lowerCamelCase_) <= 1: return [tuple(lowerCamelCase_)] lowerCAmelCase__ : List[str] = [] def generate(lowerCamelCase_ : int ,lowerCamelCase_ : list): lowerCAmelCa...
94
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1000): '''simple docstring''' lowerCAmelCase__ , lowerCAmelCase__ : int = 1, 1 lowerCAmelCase__ : Any = 2 while True: lowerCAmelCase__ : Optional[Any] = 0 ...
94
1
import sys __snake_case : Optional[int] =( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '6689664895044524452316173185640309...
94
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __snake_case : Any ={ 'configuration_blenderbot_small': [ 'BLENDERBOT_SMALL_PRETRAINED_C...
94
1
import gc import unittest import torch from parameterized import parameterized from diffusers import AutoencoderKL from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.te...
94
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTest...
94
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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, ...
94
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ViltForMaskedLM, ViltF...
94
1
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class lowerCamelCase__ ( lowerCamelCase__): '''simple ...
94
def lowerCAmelCase__ ( lowerCamelCase_ : str = "The quick brown fox jumps over the lazy dog" ,): '''simple docstring''' lowerCAmelCase__ : Any = set() # Replace all the whitespace in our sentence lowerCAmelCase__ : List[Any] = input_str.re...
94
1
from ..utils import DummyObject, requires_backends class lowerCamelCase__ ( metaclass=SCREAMING_SNAKE_CASE_): '''simple docstring''' snake_case_ =["""torch"""] def __init__(self ,*__lowerCamelCase ,**__lowerCamelCase ) -> Optional[Any]: """simple docstring""" ...
350
def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : int): '''simple docstring''' while b: lowerCAmelCase__ , lowerCAmelCase__ : Optional[Any] = b, a % b return a def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase...
94
0
from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_commo...
351
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1000000): '''simple docstring''' lowerCAmelCase__ : int = set(range(3 ,lowerCamelCase_ ,2)) primes.add(2) for p in range(3 ,lowerCamelCase_ ,2): if p not in primes: continue primes.differ...
94
0
from ..models.auto import AutoModelForSeqaSeqLM, AutoTokenizer from .base import PipelineTool class lowerCamelCase__ ( _UpperCAmelCase): '''simple docstring''' snake_case_ ="philschmid/bart-large-cnn-samsum" snake_case_ =( "This is a tool that summarizes an English text. It...
352
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : Any =logging.get_logger(__name__) __snake_case : Tuple ={ 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at https://huggi...
94
0
from copy import deepcopy class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase = None ,__lowerCamelCase = None ) -> None: """simple docstring""" if arr is None and size is not None: lowerCAmelCase__ : Optional[int] ...
353
from math import factorial def lowerCAmelCase__ ( lowerCamelCase_ : int = 100): '''simple docstring''' return sum(map(lowerCamelCase_ ,str(factorial(lowerCamelCase_)))) if __name__ == "__main__": print(solution(int(input('Enter the Number: ').strip())))
94
0
from __future__ import annotations class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase ) -> Union[str, Any]: """simple docstring""" lowerCAmelCase__ : Union[str, Any] = order # a_{0} ... a_{k} lower...
354
import random import unittest import torch from diffusers import IFInpaintingSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( TEXT_G...
94
0
"""simple docstring""" 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 __snake_case : List[Any] ='.' if __name__ == "__main__": __snake_case : Dict =os.path.join(REPO_PATH, 'utils/docume...
355
import flax.linen as nn import jax import jax.numpy as jnp class lowerCamelCase__ ( nn.Module): '''simple docstring''' snake_case_ =42 snake_case_ =jnp.floataa def lowerCAmelCase__ (self ) -> List[str]: """simple docstring""" lowerCAmelCase...
94
0
import unittest import numpy as np from transformers import BertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from transformers.mo...
356
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __snake_case : Optional[int] ={ 'configuration_vision_text_dual_encoder': ['VisionTextDualEncoderConfig'], 'processing_vi...
94
0
from __future__ import annotations def lowerCAmelCase__ ( lowerCamelCase_ : list[list[int]]): '''simple docstring''' lowerCAmelCase__ : int = len(__A) # We need to create solution object to save path. lowerCAmelCase__ : Any = [[0 for ...
357
from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration __snake_case : Dict =HfArgumentParser(InitializationArguments) __snake_case : Tuple =parser.parse_args() # Load codeparrot tokenizer trained for Pyth...
94
0
import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : List[Any]=7): '''simple docstring''' lowerCAmelCase__ : Dict = None if token...
358
def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : str): '''simple docstring''' lowerCAmelCase__ : Optional[Any] = len(lowerCamelCase_) lowerCAmelCase__ : str = len(lowerCamelCase_) lowerCAmelCase__ : Union[str, Any] ...
94
0
"""simple docstring""" from ..utils import DummyObject, requires_backends class lowerCamelCase__ ( metaclass=__A): '''simple docstring''' snake_case_ =['keras_nlp'] def __init__(self ,*__lowerCamelCase ,**__lowerCamelCase ) -> Any: """simple docstring""" ...
359
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __snake_case : str ={ 'configuration_conditional_detr': [ 'CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ConditionalDetrConfig', 'Conditi...
94
0
from __future__ import annotations from collections.abc import Iterator class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase ) -> None: """simple docstring""" lowerCAmelCase__ : Optional[Any] = value lower...
360
import numpy as np from numpy import ndarray from scipy.optimize import Bounds, LinearConstraint, minimize def lowerCAmelCase__ ( lowerCamelCase_ : ndarray): '''simple docstring''' return np.dot(lowerCamelCase_ ,lowerCamelCase_) class lowerCamelCase__ : '''simple docstri...
94
0
import argparse import os import re __snake_case ='src/transformers' # Pattern that looks at the indentation in a line. __snake_case =re.compile(R'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. __snake_case =re.compile(R'^\s*\"([^\"]+)\":') # Pattern that matches `_import_structure["key...
361
import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def lowerCAmelCase__ ( lowerCamelCase_ : Dict ,lowerCamelCase_ : Optional[int] ,lowerCamelCase_ : List[Any]=1024 ,lowerCamelCase_ : in...
94
0
import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.version import Version __snake_case : i...
362
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Dataset from tra...
94
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __snake_case : Any ={'configuration_swin': ['SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SwinConfig', 'SwinOnnxConfig']} try: if not is_torch_available(): r...
363
import string import numpy def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : int): '''simple docstring''' return b if a == 0 else greatest_common_divisor(b % a ,lowerCamelCase_) class lowerCamelCase__ : '''simple docstring''' snake_case_ =string...
94
0
__snake_case : List[Any] ='\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' __snake_case : List[str] ...
364
__snake_case : Any ='\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' __snake_case : Tuple =[{'type':...
94
0
def lowerCAmelCase__ ( lowerCamelCase_ : list[int] ,lowerCamelCase_ : int): '''simple docstring''' lowerCAmelCase__ : List[str] = len(__a) lowerCAmelCase__ : Optional[int] = [[False] * (required_sum + 1) for _ in range(arr_len + 1)] # fo...
365
import unittest import numpy as np from transformers.testing_utils import is_flaky, 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(): ...
94
0
def lowerCAmelCase__ ( lowerCamelCase_ : int ,lowerCamelCase_ : int): '''simple docstring''' return "\n".join( f"""{number} * {i} = {number * i}""" for i in range(1 ,number_of_terms + 1)) if __name__ == "__main__": print(multiplication_table(number=5, numb...
366
import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPriorPipeline, PriorTransform...
94
0
def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : str): '''simple docstring''' def get_matched_characters(lowerCamelCase_ : str ,lowerCamelCase_ : str) -> str: lowerCAmelCase__ : List[Any] = [] lowerCAmelCase__ : List[str] ...
367
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1000): '''simple docstring''' lowerCAmelCase__ , lowerCAmelCase__ : int = 1, 1 lowerCAmelCase__ : Any = 2 while True: lowerCAmelCase__ : Optional[Any] = 0 ...
94
0
import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class lowerCamelCase__ ( unittest.TestCase): '''simple docstring''' snake_case...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __snake_case : Any ={ 'configuration_blenderbot_small': [ 'BLENDERBOT_SMALL_PRETRAINED_C...
94
0
def lowerCAmelCase__ ( lowerCamelCase_ : Optional[int] ,lowerCamelCase_ : Union[str, Any]): '''simple docstring''' return int((input_a, input_a).count(0) == 0) def lowerCAmelCase__ ( ): '''simple docstring''' assert and_gate(0 ,0) == 0 assert and_gate(0 ,1) ...
369
import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTest...
94
0
"""simple docstring""" 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 r...
370
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ViltForMaskedLM, ViltF...
94
0
from ..models.whisper import WhisperForConditionalGeneration, WhisperProcessor from .base import PipelineTool class lowerCamelCase__ ( _UpperCAmelCase): '''simple docstring''' snake_case_ ="""openai/whisper-base""" snake_case_ =( """This is a tool that transcribes an audio ...
371
def lowerCAmelCase__ ( lowerCamelCase_ : str = "The quick brown fox jumps over the lazy dog" ,): '''simple docstring''' lowerCAmelCase__ : Any = set() # Replace all the whitespace in our sentence lowerCAmelCase__ : List[Any] = input_str.re...
94
0