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
"""simple docstring""" def a__ ( __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ) -> float: if digit_amount > 0: return round(number - int(__SCREAMING_SNAKE_CASE ) , __SCREAMING_SNAKE_CASE ) return number - int(__SCREAMING_SNAKE_CASE ) if __name__ == "__main__": print(dec...
217
'''simple docstring''' 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, ViltF...
41
0
'''simple docstring''' from torch import nn class A_ ( nn.Module ): '''simple docstring''' def __init__( self : Union[str, Any] , lowercase_ : Optional[Any] , lowercase_ : List[Any] ) -> int: super().__init__(...
351
'''simple docstring''' def UpperCamelCase( UpperCAmelCase_ , UpperCAmelCase_ ): UpperCAmelCase : int = len(UpperCAmelCase_ ) UpperCAmelCase : int = len(UpperCAmelCase_ ) UpperCAmelCase : int = ( first_str_length if first_str_length > second_str...
280
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _a : List[Any] = logging.get_logger(__name__) _a : Any = { 'microsoft/swinv2-tiny-patch4-window8-256': ( 'https://huggingface.co/microsoft/swinv2-tiny-patch4-win...
44
"""simple docstring""" from __future__ import annotations _a : List[str] = 10 def SCREAMING_SNAKE_CASE ( _lowerCamelCase : list[int] ) -> list[int]: _lowerCAmelCase : Optional[int] = 1 _lowerCAmelCase : Union[str, Any] ...
44
1
'''simple docstring''' from math import factorial def _lowerCAmelCase ( lowerCamelCase_ : int , lowerCamelCase_ : int , lowerCamelCase_ : float ): if successes > trials: raise ValueError('''successes must be lower or equal to trials...
217
'''simple docstring''' import numpy as np def _lowerCAmelCase ( lowerCamelCase_ : np.array ): return 1 / (1 + np.exp(-vector )) def _lowerCAmelCase ( lowerCamelCase_ : np.array ): return vector * sigmoid(1.7_02 * vector ) if __name_...
217
1
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase__, UpperCAmelCase__ ) -> float: if digit_amount > 0: return round(number - int(UpperCAmelCase__ ), UpperCAmelCase__ ) return number - int(UpperCAmelCase__ ) if __name__ == "__main__": print(decimal...
162
'''simple docstring''' import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase = logging.get_logger(__name__) __lowerCamelCase = { '''RUCAIBox/mvp''': '''https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json''', } ...
162
1
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
296
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from transformers.ut...
296
1
import unittest import torch from diffusers import VQModel from diffusers.utils import floats_tensor, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNetTesterMixin enable_full_determinism() clas...
51
# A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and v to U. We can also say th...
218
0
'''simple docstring''' def __UpperCAmelCase ( a_: Optional[int] ): _UpperCAmelCase : Tuple = [0] * len(__lowerCAmelCase ) _UpperCAmelCase : List[str] = [] _UpperCAmelCase : Optional[Any] = [1] * len(__lowerCAmelCas...
370
'''simple docstring''' import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( "files", [ ["full:README.md", "dataset_infos.json"], ["empty:README.md", "dataset_infos.js...
17
0
'''simple docstring''' def _UpperCamelCase ( SCREAMING_SNAKE_CASE__ : Optional[Any] ): '''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 -...
346
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a ) -> int: if not nums: return 0 __A : Optional[int] = nums[0] __A : str = 0 for num in nums[1:]: __A , __A : Tuple = ( max_...
280
0
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Dict = logging.get_logger(__name__) _lowercase : Tuple = { 'google/pix2struct-textcaps-base': ( ...
356
"""simple docstring""" import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available ...
86
0
"""simple docstring""" def a__ ( __SCREAMING_SNAKE_CASE = 1_0_0_0 ) -> int: __lowerCAmelCase: str = 2**power __lowerCAmelCase: Any = 0 while n: __lowerCAmelCase , __lowerCAmelCase: Tuple = r + n % 1_0, n // 1_0 return r if ...
217
"""simple docstring""" import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging fro...
217
1
"""simple docstring""" import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature f...
355
import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size from ..utils import assert_arrow...
319
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { """Yitu...
296
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { """microsoft/git-base""": """https://huggingface.co/mi...
296
1
"""simple docstring""" from __future__ import annotations import time from collections.abc import Sequence from random import randint from matplotlib import pyplot as plt def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): if not arr: return Non...
316
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): while second != 0: lowerCamelCase__ : Tuple = first & second first ^= second lowerCamelCase__ : int = c << 1 return first if __name__ == "__main__": i...
316
1
"""simple docstring""" A: Dict = 8.314_4598 def _snake_case ( UpperCamelCase : float , UpperCamelCase : float ): if temperature < 0: raise Exception("""Temperature cannot be less than 0 K""" ) if molar_mass <= 0: raise Exception("""Molar mass cannot be less ...
109
"""simple docstring""" import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( ...
17
0
import argparse import os import re UpperCamelCase__ = 'src/diffusers' # Pattern that looks at the indentation in a line. UpperCamelCase__ = re.compile(R'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. UpperCamelCase__ = re.compile(R'^\s*"([^"]+)":') # P...
143
from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_m...
143
1
def A ( _SCREAMING_SNAKE_CASE ) -> int: if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(_SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE ): raise TypeError("Input value must be a 'int' type" ) re...
48
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { """microsoft/markuplm-base""": """https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json""", ""...
86
0
import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ): def a (self : Dict , a__ : str ): """simple docstring""" with open...
238
import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp ...
238
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __UpperCamelCase = { '''configuration_encodec''': [ '''ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''EncodecConfig''', ], ...
69
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTe...
319
0
"""simple docstring""" import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configura...
366
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer A: int = logging.get_logger(__name__) ...
76
0
"""simple docstring""" from __future__ import annotations import queue class __lowerCAmelCase : def __init__( self , __UpperCAmelCase ): '''simple docstring''' __UpperCamelCase = data __UpperCamelCase = None __UpperCamelCase = None ...
316
"""simple docstring""" 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 GPTaTokeniz...
316
1
from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE :Any = logging.get_logger(__name__) SCREAMING_SNAKE_CASE :List[Any] = { """microsoft/markuplm-base""": """https://huggingface.co/microsoft/markuplm-base/resolve/main/...
60
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_availab...
60
1
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenP...
143
import os from itertools import chain from random import randrange, shuffle import pytest from .sola import PokerHand lowerCAmelCase__ : str = ( '''4S 3H 2C 7S 5H''', '''9D 8H 2C 6S 7H''', '''2D 6D 9D TH 7D''', '''TC 8C 2S JH 6C''', '''JH 8S TH AH QH''', '''TS KS 5S 9S ...
143
1
"""simple docstring""" import operator as op _UpperCamelCase = """scaler.pt""" _UpperCamelCase = """pytorch_model""" _UpperCamelCase = """random_states""" _UpperCamelCase = """optimizer""" _UpperCamelCase = """scheduler""" _UpperCamelCase = ...
351
"""simple docstring""" import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel _UpperCamelCase = { """text_branch""": """text_model""", """audio_branch""": """audio_model.audio_encoder""", """attn"...
234
0
"""simple docstring""" import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils ...
238
"""simple docstring""" class __SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self : Dict, lowerCamelCase : list )-> None: lowerCamelCase__ : Tuple =set_counts lowerCamelCase__ : Dict =max(lowerCamelCase ) lo...
238
1
'''simple docstring''' def a ( lowerCamelCase__ ): '''simple docstring''' return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
135
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase :Any = logging.get_logger(__name__) lowerCamelCase :List[Any] = { '...
135
1
import argparse import os import re import tensorflow as tf import torch from transformers import BertConfig, BertModel from transformers.utils import logging logging.set_verbosity_info() lowerCAmelCase__ : Union[str, Any] = logging.get_logger(__name__) def UpperCamelCase__ ( A__ , ...
143
from ...configuration_utils import PretrainedConfig from ...utils import logging a_ = logging.get_logger(__name__) a_ = { 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at https://huggingface.co/models?filter=vit_msn ...
76
0
import unittest from transformers import XLMConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_...
356
from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCAmelCase = {'''UserAgent''': UserAgent().random} def _lowerCamelCase( lowercase__ ) -> dict: '''simple docstring''' __lowercase= scr...
304
0
"""simple docstring""" from manim import * class snake_case_( a__ ): def lowerCamelCase__ ( self : Tuple ): lowerCAmelCase : List[str] = Rectangle(height=0.5 , width=0.5 ) lowerCAmelCase : Union[str, Any] = Rectangle(height=0.4...
60
"""simple docstring""" import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import numpy as np from utils_multiple_choice import MultipleChoiceDataset, Split, processors import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice...
60
1
from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=A_ ): A__ : str = ["sentencepiece"] def __init__(self : Union[str, Any] , *snake_case__ : Dict , **snake_case__ : Optional[int] ) -> Tuple: '''...
10
import unittest from transformers import TrOCRConfig from transformers.testing_utils import is_torch_available, require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, id...
10
1
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class lowercase_ ( UpperCAmelCase__ ): A__ : Any = DistilBertTokenizer A_...
122
'''simple docstring''' import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def...
234
0
from __future__ import annotations from random import choice def __SCREAMING_SNAKE_CASE ( lowerCAmelCase: Any ) -> Optional[int]: return choice(lowerCAmelCase ) def __SCREAMING_SNAKE_CASE ( lowerCAmelCase: list[int] , lowerCAmelCase: int ) -> int: _...
189
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class a : def __init__( self , A_ = None ): '''simple docstring''' if components is None: _UpperCAmelCase : Dict ...
189
1
"""simple docstring""" import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py __A = '''\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, title = {BLEU: a Method for Au...
135
"""simple docstring""" import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, ...
135
1
"""simple docstring""" from __future__ import annotations from decimal import Decimal from numpy import array def lowercase__ ( lowercase_ ) -> list[list[float]]: """simple docstring""" _UpperCamelCase : int = Decimal # Check if the provided matrix has 2 r...
310
"""simple docstring""" from typing import Any def lowercase__ ( lowercase_ ) -> list[Any]: """simple docstring""" if not input_list: return [] _UpperCamelCase : Dict = [input_list.count(lowercase_ ) for value in input_list] _UpperCamelCa...
310
1
def _A ( _lowercase = 10_00 ) -> int: """simple docstring""" __UpperCamelCase = 1, 1 __UpperCamelCase = [] for i in range(1 , n + 1 ): __UpperCamelCase = prev_numerator + 2 * prev_denominator __...
310
'''simple docstring''' import functools def __UpperCAmelCase ( A : str , A : str ) -> int: UpperCAmelCase_ : Optional[Any] = len(A ) UpperCAmelCase_ : List[str] = len(A ) @functools.cache def min_distance(A : int , A : ...
304
0
import argparse __A : List[Any] = '''docs/source/_static/js/custom.js''' def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> int: '''simple docstring''' with open(_UpperCAmelCase, encoding='utf-8', newline='\n' ) as f: lowerCAmelCase : Union[str, ...
323
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : Union[str, Any] = { '''configuration_informer''': [ '''INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''InformerConfi...
323
1
from ..utils import DummyObject, requires_backends class _SCREAMING_SNAKE_CASE ( metaclass=__SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = ["sentencepiece"] def __init__(self : List[str] , *UpperCAmelCase_ : Union[str, Any] , **UpperCAmelCase_ : ...
10
from typing import Any def lowerCAmelCase_ ( __a , __a , __a , __a , __a , ) -> list: """simple docstring""" _validation( __a , __a , __a , __a , __a , ) # Creates data structures and fill initial step lowerCamelCase__: dict ={}...
10
1
'''simple docstring''' import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing i...
164
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase__ : Any = { 'configuration_luke': ['LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LukeConfig'], 'tokenization_luke': ['Luk...
164
1
import argparse import json import logging import os import sys from unittest.mock import patch from transformers.testing_utils import TestCasePlus, get_gpu_count, slow lowerCamelCase : Union[str, Any] =[ os.path.join(os.path.dirname(__file__), dirname) for dirname in [ ...
189
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bl...
189
1
import argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def __a ( _SCREAMING_SNAKE_CASE ) ->List[Any]: a__: Optional[int] = [ 'encoder.version', 'decoder.version', 'model....
350
"""simple docstring""" from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from ..image_utils import load_image if is_torch_available(): impor...
203
0
from sklearn.metrics import fa_score, matthews_corrcoef import datasets from .record_evaluation import evaluate as evaluate_record __snake_case = '''\ @article{wang2019superglue, title={SuperGLUE: A Stickier Benchmark for General-Purpose Language Understanding Systems}, author={Wang, Alex ...
310
import io import json import unittest from parameterized import parameterized from transformers import FSMTForConditionalGeneration, FSMTTokenizer from transformers.testing_utils import get_tests_dir, require_torch, slow, torch_device from utils import calculate_bleu __snake_case = get_tes...
310
1
import os import pytest from transformers.dynamic_module_utils import get_imports lowerCamelCase__ : List[Any] = '\nimport os\n' lowerCamelCase__ : Optional[int] = '\ndef foo():\n import os\n return False\n' lowerCamelCase__ : Optional[Any] = ...
210
import gc import threading import time import psutil import torch class lowerCamelCase_ : '''simple docstring''' def __init__( self : Optional[Any] ): SCREAMING_SNAKE_CASE_ = psutil.Process() SCREAMING_SNAKE_CASE_ = False def ...
210
1
'''simple docstring''' import argparse __UpperCAmelCase = """docs/source/_static/js/custom.js""" def __A ( lowerCamelCase_ ): """simple docstring""" with open(lowerCamelCase_ , encoding="""utf-8""" , newline="""\n""" ) as f: SCREAMING_SNA...
323
'''simple docstring''' from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import Model...
323
1
from typing import List import numpy as np def __UpperCamelCase ( lowercase__ : dict ) -> int: '''simple docstring''' lowerCAmelCase_ : int = {key: len(lowercase__ ) for key, value in gen_kwargs.items() if isinstance(lowercase__ , lowercase__ )}...
28
from math import ceil def __UpperCamelCase ( lowercase__ : int = 1001 ) -> int: '''simple docstring''' lowerCAmelCase_ : List[str] = 1 for i in range(1 , int(ceil(n / 2.0 ) ) ): lowerCAmelCase_ : Optional[Any] = 2 ...
28
1
'''simple docstring''' import numpy as np import pandas as pd from sklearn.preprocessing import Normalizer from sklearn.svm import SVR from statsmodels.tsa.statespace.sarimax import SARIMAX def _A ( lowercase__ , lowercase__ , lowercase__ , lowercase__ , ...
164
'''simple docstring''' import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device __A = False class A ( unittest.TestCase ): pass @slow ...
164
1
import torch from diffusers import DiffusionPipeline class __A ( UpperCamelCase__ ): def __init__(self : List[str] , __a : Optional[int] , __a : Optional[int] ): super().__init__() self.register_modules(unet=__UpperCAmelCase , sched...
354
'''simple docstring''' from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline SCREAMING_SNAKE_CASE_: Dict =logging.get_logger(__name__) cl...
106
0
from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class UpperCAmelCase__ ( A_ ): """simple docstring""" def __init__( self...
62
"""simple docstring""" import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup __snake_case = { """User-Agent""": """Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36""" """ (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 E...
203
0
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def UpperCAmelCase_ ( _A , _A , _A , _A , _A = None , _A = None , _A = None , ): '''simple docstring''' ...
357
from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
218
0
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TextClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, slow from .test_pipelines_com...
210
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __a : int = logging.get_logger(__name__) __a : str = { """ut/deta""": """https://huggingface.co/ut/deta/resolve/main/config.json""", } class _UpperCamelCa...
210
1
'''simple docstring''' UpperCamelCase : List[Any] = 256 # Modulus to hash a string UpperCamelCase : List[Any] = 1_000_003 def SCREAMING_SNAKE_CASE__ ( snake_case : str , snake_case : str ) -> bool: """simple doc...
345
'''simple docstring''' import logging from transformers.configuration_utils import PretrainedConfig UpperCamelCase : Optional[Any] = logging.getLogger(__name__) class UpperCamelCase ( a_ ): """simple docstring""" A : Tuple = "masked_bert" ...
345
1
'''simple docstring''' import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger _lowerCamelCase : Dict = get_logger(__name__) class SCREAMING_SNAKE_CASE ( enum.Enum ): """simple docstrin...
28
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase : List[Any] = { "configuration_m2m_100": ["M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP", "M2M100Config", "...
28
1
'''simple docstring''' from math import isqrt, loga def lowerCamelCase__ ( A : int ): '''simple docstring''' UpperCAmelCase = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: ...
91
'''simple docstring''' from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class UpperCamelCase__: __magic_name__ : int __magic_name__ : TreeNode | None = None __magic_name__ : TreeNode | None = None ...
91
1
'''simple docstring''' import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask ...
23
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available __UpperCamelCase : str = { '''configuration_longt5''': ['''LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''LongT5Config''', '''Long...
106
0
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...on...
188
"""simple docstring""" def __A ( a_ :int = 1_00_00_00) -> int: __a : Tuple = [i - 1 for i in range(limit + 1)] for i in range(2 , limit + 1): if phi[i] == i - 1: for j in range(2 * i , limit + 1 , a_): ...
188
1
import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_RECORDS_FILENAM...
196
import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device _lowerCAmelCase : Optional[Any] = False class __magic_name__ ( unitt...
218
0
'''simple docstring''' import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def __a ( _UpperCamelCase: List[Any] , _UpperCamelCase: List[str]=() , _Upper...
354
'''simple docstring''' # Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
142
0
UpperCamelCase_ = 256 # Modulus to hash a string UpperCamelCase_ = 1000003 def lowerCamelCase_ ( _a : str , _a : str ): '''simple docstring''' UpperCAmelCase_ : Any = len(_a ) UpperCAmelCase_ : List[Any] = len(_a )...
345
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _snake_case ( __snake_case , unittest.TestCase ): '''simple docstring''' A...
345
1
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black UpperCAmelCase = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_copies # noqa: E402 ...
172
"""simple docstring""" import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def lowerCamelCase (a_ :Optional[int] , a_ :Union[str, A...
172
1
"""simple docstring""" import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import ...
91
"""simple docstring""" import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( UpperCAmelCase__ ): '''simple docstring''' __UpperCamelCase = (PNDMScheduler,) __UpperCamelCase = ...
91
1
_A : List[Any] = [ 'DownloadConfig', 'DownloadManager', 'DownloadMode', 'StreamingDownloadManager', ] from .download_config import DownloadConfig from .download_manager import DownloadManager, DownloadMode from .streaming_download_manager import StreamingDownloadManager
265
def _a ( UpperCAmelCase ) -> bool: """simple docstring""" return str(UpperCAmelCase ) == str(UpperCAmelCase )[::-1] def _a ( UpperCAmelCase ) -> int: """simple docstring""" return int(UpperCAmelCase ) + int(str(UpperCAmelCase )[::-1]...
265
1
def UpperCAmelCase__ ( ): '''simple docstring''' return [ a * b * (10_00 - a - b) for a in range(1 , 9_99 ) for b in range(_A , 9_99 ) if (a * a + b * b == (10_00 - a - b) ** 2) ][0] if __name__ == "__main__": print(f"""{solution() = }""...
188
from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline lowerCamelCase = logging.get_logger(__name__) ...
188
1
"""simple docstring""" def _snake_case ( UpperCamelCase : int ): UpperCAmelCase : Tuple = int(UpperCamelCase ) if n_element < 1: UpperCAmelCase : Tuple = ValueError("""a should be a positive number""" ) raise my_error UpperCAmelCase : Tuple ...
76
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze, transpose, ...
76
1
"""simple docstring""" import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational impor...
45
from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddings @maybe_allow_in_graph cla...
142
0
'''simple docstring''' from __future__ import annotations def _UpperCAmelCase ( _UpperCamelCase : list[list[int]] ) -> bool: A_ = len(_UpperCamelCase ) # We need to create solution object to save path. A_ = [[0 for _ in range(_UpperC...
18
'''simple docstring''' import inspect import unittest from transformers import DPTConfig from transformers.file_utils import is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test...
18
1
"""simple docstring""" def __UpperCAmelCase ( UpperCAmelCase_ : list , UpperCAmelCase_ : list , UpperCAmelCase_ : int , UpperCAmelCase_ : int , UpperCAmelCase_ : int ) -> int: '''simple docstring''' if index ==...
172
"""simple docstring""" 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 _a : Optional[int]= logging...
172
1
'''simple docstring''' import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() UpperCamelCase__ : List[str] = logging.get_logger(__name__) def UpperCAmelC...
164
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase__ : Any = { 'configuration_luke': ['LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'LukeConfig'], 'tokenization_luke': ['Luk...
164
1
'''simple docstring''' def __lowerCamelCase ( _lowercase = 1_0_0_0 ) -> int: return sum(e for e in range(3 , _lowercase ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F'''{solution() = }''')
265
'''simple docstring''' import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizer...
265
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionPanoramaPipeline, UNeta...
350
import math class _UpperCAmelCase : '''simple docstring''' def __UpperCAmelCase ( self : Dict , lowercase_ : list[list[float]] , lowercase_ : list[int]) -> int: """simple docstring""" _UpperCamelCase = 0.0 _UpperCamelCase ...
63
0
# Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def lowerCamelCase__ ( _a , _a , _a): SCREAMING_SNAKE_CASE : Optional[Any] = { "en": "Machine learning is great, isn't it?", "ru": "Машинное обучение - это здорово, не так ли?", "de"...
76
import baseaa def lowerCamelCase__ ( _a): return baseaa.aaaencode(string.encode("utf-8")) def lowerCamelCase__ ( _a): return baseaa.aaadecode(_a).decode("utf-8") if __name__ == "__main__": import doctest doctest.testmod()
76
1
'''simple docstring''' from __future__ import annotations from collections.abc import Iterator class _a : def __init__( self ,_SCREAMING_SNAKE_CASE ) -> Dict: _snake_case = value _snake_case = None _snake_case = Non...
352
'''simple docstring''' import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __a ( _UpperCamelCase: Tuple ) -> Union[str, Any]: """simple docstring""" _snake_case = os.path.j...
142
0
import json import os from dataclasses import dataclass from functools import partial from typing import Callable import flax.linen as nn import jax import jax.numpy as jnp import joblib import optax import wandb from flax import jax_utils, struct, traverse_util from flax.serialization import from_bytes, to_bytes from...
18
from math import factorial, radians def _snake_case ( lowerCAmelCase : float , lowerCAmelCase : int = 1_8 , lowerCAmelCase : int = 1_0 ): """simple docstring""" SCREAMING_SNAKE_CASE_ : List[str] = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) ...
18
1
from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common im...
292
import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unordered...
292
1
'''simple docstring''' import os # Precomputes a list of the 100 first triangular numbers __A = [int(0.5 * n * (n + 1)) for n in range(1, 101)] def _A ( ): lowercase__ = os.path.dirname(os.path.realpath(lowercase__ ) ) lowercase__ = os.p...
164
'''simple docstring''' import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device __A = False class A ( unittest.TestCase ): pass @slow ...
164
1
import os def a( ) -> List[str]: """simple docstring""" with open(os.path.dirname(A ) + "/grid.txt" ) as f: a = [] # noqa: E741 for _ in range(20 ): l.append([int(A ) for x in f.readline().split()] ) a = 0 # ...
71
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, Features, Value from .base import TaskTemplate @dataclass(frozen=lowerCAmelCase ) class _lowercase ( lowerCAmelCase ): """simple docstring""" __A = ...
71
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor A: int = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( UpperCAmelCase__ ): def __init__( self , *_SCREAMING_SNAKE_CASE ...
109
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class __SCREAMING_SNAKE_CASE (lowerCamelCa...
63
0
'''simple docstring''' import math from datetime import datetime, timedelta def _snake_case ( A ) -> datetime: lowerCAmelCase__ = year % 19 lowerCAmelCase__ = year % 4 lowerCAmelCase__ = year % 7 lowerCAmelCase__...
228
'''simple docstring''' from __future__ import annotations def _snake_case ( A , A ) -> float: lowerCAmelCase__ = sorted(numsa + numsa ) lowerCAmelCase__ , lowerCAmelCase__ = divmod(len(A ) , 2 ) if mod == 1: ...
228
1
import asyncio import os import re import sys import tempfile import unittest from contextlib import contextmanager from copy import deepcopy from distutils.util import strtobool from enum import Enum from importlib.util import find_spec from pathlib import Path from unittest.mock import patch import pya...
87
import argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def _a ( UpperCAmelCase ) -> Dict: """simple docstring""" lowerCamelCase__ : Dict = [ '''encoder.version''', ...
142
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_pro...
147
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) lowerCAmelCase : int ...
147
1
"""simple docstring""" _snake_case : List[str] = { 'a': 'AAAAA', 'b': 'AAAAB', 'c': 'AAABA', 'd': 'AAABB', 'e': 'AABAA', 'f': 'AABAB', 'g': 'AABBA', 'h': 'AABBB', 'i': 'ABAAA', 'j': 'BBBAA', 'k': 'ABAAB', 'l': 'ABABA', 'm': 'ABABB', 'n': 'AB...
292
"""simple docstring""" from math import isqrt, loga def A__ ( UpperCamelCase ): A = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , UpperCamelCase , UpperC...
292
1
import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils import require_keras_nlp, requi...
139
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __UpperCAmelCase = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE ( a_ ): """simple docstring""" def __init__( self : Optional[Any] , *lowerCAm...
139
1
import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor from tr...
71
from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( ...
71
1
"""simple docstring""" from __future__ import annotations def a__ ( snake_case__ , snake_case__ , snake_case__ , snake_case__ , snake_case__ , ) -> None: lowerCamelCase = len(snake_case__ ) # If row is equal to the size of the board it means there are a queen in eac...
368
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMSchedu...
168
0
def __A ( __lowerCamelCase , __lowerCamelCase ) -> str: if not isinstance(__lowerCamelCase , __lowerCamelCase ): raise ValueError("""iterations must be defined as integers""" ) if not isinstance(__lowerCamelCase , __lowerCamelCase ) or not number >= 1: ...
228
def __A ( __lowerCamelCase ) -> int: a = 0 while num > 0: digit_sum += num % 10 num //= 10 return digit_sum def __A ( __lowerCamelCase = 100 ) -> int: a = 1 a = 2 for i in range(2 , max_n + 1 ...
228
1
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCAmelCase : Optional[Any] = {'configuration_mra': ['MRA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'M...
361
'''simple docstring''' from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_co...
251
0
import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class _a ( unittest.TestCase ): def __snake_case (self ) -> List[Any]: UpperCAmelCase_: int = [ """safety_checker/pytorch_model.bin""", ...
147
from collections import namedtuple a : List[Any] = namedtuple('from_to', 'from_ to') a : Tuple = { 'cubicmeter': from_to(1, 1), 'litre': from_to(0.0_0_1, 1_000), 'kilolitre': from_to(1, 1), 'gallon': from_to(0.0_0_4_5_4, 2_6_4.1_7_2), 'cubicyard':...
147
1
'''simple docstring''' import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ : Optional[Any] = logging.get_logger(__name__) lowerCAmelCase__ : Dict = { "voc...
37
'''simple docstring''' def __UpperCamelCase ( _UpperCAmelCase ): if p < 2: raise ValueError("p should not be less than 2!" ) elif p == 2: return True __UpperCAmelCase : List[str] = 4 __UpperCAmelCase : int = (1 << p) - 1 for _ in range(p - ...
37
1
'''simple docstring''' from abc import ABC, abstractmethod from argparse import ArgumentParser class _snake_case ( _a ): @staticmethod @abstractmethod def __UpperCamelCase ( SCREAMING_SNAKE_CASE__ : ArgumentParser ): raise NotImplementedError() ...
139
'''simple docstring''' import argparse import math import os from copy import deepcopy import torch from audio_diffusion.models import DiffusionAttnUnetaD from diffusion import sampling from torch import nn from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel A_ = ...
139
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _snake_case : Optional[Any] = logging.get_logger(__name__) _snake_case : Union[str, A...
355
'''simple docstring''' import argparse from collections import defaultdict import yaml _snake_case : int = 'docs/source/en/_toctree.yml' def snake_case_ (UpperCamelCase : Optional[int] ): '''simple docstring''' _a = defaultdi...
179
0
from __future__ import annotations import time import numpy as np __UpperCAmelCase = [8, 5, 9, 7] __UpperCAmelCase = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] __UpperCAmelCase = [ [3, 2, 1, 4], [0, 2, 5, 2], ...
119
'''simple docstring''' import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModel...
168
0
from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffusers.schedulers.s...
208
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase : Optional[Any] = logging.get_logger(__name__) lowerCamelCase : Tuple = { "transfo-xl-wt103": "https://huggingface.co/transfo-xl-wt103/resolve/main/config.json", } ...
208
1
from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_...
71
'''simple docstring''' from __future__ import annotations import string from itertools import cycle, product from pathlib import Path UpperCamelCase_ = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) UpperCamelCase_ = [ord(letter)...
251
0
"""simple docstring""" import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def snake_case (A_ :Optional[Any] , A_ :Any=7 ): '''simple docstring''' a : Tuple = None if token is not None:...
186
"""simple docstring""" def snake_case (A_ :list[int] , A_ :str ): '''simple docstring''' a : Optional[int] = int(A_ ) # Initialize Result a : int = [] # Traverse through all denomination for denomination in reversed(A_ ): ...
186
1
'''simple docstring''' import os from distutils.util import strtobool def _SCREAMING_SNAKE_CASE ( UpperCamelCase , UpperCamelCase ): """simple docstring""" for e in env_keys: lowerCAmelCase__ : List[Any] = int(os.environ.get(UpperCamelCase , ...
37
'''simple docstring''' 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 _lowerCAmelCase = logging.get_logger(__na...
37
1
'''simple docstring''' def lowercase__( __UpperCamelCase: int ): """simple docstring""" if not isinstance(__UpperCamelCase ,__UpperCamelCase ): raise TypeError('only integers accepted as input' ) else: SCREAMING_SNAKE_CASE : ...
354
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = {"openai-gpt": "https://huggingface.co/openai-gpt/resolve/main/config.json"} class _...
246
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImage...
35
"""simple docstring""" import uuid from typing import Any, Dict, List, Optional, Union from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf if is_torch_available(): imp...
179
0
'''simple docstring''' from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class _lowerCAmelCa...
164
'''simple docstring''' from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class _lowerCAmelCa...
164
1
'''simple docstring''' from __future__ import annotations _UpperCamelCase = list[tuple[int, int]] _UpperCamelCase = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, ...
208
'''simple docstring''' import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def a_ ( _lowerCAmelCase ,_lowerCAmelCase ,_lowerCAmelCase ,_lowerCAmelCase ,_...
208
1
import inspect import logging import os import random import shutil import tempfile import unittest import pytest import torch from torch import nn from torch.utils.data import DataLoader, TensorDataset from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_cuda fro...
103
from graphs.minimum_spanning_tree_kruskal import kruskal def UpperCamelCase ( ) -> Tuple: UpperCamelCase : List[str] = 9 UpperCamelCase : Optional[Any] = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, 8, 7], [7, 6, 1], [2,...
103
1
import argparse import os import re import packaging.version UpperCamelCase = """examples/""" UpperCamelCase = { """examples""": (re.compile(r"""^check_min_version\(\"[^\"]+\"\)\s*$""", re.MULTILINE), """check_min_version(\"VERSION\")\n"""), """init""": (re.compile(r"""^__version__\s+=\s+\"(...
186
import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modules import _PACKAGED_DATASETS...
186
1
import string from math import logaa def SCREAMING_SNAKE_CASE ( __lowerCAmelCase , __lowerCAmelCase ) -> int: UpperCamelCase__ : int = document.translate( str.maketrans("" , "" , string.punctuation ) ).replace("\n" , "" ...
196
import argparse import os import re import packaging.version lowerCamelCase : Optional[Any] ='''examples/''' lowerCamelCase : List[Any] ={ '''examples''': (re.compile(R'''^check_min_version\("[^"]+"\)\s*$''', re.MULTILINE), '''check_min_version("VERSION")\n'''), ...
196
1