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
from random import randint, random def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE = False , SCREAMING_SNAKE_CASE = False , SCREAMING_SNAKE_CASE = 5 , ): """simple docstring""" lowercas...
93
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { 'unc-nlp/lxmert-base-uncased': 'https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/config.json', } class _a ( U...
93
1
def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" if len(SCREAMING_SNAKE_CASE ) <= 1: return [tuple(SCREAMING_SNAKE_CASE )] lowercase__ = [] def generate(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): if k == 1: res.appe...
93
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = len(SCREAMING_SNAKE_CASE ) lowercase__ = [] for i in range(len(SCREAMING_SNAKE_CASE ) - pat_len + 1 ): lowercase__ = True for j ...
93
1
from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class _a ( UpperCamelCase__ ): def __init__( self: List[Any]...
93
import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers...
93
1
import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn # noqa: F401 # Here...
93
import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version lowerCAmelCase = version.parse(importlib_metadata.version('nltk')) if NLTK_VERSION >= version.Version('3.6.4'): from nltk import word_tokenize lowerCAmelCase...
93
1
from __future__ import annotations def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE = None , SCREAMING_SNAKE_CASE = None ): """simple docstring""" if start is None: lowercase__ = 0 if end is None: lowercase__ = len(SCREAMING_SNAK...
93
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _a ( unittest.TestCase ):...
93
1
lowerCAmelCase = '0.18.2' from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_available, is_k_diffusion_version, is_librosa_available...
93
# 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 require...
93
1
from abc import ABC, abstractmethod from typing import List, Optional class _a ( UpperCamelCase__ ): def __init__( self: Optional[int] ) -> Union[str, Any]: """simple docstring""" self.test() def ...
93
import logging from transformers import PretrainedConfig lowerCAmelCase = logging.getLogger(__name__) lowerCAmelCase = { 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json', } class _a ...
93
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCAmelCase = { 'configuration_roc_bert': ['ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'RoCBertConfig'], 'tokenization_roc_bert': ['RoCBertTokeniz...
93
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_flax...
93
1
lowerCAmelCase = [ (1000, 'M'), (900, 'CM'), (500, 'D'), (400, 'CD'), (100, 'C'), (90, 'XC'), (50, 'L'), (40, 'XL'), (10, 'X'), (9, 'IX'), (5, 'V'), (4, 'IV'), (1, 'I'), ] def _a ( SCREAMING_SNAKE_CASE ): """simple docs...
93
lowerCAmelCase = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_0000)] def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = 0 while number: # Increased Speed Slightly by checking every 5 digits together. sum_of_digits_squa...
93
1
import requests from bsa import BeautifulSoup def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = BeautifulSoup(requests.get(SCREAMING_SNAKE_CASE , params=SCREAMING_SNAKE_CASE ).content , '''html.parser...
93
def _a ( SCREAMING_SNAKE_CASE = 10_00 ): """simple docstring""" return sum(e for e in range(3 , SCREAMING_SNAKE_CASE ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(f"""{solution() = }""")
93
1
def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" if n_term == "": return [] lowercase__ = [] for temp in range(int(SCREAMING_SNAKE_CASE ) ): series.append(f'1/{temp + 1}' if series else '''1''' ) return series if __name__ == "__ma...
93
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase = { 'configuration_luke': ['LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LukeConfig'], 'tokenization_luke': ['LukeTokenizer'], } try: if not is_torch_availa...
93
1
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
93
import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStructProcessor, PixaStruct...
93
1
import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py lowerCAmelCase = ...
93
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger lowerCAmelCase = '<<<<<<< This should probably be modified because it mentions: ' lowerCAmelCase = '=======...
93
1
from __future__ import annotations def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , ): """simple docstring""" lowercase__ = len(SCREAMING_SNAKE_CASE ) #...
93
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, ) lowerCAmelCase = logging.getL...
93
1
import numpy as np class _a : def __init__( self: List[str] ) -> Dict: """simple docstring""" lowercase__ = (0, 0) lowercase__ = None lowercase__ = 0 lowercase__ ...
93
import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets lowerCAmelCase = '\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n and Saurav Kadavath\n and Akul A...
93
1
import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class _a ( unittest.TestCase ): def lowerCamelCase_ ( se...
93
from abc import ABC, abstractmethod from typing import List, Optional class _a ( UpperCamelCase__ ): def __init__( self: Optional[int] ) -> Union[str, Any]: """simple docstring""" self.test() def ...
93
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase = { 'configuration_xlm_roberta_xl': [ 'XLM_ROBERTA_XL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XLMRobertaXLConfig', 'XLMRobertaXLOnnxConfig', ...
93
import argparse from collections import defaultdict import yaml lowerCAmelCase = 'docs/source/en/_toctree.yml' def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = defaultdict(SCREAMING_SNAKE_CASE ) lowercase__ = [] lowerc...
93
1
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class _a ( nn....
93
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" return base * power(SCREAMING_SNAKE_CASE , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('Raise base to the power of exponent using recursion...') ...
93
1
import random def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ , lowercase__ , lowercase__ = [], [], [] for element in data: if element < pivot: less.append(SCREAMING_SNAKE_CASE ) elif ele...
93
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { 'microsoft/git-base': 'https://huggingface.co/microsoft/git-base/resolve/main/config.json'...
93
1
import logging from transformers import PretrainedConfig lowerCAmelCase = logging.getLogger(__name__) lowerCAmelCase = { 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json', } class _a ...
93
from collections.abc import Sequence from queue import Queue class _a : def __init__( self: Tuple , UpperCamelCase_: Optional[int] , UpperCamelCase_: int , UpperCamelCase_: Optional[Any] , UpperCamelCase_: Union[str, Any]=None , U...
93
1
import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class _a ( UpperCamelCase__ ): _lowercase : int = (IPNDMScheduler,) _lowercase : Optional[int] = (('''num_inference_step...
93
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class _a : _lowercase : int _lowercase : TreeNode | None = None _lowercase : TreeNode | None = None lowerCAmelCase =...
93
1
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = len(SCREAMING_SNAKE_CASE ) + 1 lowercase__ = len(SCREAMING_SNAKE_CASE ) + 1 # dp is a 2d matrix where dp[i][j] denotes whether prefix string of #...
93
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_roberta_seri...
93
1
import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin ...
93
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { 'unc-nlp/lxmert-base-uncased': 'https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/config.json', } class _a ( U...
93
1
import torch from diffusers import StableDiffusionPipeline lowerCAmelCase = 'path-to-your-trained-model' lowerCAmelCase = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.floataa).to('cuda') lowerCAmelCase = 'A photo of sks dog in a bucket' lowerCAmelCase = ...
93
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = len(SCREAMING_SNAKE_CASE ) lowercase__ = [] for i in range(len(SCREAMING_SNAKE_CASE ) - pat_len + 1 ): lowercase__ = True for j ...
93
1
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _a ( Up...
93
import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers...
93
1
import math import sys def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = '''''' try: with open(SCREAMING_SNAKE_CASE , '''rb''' ) as binary_file: lowercase__ = binary_file.read() for dat in data: lowercase...
93
import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version lowerCAmelCase = version.parse(importlib_metadata.version('nltk')) if NLTK_VERSION >= version.Version('3.6.4'): from nltk import word_tokenize lowerCAmelCase...
93
1
import argparse from collections import defaultdict import yaml lowerCAmelCase = 'docs/source/en/_toctree.yml' def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = defaultdict(SCREAMING_SNAKE_CASE ) lowercase__ = [] lowerc...
93
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _a ( unittest.TestCase ):...
93
1
import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class _a : def __init__( self: List[Any] , UpperCamelCase_: A...
93
# 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 require...
93
1
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" assert x is not None assert y is not None lowercase__ = len(SCREAMING_SNAKE_CASE ) lowercase__ = len(SCREAMING_SNAKE_CASE ) # declaring the array for stor...
93
import logging from transformers import PretrainedConfig lowerCAmelCase = logging.getLogger(__name__) lowerCAmelCase = { 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json', } class _a ...
93
1
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, ) lowerCAmelCase = logging.getL...
93
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_flax...
93
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): ...
93
lowerCAmelCase = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_0000)] def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = 0 while number: # Increased Speed Slightly by checking every 5 digits together. sum_of_digits_squa...
93
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCAmelCase = { 'configuration_data2vec_audio': ['DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Data2VecAudioConfig'], 'configuration_data2vec_text': ...
93
def _a ( SCREAMING_SNAKE_CASE = 10_00 ): """simple docstring""" return sum(e for e in range(3 , SCREAMING_SNAKE_CASE ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(f"""{solution() = }""")
93
1
def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" if length <= 0 or not isinstance(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): raise ValueError('''Length must be a positive integer.''' ) return [n * (2 * n - 1) for n in range(SCREAMING_SNAKE_CASE ...
93
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase = { 'configuration_luke': ['LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LukeConfig'], 'tokenization_luke': ['LukeTokenizer'], } try: if not is_torch_availa...
93
1
lowerCAmelCase = { 'Pillow': 'Pillow<10.0.0', 'accelerate': 'accelerate>=0.20.3', 'av': 'av==9.2.0', 'beautifulsoup4': 'beautifulsoup4', 'black': 'black~=23.1', 'codecarbon': 'codecarbon==1.2.0', 'cookiecutter': 'cookiecutter==1.7.3', 'dataclasses': 'dataclasses', ...
93
import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStructProcessor, PixaStruct...
93
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 convert_to_rgb, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( OPENAI_CLIP_MEAN...
93
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger lowerCAmelCase = '<<<<<<< This should probably be modified because it mentions: ' lowerCAmelCase = '=======...
93
1
import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from transformers....
93
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, ) lowerCAmelCase = logging.getL...
93
1
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import BatchEncoding, PreTrainedTokenizer from ...utils import logging lowerCAmelCase = logging.get_logger(__n...
93
import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets lowerCAmelCase = '\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n and Saurav Kadavath\n and Akul A...
93
1
import numpy as np def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" return 1 / (1 + np.exp(-vector )) def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" return vector * sigmoid(SCREAMING_SNAKE_CASE ) if __name__ == "__mai...
93
from abc import ABC, abstractmethod from typing import List, Optional class _a ( UpperCamelCase__ ): def __init__( self: Optional[int] ) -> Union[str, Any]: """simple docstring""" self.test() def ...
93
1
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class _a : _lowercase : Any = None def lowerCamelCase_ ( self: Optional[int] ) -> Optional[Any]: "...
93
import argparse from collections import defaultdict import yaml lowerCAmelCase = 'docs/source/en/_toctree.yml' def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = defaultdict(SCREAMING_SNAKE_CASE ) lowercase__ = [] lowerc...
93
1
class _a : def __init__( self: Optional[Any] , UpperCamelCase_: int , UpperCamelCase_: Union[str, Any]=None , UpperCamelCase_: List[str]=None ) -> Optional[int]: """simple docstring""" lowercas...
93
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" return base * power(SCREAMING_SNAKE_CASE , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('Raise base to the power of exponent using recursion...') ...
93
1
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version fro...
93
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { 'microsoft/git-base': 'https://huggingface.co/microsoft/git-base/resolve/main/config.json'...
93
1
import inspect import unittest class _a ( unittest.TestCase ): def lowerCamelCase_ ( self: str ) -> List[Any]: """simple docstring""" try: import diffusers # noqa: F401 except Impor...
93
from collections.abc import Sequence from queue import Queue class _a : def __init__( self: Tuple , UpperCamelCase_: Optional[int] , UpperCamelCase_: int , UpperCamelCase_: Optional[Any] , UpperCamelCase_: Union[str, Any]=None , U...
93
1
def _a ( SCREAMING_SNAKE_CASE = 10 , SCREAMING_SNAKE_CASE = 22 ): """simple docstring""" lowercase__ = range(1 , SCREAMING_SNAKE_CASE ) lowercase__ = range(1 , SCREAMING_SNAKE_CASE ) return sum( 1 for power in powers for...
93
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class _a : _lowercase : int _lowercase : TreeNode | None = None _lowercase : TreeNode | None = None lowerCAmelCase =...
93
1
import numpy as np from cva import COLOR_BGR2GRAY, cvtColor, imread from numpy import array, uinta from PIL import Image from digital_image_processing import change_contrast as cc from digital_image_processing import convert_to_negative as cn from digital_image_processing import sepia as sp from digital_...
93
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_roberta_seri...
93
1
def _a ( SCREAMING_SNAKE_CASE = 10_00 ): """simple docstring""" lowercase__ , lowercase__ = 1, 1 lowercase__ = 2 while True: lowercase__ = 0 lowercase__ = fa + fa lowercase__ , lowercase__ = fa, f index +=...
93
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { 'unc-nlp/lxmert-base-uncased': 'https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/config.json', } class _a ( U...
93
1
from collections.abc import Sequence from queue import Queue class _a : def __init__( self: Tuple , UpperCamelCase_: Optional[int] , UpperCamelCase_: int , UpperCamelCase_: Optional[Any] , UpperCamelCase_: Union[str, Any]=None , U...
93
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = len(SCREAMING_SNAKE_CASE ) lowercase__ = [] for i in range(len(SCREAMING_SNAKE_CASE ) - pat_len + 1 ): lowercase__ = True for j ...
93
1
import math def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" if not isinstance(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): lowercase__ = f'Input value of [number={number}] must be an integer' raise TypeError(SCREAMING_SNAKE_CASE ) ...
93
import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers...
93
1
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = '''''' for word_or_phrase in separated: if not isinstance(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): raise Exception('''join() accepts only s...
93
import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version lowerCAmelCase = version.parse(importlib_metadata.version('nltk')) if NLTK_VERSION >= version.Version('3.6.4'): from nltk import word_tokenize lowerCAmelCase...
93
1
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=UpperCamelCase__ ) class _a ( UpperCamelCase__ ): # `task` is not a ClassVar since we want it to be part of th...
93
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _a ( unittest.TestCase ):...
93
1
import math import time from typing import Dict, List, Optional from torch.utils.data import Dataset from transformers import SeqaSeqTrainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_...
93
# 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 require...
93
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { 'shi-labs/dinat-mini-in1k-224': 'https://...
93
import logging from transformers import PretrainedConfig lowerCAmelCase = logging.getLogger(__name__) lowerCAmelCase = { 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json', } class _a ...
93
1
import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from transformers.models.switch_transformers.c...
93
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_flax...
93
1
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFC...
93
lowerCAmelCase = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_0000)] def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = 0 while number: # Increased Speed Slightly by checking every 5 digits together. sum_of_digits_squa...
93
1
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_gpta import GPTaTokenizer if ...
93
def _a ( SCREAMING_SNAKE_CASE = 10_00 ): """simple docstring""" return sum(e for e in range(3 , SCREAMING_SNAKE_CASE ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(f"""{solution() = }""")
93
1
import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_available, is_torch_available, ) f...
93
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase = { 'configuration_luke': ['LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LukeConfig'], 'tokenization_luke': ['LukeTokenizer'], } try: if not is_torch_availa...
93
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase = { 'configuration_nllb_moe': [ 'NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'NllbMoeConfig', ] } try: if not is_torch_available(): ...
93
import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStructProcessor, PixaStruct...
93
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { 'microsoft/git-base': 'https://huggingface.co/microsoft/git-base/resolve/main/config.json'...
93
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger lowerCAmelCase = '<<<<<<< This should probably be modified because it mentions: ' lowerCAmelCase = '=======...
93
1
# Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position lowerCAmelCase = '2.13.1' import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version.parse('3.7'): rai...
93
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, ) lowerCAmelCase = logging.getL...
93
1
class _a : def __init__( self: Optional[Any] , UpperCamelCase_: Dict , UpperCamelCase_: str , UpperCamelCase_: Any ) -> Optional[int]: """simple docstring""" lowercase__ = name ...
93
import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets lowerCAmelCase = '\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n and Saurav Kadavath\n and Akul A...
93
1
import unittest import numpy as np import torch from diffusers import DDIMPipeline, DDIMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, slow, torch_device from ..pipeline_params import UNCONDITIONAL_IMAGE_GENERATION_BATCH_PARAMS, UNCONDITIONA...
93
from abc import ABC, abstractmethod from typing import List, Optional class _a ( UpperCamelCase__ ): def __init__( self: Optional[int] ) -> Union[str, Any]: """simple docstring""" self.test() def ...
93
1
import unittest from transformers import DonutProcessor lowerCAmelCase = 'naver-clova-ix/donut-base' class _a ( unittest.TestCase ): def lowerCamelCase_ ( self: Optional[int] ) -> Tuple: """simple docstring""" ...
93
import argparse from collections import defaultdict import yaml lowerCAmelCase = 'docs/source/en/_toctree.yml' def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = defaultdict(SCREAMING_SNAKE_CASE ) lowercase__ = [] lowerc...
93
1
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _a ( unittest.TestCase ):...
93
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" return base * power(SCREAMING_SNAKE_CASE , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('Raise base to the power of exponent using recursion...') ...
93
1
from __future__ import annotations lowerCAmelCase = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] lowerCAmelCase = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = ...
93
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { 'microsoft/git-base': 'https://huggingface.co/microsoft/git-base/resolve/main/config.json'...
93
1
lowerCAmelCase = 8.3_1_4_4_6_2 # Unit - J mol-1 K-1 def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" if moles < 0 or kelvin < 0 or volume < 0: raise ValueError('''Invalid inputs. Enter positive value...
93
from collections.abc import Sequence from queue import Queue class _a : def __init__( self: Tuple , UpperCamelCase_: Optional[int] , UpperCamelCase_: int , UpperCamelCase_: Optional[Any] , UpperCamelCase_: Union[str, Any]=None , U...
93
1
from math import ceil def _a ( SCREAMING_SNAKE_CASE = 10_01 ): """simple docstring""" lowercase__ = 1 for i in range(1 , int(ceil(n / 2.0 ) ) ): lowercase__ = 2 * i + 1 lowercase__ = 2 * i lowercase__ = total...
93
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class _a : _lowercase : int _lowercase : TreeNode | None = None _lowercase : TreeNode | None = None lowerCAmelCase =...
93
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase = { 'configuration_mega': ['MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MegaConfig', 'MegaOnnxConfig'], } try: if not is_torch_available():...
93
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_roberta_seri...
93
1
from collections import defaultdict def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = first_str.lower().strip() lowercase__ = second_str.lower().strip() # Remove whitespace lowercase__ = first_s...
93
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { 'unc-nlp/lxmert-base-uncased': 'https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/config.json', } class _a ( U...
93
1
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin from .feature_extraction_wavaveca import WavaVecaFeatureExtractor from .tokenization_wavaveca import WavaVecaCTCTokenizer class _a ( UpperCamelCase__ ): _lowercase : Op...
93
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = len(SCREAMING_SNAKE_CASE ) lowercase__ = [] for i in range(len(SCREAMING_SNAKE_CASE ) - pat_len + 1 ): lowercase__ = True for j ...
93
1
lowerCAmelCase = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_0000)] def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = 0 while number: # Increased Speed Slightly by checking every 5 digits together. sum_of_digits_squa...
93
import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers...
93
1
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional from packaging import version if TYPE_CHECKING: from ... import PreTrainedTokenizer, TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSp...
93
import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version lowerCAmelCase = version.parse(importlib_metadata.version('nltk')) if NLTK_VERSION >= version.Version('3.6.4'): from nltk import word_tokenize lowerCAmelCase...
93
1
def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = int(SCREAMING_SNAKE_CASE ) if decimal in (0, 1): # Exit cases for the recursion return str(SCREAMING_SNAKE_CASE ) lowercase__ , lowercase__ = divmod(SCREAMING_SNAKE_CASE ...
93
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _a ( unittest.TestCase ):...
93
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = {'vocab_file': 'spiec...
93
# 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 require...
93
1
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor lowerCAmelCase = logging.get_logger(__name__) class _a ( UpperCamelCase__ ): def __init__( self: Dict , *UpperCamelCase_: int , **UpperCam...
93
import logging from transformers import PretrainedConfig lowerCAmelCase = logging.getLogger(__name__) lowerCAmelCase = { 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json', } class _a ...
93
1
import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers...
93
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_flax...
93
1
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.fea...
93
lowerCAmelCase = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_0000)] def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = 0 while number: # Increased Speed Slightly by checking every 5 digits together. sum_of_digits_squa...
93
1
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClass...
93
def _a ( SCREAMING_SNAKE_CASE = 10_00 ): """simple docstring""" return sum(e for e in range(3 , SCREAMING_SNAKE_CASE ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(f"""{solution() = }""")
93
1
import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version lowerCAmelCase = version.parse(importlib_metadata.version('nltk')) if NLTK_VERSION >= version.Version('3.6.4'): from nltk import word_tokenize lowerCAmelCase...
93
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase = { 'configuration_luke': ['LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LukeConfig'], 'tokenization_luke': ['LukeTokenizer'], } try: if not is_torch_availa...
93
1
def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" def merge(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> list: def _merge(): while left and right: yield (left if left[0] <= right[0] else right).pop(0 ) yield from left ...
93
import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStructProcessor, PixaStruct...
93
1
from ..utils import DummyObject, requires_backends class _a ( metaclass=UpperCamelCase__ ): _lowercase : Optional[int] = ['''torch''', '''scipy'''] def __init__( self: Union[str, Any] , *UpperCamelCase_: Optional[Any] , **UpperCam...
93
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger lowerCAmelCase = '<<<<<<< This should probably be modified because it mentions: ' lowerCAmelCase = '=======...
93
1
import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger lowerCAmelCase = get_logger(__name__) lowerCAmelCase = R'\n Args:\n input_ids (`jnp.ndarray` of shape `(batch_size, seque...
93
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, ) lowerCAmelCase = logging.getL...
93
1
import pytest from datasets.splits import SplitDict, SplitInfo from datasets.utils.py_utils import asdict @pytest.mark.parametrize( '''split_dict''' , [ SplitDict(), SplitDict({'''train''': SplitInfo(name='''train''' , num_bytes=13_37 , num_examples=42 , ...
93
import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets lowerCAmelCase = '\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n and Saurav Kadavath\n and Akul A...
93
1
import argparse import os import re lowerCAmelCase = 'src/transformers' # Pattern that looks at the indentation in a line. lowerCAmelCase = re.compile(R'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. lowerCAmelCase = re.compile(R'^\s*"([^"]+)":') # Pattern th...
93
from abc import ABC, abstractmethod from typing import List, Optional class _a ( UpperCamelCase__ ): def __init__( self: Optional[int] ) -> Union[str, Any]: """simple docstring""" self.test() def ...
93
1
import itertools import json import os import unittest from transformers import AddedToken, RobertaTokenizer, RobertaTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_com...
93
import argparse from collections import defaultdict import yaml lowerCAmelCase = 'docs/source/en/_toctree.yml' def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = defaultdict(SCREAMING_SNAKE_CASE ) lowercase__ = [] lowerc...
93
1
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching bet...
93
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" return base * power(SCREAMING_SNAKE_CASE , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('Raise base to the power of exponent using recursion...') ...
93
1
from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record lowerCAmelCase = '\\n@article{wang2019superglue,\n title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding Systems},\n author={Wang, Alex ...
93
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { 'microsoft/git-base': 'https://huggingface.co/microsoft/git-base/resolve/main/config.json'...
93
1
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 _a ( unittest.Tes...
93
from collections.abc import Sequence from queue import Queue class _a : def __init__( self: Tuple , UpperCamelCase_: Optional[int] , UpperCamelCase_: int , UpperCamelCase_: Optional[Any] , UpperCamelCase_: Union[str, Any]=None , U...
93
1
from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) lowerCAmelCase = _symb...
93
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class _a : _lowercase : int _lowercase : TreeNode | None = None _lowercase : TreeNode | None = None lowerCAmelCase =...
93
1
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): lowercase__ = n - k # Calculate C(n,k) for i in range(SCREAMING_SNAKE...
93
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modeling_roberta_seri...
93
1
import argparse import copy def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = {} with open(SCREAMING_SNAKE_CASE ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: lowercase__ = [] _list....
93
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase = logging.get_logger(__name__) lowerCAmelCase = { 'unc-nlp/lxmert-base-uncased': 'https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/config.json', } class _a ( U...
93
1
def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = int(SCREAMING_SNAKE_CASE ) if n_element < 1: lowercase__ = ValueError('''a should be a positive number''' ) raise my_error lowercase__ = [1] lowercase__ ,...
93
def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = len(SCREAMING_SNAKE_CASE ) lowercase__ = [] for i in range(len(SCREAMING_SNAKE_CASE ) - pat_len + 1 ): lowercase__ = True for j ...
93
1
lowerCAmelCase = {'a': ['c', 'b'], 'b': ['d', 'e'], 'c': [], 'd': [], 'e': []} lowerCAmelCase = ['a', 'b', 'c', 'd', 'e'] def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = start...
93
import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers...
93
1
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_mode...
93
import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version lowerCAmelCase = version.parse(importlib_metadata.version('nltk')) if NLTK_VERSION >= version.Version('3.6.4'): from nltk import word_tokenize lowerCAmelCase...
93
1
from statistics import mean import numpy as np def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = 0 # Number of processes finished lowercase__ = ...
93
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _a ( unittest.TestCase ):...
93
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCAmelCase = { 'configuration_ctrl': ['CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CTRLConfig'], 'tokenization_ctrl': ['CTRLTokenizer'], } try: if no...
93
# 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 require...
93
1
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space_optun...
93
import logging from transformers import PretrainedConfig lowerCAmelCase = logging.getLogger(__name__) lowerCAmelCase = { 'bertabs-finetuned-cnndm': 'https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.json', } class _a ...
93
1
import warnings from .generation import TFGenerationMixin class _a ( UpperCamelCase__ ): # warning at import time warnings.warn( '''Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will ''' '''be removed...
93
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_flax...
93
1
import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap lowerCAmelCase = 'Usage of script: script_name <size_of_canvas:int>' lowerCAmelCase = [0] * 100 + [1] * 10 random.shuffle(choice) def _a ( SCREAMING_SN...
93
lowerCAmelCase = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(10_0000)] def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase__ = 0 while number: # Increased Speed Slightly by checking every 5 digits together. sum_of_digits_squa...
93
1
import argparse import os import torch from transformers.utils import WEIGHTS_NAME lowerCAmelCase = ['small', 'medium', 'large'] lowerCAmelCase = 'lm_head.decoder.weight' lowerCAmelCase = 'lm_head.weight' def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ...
93
def _a ( SCREAMING_SNAKE_CASE = 10_00 ): """simple docstring""" return sum(e for e in range(3 , SCREAMING_SNAKE_CASE ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(f"""{solution() = }""")
93
1
import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def _a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CA...
93
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase = { 'configuration_luke': ['LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LukeConfig'], 'tokenization_luke': ['LukeTokenizer'], } try: if not is_torch_availa...
93
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase = { 'configuration_timesformer': ['TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TimesformerConfig'], } try: if not is_torch_available(): raise Opti...
93
import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStructProcessor, PixaStruct...
93
1