code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { 'Salesforce/blip-vqa-base': 'https://huggingface.co/Salesforce/blip-vqa-base/resolve...
61
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, Timeste...
8
0
snake_case = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} snake_case = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def lowerCamelCase__ ( lowercase , lowercase , lowercase ): """simple docstring""" SCREAMING_SNAKE_CASE : Optional[Any] ...
62
'''simple docstring''' def _lowerCAmelCase ( __snake_case : str , __snake_case : str ) -> int: if len(__snake_case ) != len(__snake_case ): raise ValueError('String lengths must match!' ) __A : Optional[Any] = 0 ...
8
0
import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowerCamelCase__ ( __lowerCamelCase : int , __lowerCamelCase : Any , __lowerC...
63
'''simple docstring''' import argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() lowercase__ : Tup...
8
0
import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging lowercase_ : int = logging.get_logger(__name__) def A__ ( snake_case_ : Any , snake_case_ : Lis...
64
'''simple docstring''' import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings l...
8
0
"""simple docstring""" import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": __UpperCAmelCase = pd.read_csv('sample_data.csv', header...
65
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : List[Any] = logging.get_logger(__name__) lowercase__ : Optional[int] = { '''unc-nlp/lxmert-base-uncased''': '''https://huggingf...
8
0
import webbrowser from sys import argv from urllib.parse import parse_qs, quote import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": UpperCamelCase = "%20".join(argv[1:]) if len(argv) > 1 else quote(str(input("Search: "))) print("G...
66
'''simple docstring''' import math import sys def _lowerCAmelCase ( __snake_case : int ) -> int: if number != int(__snake_case ): raise ValueError('the value of input must be a natural number' ) if number < 0: raise ValueE...
8
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case = { """configuration_al...
67
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( __snake_case : list[int] , __snake_case : list[int] , __snake_case : int ) -> tuple[float, list[float]]: __A : int = list(range(len(__snake...
8
0
import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset from transformers import A...
68
'''simple docstring''' from __future__ import annotations import math class SCREAMING_SNAKE_CASE : def __init__( self , _UpperCAmelCase): '''simple docstring''' __A : int = size # approximate the overall ...
8
0
'''simple docstring''' def __UpperCAmelCase ( _UpperCAmelCase : int ) -> Tuple: __snake_case = 1 __snake_case = 2 while i * i <= n: __snake_case = 0 while n % i == 0: n //= i multiplicity += 1 n_divisors *= multiplicity + 1 ...
69
'''simple docstring''' def _lowerCAmelCase ( __snake_case : int , __snake_case : int , __snake_case : int ) -> float: __A : Dict = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of s...
8
0
from collections import Counter from timeit import timeit def _SCREAMING_SNAKE_CASE ( lowercase : str = "" , ): '''simple docstring''' return sum(c % 2 for c in Counter(input_str.replace(' ' , '' ).lower() ).values() ) < 2 def _SCREAMING_S...
70
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeli...
8
0
'''simple docstring''' import os import re import shutil import sys import tempfile import unittest import black _lowerCamelCase = 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_copie...
71
'''simple docstring''' import argparse import os import re lowercase__ : Optional[int] = '''src/diffusers''' # Pattern that looks at the indentation in a line. lowercase__ : Dict = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and pu...
8
0
'''simple docstring''' from abc import ABC, abstractmethod from argparse import ArgumentParser class __magic_name__ ( __SCREAMING_SNAKE_CASE ): @staticmethod @abstractmethod def _A( snake_case_ ): raise NotImplementedError() @abstractmethod def _A( self ...
72
'''simple docstring''' def _lowerCAmelCase ( __snake_case : int ) -> bool: return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('''Program to check whether a number is a Perfect number or ...
8
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig a_ : Optional[Any] = logging.get_logger(__name__) a_ : Tuple = { 'Intel/dpt-large': 'https://huggingface.co/Intel/dpt-large/resolve/main/config.json',...
73
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() lowercase__ : Tuple = logging.get_logger(__name__) lowercase__ ...
8
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { """uw-madison/mra-base-512-4""": """https://huggingface.co/uw-madison/mra-base-512-4/resolve/main/config.json""", } class __UpperCamelCase ( lowerC...
74
'''simple docstring''' import mpmath # for roots of unity import numpy as np class SCREAMING_SNAKE_CASE : def __init__( self , _UpperCAmelCase=None , _UpperCAmelCase=None): '''simple docstring''' __A : List[Any] ...
8
0
'''simple docstring''' def a__ ( lowerCAmelCase__ = 1_00_00_00 ) -> int: UpperCAmelCase__ : str = 1 UpperCAmelCase__ : int = 1 UpperCAmelCase__ : int = {1: 1} for inputa in range(2 , lowerCAmelCase__ ): ...
75
'''simple docstring''' import inspect import unittest from transformers import YolosConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configura...
8
0
"""simple docstring""" # coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # 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/licen...
76
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_...
8
0
"""simple docstring""" import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transformers import g...
77
'''simple docstring''' import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS...
8
0
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : int = 10_00 ) -> int: '''simple docstring''' return sum(e for e in range(3 , snake_case_ ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(f"{solution() = }")
78
'''simple docstring''' import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def _lowerCAmelCase ( __snake_case : str , __snake_case : str , **__snake_case : List[Any] ) -> Any: __A : Optiona...
8
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .toke...
79
'''simple docstring''' from ...configuration_utils import PretrainedConfig lowercase__ : Any = { '''google/tapas-base-finetuned-sqa''': ( '''https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json''' ), '''google/tapas-base-fi...
8
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer __UpperCamelCase : Union[str, Any] = logging.get_logger(__...
80
'''simple docstring''' 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 SCREAMING_SNAKE_CASE : def __init_...
8
0
import warnings from ...utils import logging from .image_processing_perceiver import PerceiverImageProcessor _snake_case : Optional[int] = logging.get_logger(__name__) class a (_lowerCAmelCase ): """simple docstring""" def __init__( self : Any , ...
81
'''simple docstring''' def _lowerCAmelCase ( __snake_case : Optional[Any] ) -> Optional[Any]: # noqa: E741 __A : Tuple = len(__snake_case ) __A : Optional[int] = 0 __A : str = [0] * n __A : int = [Fals...
8
0
"""simple docstring""" import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot ...
82
'''simple docstring''' import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create s...
8
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCAmelCase__ = { '''configuration_resnet''': ['''RESNET_PRETRAINED_CONFIG_ARCH...
83
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, Timeste...
8
0
import copy from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase = logging.get_logger(__name__) UpperCA...
84
'''simple docstring''' def _lowerCAmelCase ( __snake_case : str , __snake_case : str ) -> int: if len(__snake_case ) != len(__snake_case ): raise ValueError('String lengths must match!' ) __A : Optional[Any] = 0 ...
8
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) SCREAMING_SNAKE_CASE__ : Optional[int] = {"configuration_encoder_decoder": ["EncoderDecoderConfig"]} try: ...
85
'''simple docstring''' import argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() lowercase__ : Tup...
8
0
import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def __snake_case ( __UpperCamelCase : Optional[int] ): """simple docstring""" if "img_encoder.pos_embed" in name: A_ ...
86
'''simple docstring''' import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings l...
8
0
# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won't be considered # since...
87
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : List[Any] = logging.get_logger(__name__) lowercase__ : Optional[int] = { '''unc-nlp/lxmert-base-uncased''': '''https://huggingf...
8
0
"""simple docstring""" import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class lowercase__ ( unittest.TestCase ): __Up...
88
'''simple docstring''' import math import sys def _lowerCAmelCase ( __snake_case : int ) -> int: if number != int(__snake_case ): raise ValueError('the value of input must be a natural number' ) if number < 0: raise ValueE...
8
0
from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_...
89
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( __snake_case : list[int] , __snake_case : list[int] , __snake_case : int ) -> tuple[float, list[float]]: __A : int = list(range(len(__snake...
8
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __UpperCAmelCase = { '''configuration_ctrl''': ['''CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CTRLConfig'''], ...
90
'''simple docstring''' from __future__ import annotations import math class SCREAMING_SNAKE_CASE : def __init__( self , _UpperCAmelCase): '''simple docstring''' __A : int = size # approximate the overall ...
8
0
"""simple docstring""" from queue import PriorityQueue from typing import Any import numpy as np def _snake_case ( snake_case__ : dict , snake_case__ : str , snake_case__ : set , snake_case__ : set , snake_case__ : dict , snake_case__ : dict , snake_case...
91
'''simple docstring''' def _lowerCAmelCase ( __snake_case : int , __snake_case : int , __snake_case : int ) -> float: __A : Dict = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of s...
8
0
'''simple docstring''' def _lowerCAmelCase ( __magic_name__ : float , __magic_name__ : float ) -> float: if mass < 0: raise ValueError('''The mass of a body cannot be negative''' ) return 0.5 * mass * abs(__magic_name__ ) * abs(__magic_name__...
92
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeli...
8
0
"""simple docstring""" import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class _lowerCAmelCase ( unittest.T...
93
'''simple docstring''' import argparse import os import re lowercase__ : Optional[int] = '''src/diffusers''' # Pattern that looks at the indentation in a line. lowercase__ : Dict = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and pu...
8
0
'''simple docstring''' from queue import PriorityQueue from typing import Any import numpy as np def lowercase_ ( __A : dict , __A : str , __A : set , __A : set , __A : dict , __A : dict , __A : ...
94
'''simple docstring''' def _lowerCAmelCase ( __snake_case : int ) -> bool: return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('''Program to check whether a number is a Perfect number or ...
8
0
"""simple docstring""" import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_avai...
95
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() lowercase__ : Tuple = logging.get_logger(__name__) lowercase__ ...
8
0
"""simple docstring""" import requests __lowerCamelCase = '' # <-- Put your OpenWeatherMap appid here! __lowerCamelCase = 'https://api.openweathermap.org/data/2.5/' def a ( __UpperCAmelCase : str = "Chicago" , __UpperCAmelCase : str = AP...
96
'''simple docstring''' import mpmath # for roots of unity import numpy as np class SCREAMING_SNAKE_CASE : def __init__( self , _UpperCAmelCase=None , _UpperCAmelCase=None): '''simple docstring''' __A : List[Any] ...
8
0
import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def a ( snake_case__: Dict , snake_case__: Any , snake_case__: Dict ): '''simple docstring''' lowercase_ = AutoConfig.from_pretrained(snake_case__ ) ...
97
'''simple docstring''' import inspect import unittest from transformers import YolosConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configura...
8
0
'''simple docstring''' import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename lowercase__ : str = 'http://w...
98
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_...
8
0
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTRACTOR_MAPPING, AutoConfig, AutoFeatureExtractor, WavaVecaConfig, WavaVecaFeatureExtractor, ) from transformers.testing_...
99
'''simple docstring''' import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS...
8
0
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_ten...
100
'''simple docstring''' import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def _lowerCAmelCase ( __snake_case : str , __snake_case : str , **__snake_case : List[Any] ) -> Any: __A : Optiona...
8
0
import csv from collections import defaultdict from dataclasses import dataclass, field from typing import List, Optional import matplotlib.pyplot as plt import numpy as np from matplotlib.ticker import ScalarFormatter from transformers import HfArgumentParser def a__ ( A__=None...
101
'''simple docstring''' from ...configuration_utils import PretrainedConfig lowercase__ : Any = { '''google/tapas-base-finetuned-sqa''': ( '''https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json''' ), '''google/tapas-base-fi...
8
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __magic_name__ : str = logging.get_logger(__name__) __magic_name__ : Union[str, Any] = { """RWKV/rwkv-4-169m-pile""": """https://huggingface.co/RWKV/rw...
102
'''simple docstring''' 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 SCREAMING_SNAKE_CASE : def __init_...
8
0
"""simple docstring""" from __future__ import annotations import time snake_case = list[tuple[int, int]] snake_case = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, ...
103
'''simple docstring''' def _lowerCAmelCase ( __snake_case : Optional[Any] ) -> Optional[Any]: # noqa: E741 __A : Tuple = len(__snake_case ) __A : Optional[int] = 0 __A : str = [0] * n __A : int = [Fals...
8
0
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer UpperCamelCase = {"""vocab_file""": """vocab.txt"...
104
'''simple docstring''' import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create s...
8
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCamelCase__ : str = logging.get_logger(__name__) UpperCamelCase__ : str = { '''ut/deta''': '''https://huggingface.co/ut/deta/resolve/main/config.json...
105
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, Timeste...
8
0
import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, require_torch, slow fr...
106
'''simple docstring''' def _lowerCAmelCase ( __snake_case : str , __snake_case : str ) -> int: if len(__snake_case ) != len(__snake_case ): raise ValueError('String lengths must match!' ) __A : Optional[Any] = 0 ...
8
0
'''simple docstring''' from sklearn.metrics import fa_score import datasets _UpperCAmelCase : Dict = ''' The F1 score is the harmonic mean of the precision and recall. It can be computed with the equation: F1 = 2 * (precision * recall) / (precision + recall) ''' _UpperCAmelCase : ...
107
'''simple docstring''' import argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() lowercase__ : Tup...
8
0
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( __snake_case ) -> int: _UpperCAmelCase = len(__snake_case ) // 2 # choose the middle 3 elements _UpperCAmelCase = lst[m - 1 : m + 2] # if middle element is peak if three[1...
108
'''simple docstring''' import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings l...
8
0
'''simple docstring''' import re def __magic_name__ ( __UpperCAmelCase ) -> list: '''simple docstring''' return [char.split() for char in re.split(R"""[^ a-z A-Z 0-9 \s]""" , str_ )] def __magic_name__ ( __UpperCAmelCase ) -> str: '''s...
109
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : List[Any] = logging.get_logger(__name__) lowercase__ : Optional[int] = { '''unc-nlp/lxmert-base-uncased''': '''https://huggingf...
8
0
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline UpperCamelCase__ = logging.get_logger(__name__) # pylint: disable=invalid-name class a ( low...
110
'''simple docstring''' import math import sys def _lowerCAmelCase ( __snake_case : int ) -> int: if number != int(__snake_case ): raise ValueError('the value of input must be a natural number' ) if number < 0: raise ValueE...
8
0
_lowerCamelCase : str = 0 # The first color of the flag. _lowerCamelCase : List[Any] = 1 # The second color of the flag. _lowerCamelCase : str = 2 # The third color of the flag. _lowerCamelCase : List[str] = (red, white, blue) def SCREAM...
87
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( __snake_case : list[int] , __snake_case : list[int] , __snake_case : int ) -> tuple[float, list[float]]: __A : int = list(range(len(__snake...
8
0
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class lowercase_ ( a__ , a__ ): @register_to_config def __init__( self , *, __A = 4 , __A = 768 ...
443
'''simple docstring''' from __future__ import annotations import math class SCREAMING_SNAKE_CASE : def __init__( self , _UpperCAmelCase): '''simple docstring''' __A : int = size # approximate the overall ...
8
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase_ = {'''configuration_mbart...
625
'''simple docstring''' def _lowerCAmelCase ( __snake_case : int , __snake_case : int , __snake_case : int ) -> float: __A : Dict = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of s...
8
0
'''simple docstring''' import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, p...
334
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeli...
8
0
'''simple docstring''' from __future__ import annotations import queue class UpperCamelCase__ : def __init__( self : str , lowerCamelCase : List[str] ): '''simple docstring''' a__ = data a__ = None a__ = None ...
489
'''simple docstring''' import argparse import os import re lowercase__ : Optional[int] = '''src/diffusers''' # Pattern that looks at the indentation in a line. lowercase__ : Dict = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and pu...
8
0
'''simple docstring''' import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import Pad...
330
'''simple docstring''' def _lowerCAmelCase ( __snake_case : int ) -> bool: return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('''Program to check whether a number is a Perfect number or ...
8
0
def A ( _SCREAMING_SNAKE_CASE ) -> Optional[int]: lowerCamelCase : List[str] = 0 lowerCamelCase : Optional[int] = len(__snake_case ) for i in range(n - 1 ): for j in range(i + 1 ,__snake_case ): ...
311
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() lowercase__ : Tuple = logging.get_logger(__name__) lowercase__ ...
8
0
import re from ..models.auto import AutoProcessor from ..models.vision_encoder_decoder import VisionEncoderDecoderModel from ..utils import is_vision_available from .base import PipelineTool if is_vision_available(): from PIL import Image class _A ( a__ ): _UpperCamelCase : Option...
217
'''simple docstring''' import mpmath # for roots of unity import numpy as np class SCREAMING_SNAKE_CASE : def __init__( self , _UpperCAmelCase=None , _UpperCAmelCase=None): '''simple docstring''' __A : List[Any] ...
8
0
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil snake_case_ : str = 100 snake_case_ : Tuple = set(range(3, NUM_PRIMES, 2)) primes.add(2) snake_case_ : int for prime in range(3, ceil(NUM_PRIMES**0.5), 2): if pri...
212
'''simple docstring''' import inspect import unittest from transformers import YolosConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configura...
8
0
'''simple docstring''' import importlib.metadata from typing import Union from packaging.version import Version, parse from .constants import STR_OPERATION_TO_FUNC a_ : Any = parse(importlib.metadata.version("""torch""")) def a_ ( __snake_case : Union[str, Version] , __snake_c...
676
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_...
8
0
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowercase__ ( a__): UpperCamelCase_ = ["""image_processor""", """tokenizer"""] UpperCamelCase_ = """CLIPImageProcessor""" UpperCamelCase_ = ("...
248
'''simple docstring''' import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS...
8
0
import dataclasses import json import warnings from dataclasses import dataclass, field from time import time from typing import List from ..utils import logging _lowerCamelCase : Union[str, Any] = logging.get_logger(__name__) def SCREAMING_SNAKE_CASE ( lowercase_=None , ...
87
'''simple docstring''' import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def _lowerCAmelCase ( __snake_case : str , __snake_case : str , **__snake_case : List[Any] ) -> Any: __A : Optiona...
8
0
import argparse import os import re import zipfile import torch from transformers import AutoTokenizer, GPTaConfig def SCREAMING_SNAKE_CASE_ ( UpperCAmelCase_ : Dict , UpperCAmelCase_ : Any , UpperCAmelCase_ : Tuple=0 ) -> Any: # Format the message. ...
443
'''simple docstring''' from ...configuration_utils import PretrainedConfig lowercase__ : Any = { '''google/tapas-base-finetuned-sqa''': ( '''https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json''' ), '''google/tapas-base-fi...
8
0
def _UpperCAmelCase ( A = 50 ): '''simple docstring''' UpperCAmelCase__ =[1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length + 1 ): ...
625
'''simple docstring''' 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 SCREAMING_SNAKE_CASE : def __init_...
8
0
'''simple docstring''' class __UpperCamelCase : def __init__( self :List[Any] ): snake_case_ : Union[str, Any] = {} def a__ ( self :List[Any] ): print(self.vertex ) for i in self.vertex: print(_UpperCAm...
334
'''simple docstring''' def _lowerCAmelCase ( __snake_case : Optional[Any] ) -> Optional[Any]: # noqa: E741 __A : Tuple = len(__snake_case ) __A : Optional[int] = 0 __A : str = [0] * n __A : int = [Fals...
8
0
'''simple docstring''' import sys lowerCAmelCase_ : int = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''12540698747158523863050715693290963295...
489
'''simple docstring''' import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create s...
8
0
'''simple docstring''' def __lowercase ( __lowercase , __lowercase , __lowercase , __lowercase ) -> int: '''simple docstring''' _A = len(__snake_case ), len(grid[0] ) if ( min(__snake_case , __snake_case ) < 0 or row == row...
330
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, Timeste...
8
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE__ : Union[str, Any] = { '''configuration_blip_2''': [ '''BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Blip2Config''', '''Blip2...
311
'''simple docstring''' def _lowerCAmelCase ( __snake_case : str , __snake_case : str ) -> int: if len(__snake_case ) != len(__snake_case ): raise ValueError('String lengths must match!' ) __A : Optional[Any] = 0 ...
8
0
import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": lowerCAmelCase_ = argparse.ArgumentParser( description=( 'Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned' ' Distillat...
217
'''simple docstring''' import argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() lowercase__ : Tup...
8
0
'''simple docstring''' def __snake_case ( _UpperCAmelCase : Dict): UpperCamelCase = [0] * len(__snake_case) UpperCamelCase = [] UpperCamelCase = [1] * len(__snake_case) for values in graph.values(): for i in values: indegree[i] += 1 for i in rang...
212
'''simple docstring''' import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings l...
8
0
'''simple docstring''' import pytest from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs @pytest.mark.parametrize( '''kwargs, expected''' , [ ({'''num_shards''': 0, '''max_num_jobs''': 1}, []), ({'''num_shards''': 10, '''max_nu...
676
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : List[Any] = logging.get_logger(__name__) lowercase__ : Optional[int] = { '''unc-nlp/lxmert-base-uncased''': '''https://huggingf...
8
0
import argparse import json from collections import OrderedDict from functools import partial from pathlib import Path import timm import torch from huggingface_hub import hf_hub_download from transformers import LevitConfig, LevitForImageClassificationWithTeacher, LevitImageProcessor from transformers.uti...
248
'''simple docstring''' import math import sys def _lowerCAmelCase ( __snake_case : int ) -> int: if number != int(__snake_case ): raise ValueError('the value of input must be a natural number' ) if number < 0: raise ValueE...
8
0
import torch from diffusers import DiffusionPipeline class UpperCamelCase_ ( a__ ): '''simple docstring''' def __init__( self : Optional[Any] , UpperCAmelCase__ : List[str] , UpperCAmelCase__ : int) ->str: '''simple docstring''' ...
87
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( __snake_case : list[int] , __snake_case : list[int] , __snake_case : int ) -> tuple[float, list[float]]: __A : int = list(range(len(__snake...
8
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase = { '''configuration_pegasus_x''': ['''PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''PegasusXConfig'''], } try: if not is_torch_available(): raise Option...
443
'''simple docstring''' from __future__ import annotations import math class SCREAMING_SNAKE_CASE : def __init__( self , _UpperCAmelCase): '''simple docstring''' __A : int = size # approximate the overall ...
8
0
from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean UpperCamelCase_ = 0 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], ...
625
'''simple docstring''' def _lowerCAmelCase ( __snake_case : int , __snake_case : int , __snake_case : int ) -> float: __A : Dict = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of s...
8
0
'''simple docstring''' import numpy as np import datasets __A : Optional[int] = ''' Compute the Mahalanobis Distance Mahalonobis distance is the distance between a point and a distribution. And not between two distinct points. It is effectively a multivariate equivalent of the Euclidean distanc...
334
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeli...
8
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase_ : int = { '''configuration_mega''': ['''MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MegaConfig''', '''Mega...
489
'''simple docstring''' import argparse import os import re lowercase__ : Optional[int] = '''src/diffusers''' # Pattern that looks at the indentation in a line. lowercase__ : Dict = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and pu...
8
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCamelCase_ = { '''configuration_resnet''': ['''RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP''',...
330
'''simple docstring''' def _lowerCAmelCase ( __snake_case : int ) -> bool: return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('''Program to check whether a number is a Perfect number or ...
8
0
import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def A ( _SCREAMING_SNAKE_CASE ) -> int: lowerCamelCase : Union[str, Any] = SwinConfig(image_size=192 ) ...
311
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() lowercase__ : Tuple = logging.get_logger(__name__) lowercase__ ...
8
0
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() ...
217
'''simple docstring''' import mpmath # for roots of unity import numpy as np class SCREAMING_SNAKE_CASE : def __init__( self , _UpperCAmelCase=None , _UpperCAmelCase=None): '''simple docstring''' __A : List[Any] ...
8
0
'''simple docstring''' import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class lowercase__ ( a__, ...
212
'''simple docstring''' import inspect import unittest from transformers import YolosConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configura...
8
0
'''simple docstring''' import re from flax.core.frozen_dict import freeze from flax.traverse_util import flatten_dict, unflatten_dict from jax.experimental import PartitionSpec as P # Sentinels a_ : List[str] = object() # For specifying empty leaf dict `{}` a_ : str = object() de...
676
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_...
8
0
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowercase__ ( a__): UpperCamelCase_ = ["""image_processor""", """tokenizer"""] UpperCamelCase_ = """AutoImageProcessor""" UpperCamelCase_ = """AutoTokenizer""" ...
248
'''simple docstring''' import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS...
8
0
def SCREAMING_SNAKE_CASE ( lowercase_ = 10 ) -> str: """simple docstring""" if not isinstance(__snake_case , __snake_case ) or n < 0: raise ValueError('''Invalid input''' ) A__ = 10**n A__ = 28_433 * (pow(2 , 7_83...
87
'''simple docstring''' import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def _lowerCAmelCase ( __snake_case : str , __snake_case : str , **__snake_case : List[Any] ) -> Any: __A : Optiona...
8
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase = logging.get_logger(__name__) _lowercase = { '''microsoft/trocr-base-handwritten''': ( '''https://huggingface.co/microsoft/trocr-base-handwritten/resolve/main/config.json''' ...
443
'''simple docstring''' from ...configuration_utils import PretrainedConfig lowercase__ : Any = { '''google/tapas-base-finetuned-sqa''': ( '''https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json''' ), '''google/tapas-base-fi...
8
0
import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCLIPTextConfig, XCLIPVision...
625
'''simple docstring''' 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 SCREAMING_SNAKE_CASE : def __init_...
8
0
'''simple docstring''' import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transformers.testing_uti...
334
'''simple docstring''' def _lowerCAmelCase ( __snake_case : Optional[Any] ) -> Optional[Any]: # noqa: E741 __A : Tuple = len(__snake_case ) __A : Optional[int] = 0 __A : str = [0] * n __A : int = [Fals...
8
0
'''simple docstring''' import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.trans...
489
'''simple docstring''' import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create s...
8
0
'''simple docstring''' import math import sys def __lowercase ( __lowercase ) -> int: '''simple docstring''' if number != int(__snake_case ): raise ValueError("the value of input must be a natural number" ) if number < 0: raise ValueError("the va...
330
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, Timeste...
8
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available SCREAMING_SNAKE_CASE__ : int = { '''configuration_m2m_100''': ['''M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''M2M100Config''', '''M2M100OnnxConfig'...
311
'''simple docstring''' def _lowerCAmelCase ( __snake_case : str , __snake_case : str ) -> int: if len(__snake_case ) != len(__snake_case ): raise ValueError('String lengths must match!' ) __A : Optional[Any] = 0 ...
8
0
import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class _A ( unittest.TestCase ): def __a ...
217
'''simple docstring''' import argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() lowercase__ : Tup...
8
0
'''simple docstring''' from math import sqrt def __snake_case ( _UpperCAmelCase : int): assert isinstance(__snake_case, __snake_case) and ( number >= 0 ), "'number' must been an int and positive" UpperCamelCase = True # 0 and 1 are none primes. if nu...
212
'''simple docstring''' import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings l...
8
0
'''simple docstring''' import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( Alber...
676
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ : List[Any] = logging.get_logger(__name__) lowercase__ : Optional[int] = { '''unc-nlp/lxmert-base-uncased''': '''https://huggingf...
8
0
from __future__ import annotations from collections.abc import Sequence from typing import Literal def A ( _lowercase , _lowercase ): SCREAMING_SNAKE_CASE : Optional[int] = list(__snake_case ) SCREAMING_SNAKE_CASE : int = list(__snak...
248
'''simple docstring''' import math import sys def _lowerCAmelCase ( __snake_case : int ) -> int: if number != int(__snake_case ): raise ValueError('the value of input must be a natural number' ) if number < 0: raise ValueE...
8
0
def SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ ) -> Union[str, Any]: """simple docstring""" _enforce_args(__snake_case , __snake_case ) if n == 0: return 0 A__ = float('''-inf''' ) for i in range(1 , n +...
87
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( __snake_case : list[int] , __snake_case : list[int] , __snake_case : int ) -> tuple[float, list[float]]: __A : int = list(range(len(__snake...
8
0
from PIL import Image def SCREAMING_SNAKE_CASE_ ( UpperCAmelCase_ : Image , UpperCAmelCase_ : float ) -> Image: def brightness(UpperCAmelCase_ : int ) -> float: return 1_2_8 + level + (c - 1_2_8) if not -255.0 <= level <= 255.0: ...
443
'''simple docstring''' from __future__ import annotations import math class SCREAMING_SNAKE_CASE : def __init__( self , _UpperCAmelCase): '''simple docstring''' __A : int = size # approximate the overall ...
8
0
import argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() UpperCamelCase_ = logging.get_logger(__name_...
625
'''simple docstring''' def _lowerCAmelCase ( __snake_case : int , __snake_case : int , __snake_case : int ) -> float: __A : Dict = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of s...
8
0
'''simple docstring''' import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class __UpperCamelCase ( unittest.TestCase ): def a__ ( self :int ): snake_case_ : Dict ...
334
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeli...
8
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase_ : str = { '''config...
489
'''simple docstring''' import argparse import os import re lowercase__ : Optional[int] = '''src/diffusers''' # Pattern that looks at the indentation in a line. lowercase__ : Dict = re.compile(r'''^(\s*)\S''') # Pattern that matches `"key":" and pu...
8
0
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDepen...
330
'''simple docstring''' def _lowerCAmelCase ( __snake_case : int ) -> bool: return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('''Program to check whether a number is a Perfect number or ...
8
0