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 torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def lowerCAmelCase__ ( lowerCamelCase_ : Optional[int] ,lowerCamelCase_ : Union[str, Any]=1): '''simple docstring''' if n_shave_prefix_segments >=...
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
# Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def lowerCAmelCase__ ( lowerCamelCase_ : Optional[Any] ,lowerCamelCase_ : Any ,lowerCamelCase_ : Tuple ,lowerCamelCase_ : List[Any]): '''simple docstring''' lowerCAmelCase__ : Dict = ...
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
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...
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
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: ...
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
from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelerate.test_ut...
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
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ =(DDPMParallelScheduler,) def lowerCAmelCase__ (self ,**__lowerCamelCase ) -> ...
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 unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class lowerCamelCase__ ( unittest.TestCas...
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
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...
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""" 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', 'ConditionalDe...
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
import math from datetime import datetime, timedelta def lowerCAmelCase__ ( lowerCamelCase_ : int): '''simple docstring''' lowerCAmelCase__ : Any = year % 19 lowerCAmelCase__ : List[str] = year % 4 lowerCAmelCase__ : int ...
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
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_...
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 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...
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 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, ...
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
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...
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
__snake_case : Dict ='Tobias Carryer' from time import time class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase ,__lowerCamelCase ,__lowerCamelCase ,__lowerCamelCase=int(time() ) ) -> List[Any]: # noqa: B008 """simple docstring""" ...
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 warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF...
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 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...
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
import json import logging import os import socket import git import numpy as np import torch logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO, ) __snake_case : str =logging.getLogger(__name__)...
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 re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' def lowerCAmelCase__ (self ,__lowerCamelCase ) -> int: """simple docstring""" with...
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 argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import...
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
import warnings from ...utils import logging from .image_processing_segformer import SegformerImageProcessor __snake_case : Tuple =logging.get_logger(__name__) class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' def __init__(self ,*__lowerCamelCase ,**__lowerCamelC...
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 gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device from diffusers.utils.te...
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 tempfile import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from torch import nn from transformers import ( Adafactor, AdamW, ...
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_tokenizers_available, is_torch_available __snake_case : Optional[int] ={ 'configuration_squeezebert': [ 'SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SqueezeBertConfig', 'Squeeze...
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
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...
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
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: ...
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
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch ...
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
from __future__ import annotations import time import numpy as np __snake_case : Optional[int] =[8, 5, 9, 7] __snake_case : Optional[Any] =[ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] __snake_case : int =[ [3, 2, 1, 4], [0, 2, 5, 2], [5,...
367
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1000): '''simple docstring''' lowerCAmelCase__ , lowerCAmelCase__ : int = 1, 1 lowerCAmelCase__ : Any = 2 while True: lowerCAmelCase__ : Optional[Any] = 0 ...
94
0
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, ) if is_sentencepiece_available(): from ..ta.tokenization_ta import TaToke...
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
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __snake_case : Optional[int] ={ 'configuration_upernet': ['UperNetConfig'], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except Option...
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""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) __snake_case : Optional[Any] ={ 'configuration_deberta': ['DEBERTA_PRETRAINED_CONFIG_ARCHIVE...
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 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__) ...
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
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 ...
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 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 ...
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
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 I...
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
import mpmath # for roots of unity import numpy as np class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase=None ,__lowerCamelCase=None ) -> Optional[int]: """simple docstring""" lowerCAmelCase__ : Optional[Any] = ...
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 typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __snake_case : Tuple ={ 'configuration_bridgetower': [ 'BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BridgeTowerConfig', 'BridgeTowerTextConf...
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""" from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : List[Any] =logging.get_logger(__name__) __snake_case : int ={ 'google/vivit-b-16x2-kinetics400': ( 'https://huggingface.co/google/vivit-b-16x2-kinetics400/resolve/main/...
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 os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig __snake_case : Tuple =logging.get_logger(__name__) class lowerCamelCase__ : '''simple docstring''' def __...
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[int]): '''simple docstring''' lowerCAmelCase__ : List[str] = len(lowerCamelCase_) // 2 # choose the middle 3 elements lowerCAmelCase__ : Dict = lst[m - ...
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 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...
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""" import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_v...
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
import sys __snake_case : Optional[int] =( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '6689664895044524452316173185640309...
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
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...
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 argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase__ ( lowerCamelCase_ : List[Any] ,lowerCamelCase_ : List[Any] ,lowerCamel...
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
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_full_determi...
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
from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar __snake_case : Optional[int] =TypeVar('T') class lowerCamelCase__ ( Generic[T]): '''simple docstring''' snake_case_ =42 # Cache store of keys snake_case_ =42 #...
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
__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__ ...
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
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipeline_vq_diffusion import LearnedClassif...
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
import pickle import numpy as np from matplotlib import pyplot as plt class lowerCamelCase__ : '''simple docstring''' def __init__(self ,__lowerCamelCase ,__lowerCamelCase ,__lowerCamelCase ,__lowerCamelCase ,__lowerCamelCase ,__lowerCamelCase=0.2 ,__lowerCamelCase=0.2 ) -> An...
367
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1000): '''simple docstring''' lowerCAmelCase__ , lowerCAmelCase__ : int = 1, 1 lowerCAmelCase__ : Any = 2 while True: lowerCAmelCase__ : Optional[Any] = 0 ...
94
0
from __future__ import annotations __snake_case : Optional[int] =list[list[int]] # assigning initial values to the grid __snake_case : Matrix =[ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, 0, 8, 6, 3, 0, 0...
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_ : list): '''simple docstring''' lowerCAmelCase__ : List[Any] = False while is_sorted is False: # Until all the indices are traversed keep looping lowerCAmelCase__ : Dict = True for i in ra...
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 unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPr...
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
def lowerCAmelCase__ ( lowerCamelCase_ : str ,lowerCamelCase_ : str): '''simple docstring''' lowerCAmelCase__ : Optional[Any] = len(lowerCamelCase_) lowerCAmelCase__ : str = len(lowerCamelCase_) lowerCAmelCase__ : Union[str, Any] ...
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
__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':...
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 typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTimestepEmbedding, Fl...
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
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...
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
import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weights from .dataclasses import Bn...
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
import os import unicodedata 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 __snake_case : int =logging.get_logger(__name__) __snake_case : int ={...
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""" 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, Ima...
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
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...
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
def lowerCAmelCase__ ( lowerCamelCase_ : list): '''simple docstring''' if len(lowerCamelCase_) < 2: return collection def circle_sort_util(lowerCamelCase_ : list ,lowerCamelCase_ : int ,lowerCamelCase_ : int) -> bool: lowerCAmelCase__ : Optional[int] ...
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
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, ) __snake_case : Optional[int] ={'configuration_mbart': ['MBART_PRETRA...
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""" def lowerCAmelCase__ ( lowerCamelCase_ : int = 50): '''simple docstring''' lowerCAmelCase__ : Union[str, Any] = [[0] * 3 for _ in range(length + 1)] for row_length in range(length + 1): for tile_length in range(2 ,5): ...
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
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...
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
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case =logging.get_logger(__name__) __snake_case ={ 'microsoft/biogpt': 'https://huggingface.co/microsoft/biogpt/resolve/main/config.json', # See all BioGPT models at https://huggingface.co/models?filter=biogpt } ...
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 functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : Optional[Any] =logging.get_logger(__name__) __snake_case : Optional[Any] ={ 'microsoft/wavlm-base': 'https://huggingface.co/microsoft/wavlm-base/resolve/ma...
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
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...
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
# 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 having multiple repositor...
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
from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : Dict =logging.get_logger(__name__) # TODO Update this __snake_case : Optional[Any] ={ 'facebook/esm-1b': 'https://huggingface.co/fac...
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
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def lowerCAmelCase__ ( ): '''simple docstring''' lowerCAmelCase__ : Optional[int] = A...
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
import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase__ ( lowerCamelCase_ : Un...
367
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1000): '''simple docstring''' lowerCAmelCase__ , lowerCAmelCase__ : int = 1, 1 lowerCAmelCase__ : Any = 2 while True: lowerCAmelCase__ : Optional[Any] = 0 ...
94
0
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...
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
import copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence from datasets.features import A...
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 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...
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
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class lowerCamelCase__ : '''simple docstring''' snake_case_ =None snake_case_ =False snake_case_ =False snake_case_ =False snake_case_ =None sn...
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
import json import os import re import unittest from transformers import CodeGenTokenizer, CodeGenTokenizerFast from transformers.models.codegen.tokenization_codegen import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixi...
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 numpy import exp, pi, sqrt def lowerCAmelCase__ ( lowerCamelCase_ : List[Any] ,lowerCamelCase_ : float = 0.0 ,lowerCamelCase_ : float = 1.0): '''simple docstring''' return 1 / sqrt(2 * pi * sigma**2) * exp(-((x - mu) ** 2) / (2 * sigma**2)) if __name__ == "__main__": ...
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 typing import TYPE_CHECKING from ..utils import _LazyModule __snake_case : List[Any] ={ 'config': [ 'EXTERNAL_DATA_FORMAT_SIZE_LIMIT', 'OnnxConfig', 'OnnxConfigWithPast', 'OnnxSeq2SeqConfigWithPast', 'PatchingSpec', ], 'convert': ['export', 'valida...
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
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
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
import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosity_info() __snake_case : List[Any] =logging.get...
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 copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : Any =logging.get_logger(__name__) __snake_case : Optional[Any] ={ 'Salesforce/blip-vqa-base': 'https://huggingface.co/Salesforce...
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
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __snake_case : Optional[Any] ={ 'configuration_bigbird_pegasus': [ 'BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BigBirdPegasusConfig', 'BigBirdPegasusOnnxCon...
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 ...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__ ...
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
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __snake_case : Union[str, Any] ={ 'configuration_blenderbot': [ 'BLENDERBOT_PRETRAINED_C...
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""" 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__ ( unittes...
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
import argparse import collections import json import os import re import string import sys import numpy as np __snake_case : List[str] =re.compile(R'\b(a|an|the)\b', re.UNICODE) __snake_case : Optional[Any] =None def lowerCAmelCase__ ( ): '''simple docstring''' lowerCAmelC...
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 json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() __snake_case =[ 'word_embeddings_layernorm.weight', 'word_embe...
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
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 ...
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_torch_available, is_vision_available __snake_case : str ={'configuration_yolos': ['YOLOS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'YolosConfig', 'YolosOnnxConfig']} try: if not is_vision_available(): ...
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
import shutil import tempfile import unittest from transformers import ( SPIECE_UNDERLINE, AddedToken, BatchEncoding, NllbTokenizer, NllbTokenizerFast, is_torch_available, ) from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, requi...
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
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...
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_ : bytes): '''simple docstring''' return "".join([hex(lowerCamelCase_)[2:].zfill(2).upper() for byte in list(lowerCamelCase_)]) def lowerCAmelCase__ ( lowerCamelCase_ : str): '''simple docstring''' ...
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
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...
367
def lowerCAmelCase__ ( lowerCamelCase_ : int = 1000): '''simple docstring''' lowerCAmelCase__ , lowerCAmelCase__ : int = 1, 1 lowerCAmelCase__ : Any = 2 while True: lowerCAmelCase__ : Optional[Any] = 0 ...
94
0
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 __snake_case : Tuple =logging.get_logger(__name__) __snake_case : Tuple ={ 'google/mobilenet...
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_ : str ,lowerCamelCase_ : bool = False): '''simple docstring''' if not isinstance(lowerCamelCase_ ,lowerCamelCase_): lowerCAmelCase__ : int = f"""Expected string as input, found {type(lowerCamelCase_)}""" raise Val...
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 torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( lowerCamelCase__): '''simple docstring''' snake_case_ =(DDPMScheduler,) def lowerCAmelCase__ (self ,**__lowerCamelCase ) ...
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
import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig...
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
"""simple docstring""" import unittest from transformers import GPTNeoXJapaneseConfig, is_torch_available from transformers.models.gpt_neox_japanese.tokenization_gpt_neox_japanese import GPTNeoXJapaneseTokenizer from transformers.testing_utils import require_torch, slow, torch_device from ...test...
95
"""simple docstring""" import inspect import unittest from transformers import SegformerConfig, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common impor...
95
1
"""simple docstring""" from __future__ import annotations from math import pow, sqrt def __UpperCAmelCase ( UpperCAmelCase_ : float , UpperCAmelCase_ : float , UpperCAmelCase_ : float ) -> dict[str, float]: '''simple docstring''' ...
95
"""simple docstring""" from __future__ import annotations import copy import tempfile import unittest from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available from transformers.testing_utils import ( DUMMY_UNKNOWN_IDENTIFIER, S...
95
1