code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging _a = logging.get_logger(__name__) _a ...
61
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : list , __lowerCamelCase : int = 0 ) -> list: _snake_case = length or len(__lowerCamelCase ) _snake_case = False for i in range(length - 1 ): if list_data[i] > lis...
288
0
from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration _A = HfArgumentParser(InitializationArguments) _A = parser.parse_args() # Load codeparrot tokenizer trained for Python code tokenizati...
62
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformer...
288
0
'''simple docstring''' def _lowerCamelCase ( lowercase : str ) -> list: if n_term == "": return [] _a = [] for temp in range(int(lowercase ) ): series.append(F'1/{temp + 1}' if series else "1" ) return series if __name__ == "__main_...
63
"""simple docstring""" import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStruct...
288
0
"""simple docstring""" import math def UpperCAmelCase__ (snake_case__ : int = 1_00 ): """simple docstring""" _snake_case : str = sum(i * i for i in range(1 , n + 1 ) ) _snake_case : Tuple = int(math.pow(sum(range(1 , n + 1 ...
64
"""simple docstring""" from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class lowerCAmelCase__ ( A_ ): def __lt__( self : Any , _lowerCamelCase : int ...
288
0
from manim import * class A ( UpperCAmelCase_ ): def lowercase_ (self : List[Any] ) -> List[Any]: """simple docstring""" UpperCAmelCase__ = Rectangle(height=0.5 , width=0.5 ) UpperCAmelCase__ = Rec...
65
"""simple docstring""" UpperCAmelCase__ = { 'Pillow': 'Pillow', 'accelerate': 'accelerate>=0.11.0', 'compel': 'compel==0.1.8', 'black': 'black~=23.1', 'datasets': 'datasets', 'filelock': 'filelock', 'flax': 'flax>=0.4.1', 'hf-doc-builder': 'hf-doc-builder>=0.3.0...
288
0
"""simple docstring""" from jiwer import compute_measures import datasets __a = "\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From WER and RIL to MER and WIL: improved evaluation ...
66
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_availa...
288
0
'''simple docstring''' from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class a__ ( UpperCAmelCase__ ): lowerCamelCase : Dict ="EncodecFeatureExtractor" lowerCamelCase : List[str] =("T5T...
67
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is truly tiny - # ...
288
0
# coding=utf-8 # Copyright 2020 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/licenses/LICENSE-2.0 # # Unless required by applicab...
68
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : int = 1_00_00_00 ) -> int: _snake_case = limit + 1 _snake_case = [0] * limit for first_term in range(1 , __lowerCamelCase ): for n in range(__lowerCamelCase , __lowerC...
288
0
"""simple docstring""" import qiskit def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> qiskit.result.counts.Counts: snake_case_ = qiskit.Aer.get_backend('aer_simulator' ) # Create a Quantum Circuit acting on the q register snake_case_ ...
69
"""simple docstring""" import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def _UpperCAmelCase ( __lowerCamelCase : int = 3 ) -> qiskit.result.counts.Counts: if isinstance(__lowerCamelCase , __l...
288
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule A__ : Tuple ={'''tokenization_bertweet''': ['''BertweetTokenizer''']} if TYPE_CHECKING: from .tokenization_bertweet import BertweetTokenizer else: import sys ...
70
"""simple docstring""" import argparse import os from pathlib import Path import fairseq import torch from packaging import version from torch import nn from transformers import ( BartConfig, BartForConditionalGeneration, BartForSequenceClassification, BartModel, BartTokeniz...
288
0
from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelerate.t...
71
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : Tuple ) -> Any: stooge(__lowerCamelCase , 0 , len(__lowerCamelCase ) - 1 ) return arr def _UpperCAmelCase ( __lowerCamelCase : str , __lowerCamelCase : List[str] , __low...
288
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase__ = { '''configuration_pegasus_x''': ['''PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''PegasusXConfig'''], } try: if not is_torch_av...
72
"""simple docstring""" # Logistic Regression from scratch # In[62]: # In[63]: # importing all the required libraries import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def _UpperCAmelCase ( __lowerCamelCase : str ) -> List[Any]: ret...
288
0
from scipy.stats import spearmanr import datasets a =""" The Spearman rank-order correlation coefficient is a measure of the relationship between two datasets. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Positive correlations imply that as data in ...
73
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) UpperCAmelCase__ ...
288
0
"""simple docstring""" 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__": _lowercase = '''%20'''.join(argv[1:]) if len(argv) > 1 else quote(str(input('''Search: '...
74
"""simple docstring""" from math import pow def _UpperCAmelCase ( __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : int , ) -> tuple[int, int]: if current_sum =...
288
0
'''simple docstring''' import sys a_ : Tuple = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043...
75
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import requ...
288
0
import json import os import tempfile import unittest import numpy as np from datasets import load_dataset 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 ImageProcessingSav...
76
"""simple docstring""" import os import time import numpy as np import onnxruntime as ort UpperCAmelCase__ = '1' UpperCAmelCase__ = '0' UpperCAmelCase__ = '1' UpperCAmelCase__ = ort.SessionOptions() UpperCAmelCase__ = ort.GraphOptimizationLevel.ORT_D...
288
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available _UpperCamelCase : int = { "configuration_longt5": ["LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP", "LongT5Config", "LongT5OnnxConfig"], } tr...
77
"""simple docstring""" import logging from transformers.configuration_utils import PretrainedConfig UpperCAmelCase__ = logging.getLogger(__name__) class lowerCAmelCase__ ( A_ ): __a = """masked_bert""" def __init__( self : Union[str...
288
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case_ = logging.get_logger(__name__) snake_case_ = {} class A_ ( SCREAMING_SNAKE_CASE_ ): """simple docstring""" ...
78
"""simple docstring""" import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from dataset...
288
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) lowerCamelCase_ = { '''configuration_convnext''': ['''CONVNEXT_PRETRAINED_CONFIG_AR...
79
"""simple docstring""" from math import sqrt def _UpperCAmelCase ( __lowerCamelCase : int = 1_00_00_00 ) -> int: _snake_case = 0 _snake_case = 0 _snake_case = 42 while num_cuboids <= limit: max_cuboid_size += 1 for...
288
0
'''simple docstring''' import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def _UpperCamelCase ( __A ) -> List[str]: '''simple docstring''' UpperCamelCase__ = os.path.join(arg...
80
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.ut...
288
0
"""simple docstring""" import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def _A ( ): """simple docstring""" a =ArgumentParser( description=( ...
81
"""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 UpperCAmelCase__ = '...
288
0
import math import tensorflow as tf from packaging import version def _UpperCAmelCase ( snake_case ): """simple docstring""" _lowerCAmelCase = tf.convert_to_tensor(snake_case ) _lowerCAmelCase = 0.5 * (1.0 + tf.math.erf(x / tf.cast(tf.sqrt(2.0 ) , x.dtype...
82
"""simple docstring""" import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": UpperCAmelCase__ = argparse.ArgumentParser( description=( 'Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned'...
288
0
'''simple docstring''' import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelT...
83
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : list , __lowerCamelCase : int = 0 ) -> list: _snake_case = length or len(__lowerCamelCase ) _snake_case = False for i in range(length - 1 ): if list_data[i] > lis...
288
0
"""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 impor...
84
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformer...
288
0
'''simple docstring''' import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNet...
85
"""simple docstring""" import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStruct...
288
0
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils...
86
"""simple docstring""" from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class lowerCAmelCase__ ( A_ ): def __lt__( self : Any , _lowerCamelCase : int ...
288
0
import argparse import os import re UpperCamelCase = '''src/transformers''' # 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*"...
87
"""simple docstring""" UpperCAmelCase__ = { 'Pillow': 'Pillow', 'accelerate': 'accelerate>=0.11.0', 'compel': 'compel==0.1.8', 'black': 'black~=23.1', 'datasets': 'datasets', 'filelock': 'filelock', 'flax': 'flax>=0.4.1', 'hf-doc-builder': 'hf-doc-builder>=0.3.0...
288
0
def a__ ( A_, A_ ): '''simple docstring''' if a < 0 or b < 0: raise ValueError("""the value of both inputs must be positive""" ) __magic_name__ = str(bin(A_ ) )[2:] # remove the leading "0b" __magic_name__ = str(bin(A_ ...
88
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_availa...
288
0
'''simple docstring''' from maths.prime_check import is_prime def __lowerCamelCase ( lowerCAmelCase_ ) -> int: if not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): _a : List[str] = f"""Input value of [number={number}] must be an integer""" raise Ty...
89
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is truly tiny - # ...
288
0
from math import ceil, sqrt def lowerCamelCase_ ( UpperCamelCase__ : int = 100_0000 ) -> int: """simple docstring""" __lowerCamelCase = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width*...
90
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : int = 1_00_00_00 ) -> int: _snake_case = limit + 1 _snake_case = [0] * limit for first_term in range(1 , __lowerCamelCase ): for n in range(__lowerCamelCase , __lowerC...
288
0
"""simple docstring""" import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor UpperCAmelCase_ : Optional[Any] = logging.getLogger(__name__) U...
91
"""simple docstring""" import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def _UpperCAmelCase ( __lowerCamelCase : int = 3 ) -> qiskit.result.counts.Counts: if isinstance(__lowerCamelCase , __l...
288
0
UpperCamelCase__ = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] UpperCamelCase__ = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] UpperCamelCase__ = { 0: """Sunday""", 1: """Monday""", 2: """Tuesday""", 3: """Wednesday""", 4: """Thursday""", 5: """Friday""", 6: """Saturday""", } ...
92
"""simple docstring""" import argparse import os from pathlib import Path import fairseq import torch from packaging import version from torch import nn from transformers import ( BartConfig, BartForConditionalGeneration, BartForSequenceClassification, BartModel, BartTokeniz...
288
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _lowercase : List[Any] = {"configuration_reformer": [...
93
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : Tuple ) -> Any: stooge(__lowerCamelCase , 0 , len(__lowerCamelCase ) - 1 ) return arr def _UpperCAmelCase ( __lowerCamelCase : str , __lowerCamelCase : List[str] , __low...
288
0
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class _snake_case : SCREAMING_SNAKE_CASE__ = None SCREAMING_SNAKE_CASE__ = False SCREAMING_SNAKE_CASE__ = False SCREAMING_SNAKE_CASE__ = ...
94
"""simple docstring""" # Logistic Regression from scratch # In[62]: # In[63]: # importing all the required libraries import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def _UpperCAmelCase ( __lowerCamelCase : str ) -> List[Any]: ret...
288
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer UpperCAmelCase : Optional[Any] = {"""vocab_file""": """vocab.txt""", """tokenizer...
95
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) UpperCAmelCase__ ...
288
0
"""simple docstring""" import string import numpy def _snake_case ( lowercase__ , lowercase__ ): return b if a == 0 else greatest_common_divisor(b % a , lowercase__ ) class lowerCAmelCase__ : '''simple docstring''' ...
96
"""simple docstring""" from math import pow def _UpperCAmelCase ( __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : int , ) -> tuple[int, int]: if current_sum =...
288
0
'''simple docstring''' from datetime import datetime import matplotlib.pyplot as plt import torch def a ( __a ) -> int: '''simple docstring''' for param in module.parameters(): UpperCamelCase__ :Dict = False def a ( ) -> Union[str, Any]: ...
97
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import requ...
288
0
"""simple docstring""" import os def a_ ( ): UpperCAmelCase__ = os.path.dirname(os.path.realpath(lowerCamelCase ) ) UpperCAmelCase__ = os.path.join(lowerCamelCase , 'triangle.txt' ) with open(lowerCamelCase ) as f: ...
98
"""simple docstring""" import os import time import numpy as np import onnxruntime as ort UpperCAmelCase__ = '1' UpperCAmelCase__ = '0' UpperCAmelCase__ = '1' UpperCAmelCase__ = ort.SessionOptions() UpperCAmelCase__ = ort.GraphOptimizationLevel.ORT_D...
288
0
import tempfile import unittest from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from transformers.testing_utils import ( is_torch_available, require_optimum, require_torch, slow, ) if is_torch_available(): import torch @require_torch @require_optimum @slow class A__ (...
99
"""simple docstring""" import logging from transformers.configuration_utils import PretrainedConfig UpperCAmelCase__ = logging.getLogger(__name__) class lowerCAmelCase__ ( A_ ): __a = """masked_bert""" def __init__( self : Union[str...
288
0
"""simple docstring""" import os import sys import unittest __magic_name__ = 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_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_o...
100
"""simple docstring""" import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from dataset...
288
0
from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def UpperCamelCase ( lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ , ): '''simple docstring''' lowercase , lowercase = coeff...
101
"""simple docstring""" from math import sqrt def _UpperCAmelCase ( __lowerCamelCase : int = 1_00_00_00 ) -> int: _snake_case = 0 _snake_case = 0 _snake_case = 42 while num_cuboids <= limit: max_cuboid_size += 1 for...
288
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available SCREAMING_SNAKE_CASE : Optional[Any] = { """configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""], } try: if not is_torch...
102
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.ut...
288
0
from collections.abc import Callable import numpy as np def UpperCamelCase( __UpperCamelCase : Callable ,__UpperCamelCase : float ,__UpperCamelCase : float ,__UpperCamelCase : float ,__UpperCamelCase : float ): lowerCAmelCase_ : Optional[int] ...
103
"""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 UpperCAmelCase__ = '...
288
0
'''simple docstring''' from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=lowerCamelCase__ ) class lowercase_ (lowerCamelCase__ ): """simple docstring""" SCREAMING_SNAK...
104
"""simple docstring""" import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": UpperCAmelCase__ = argparse.ArgumentParser( description=( 'Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned'...
288
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( _lowercase : str ) ->str: '''simple docstring''' return " ".join( "".join(word[::-1] ) if len(_lowercase ) > 4 else word for word in sentence.split() ) if __name__ == "__main__":...
105
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : list , __lowerCamelCase : int = 0 ) -> list: _snake_case = length or len(__lowerCamelCase ) _snake_case = False for i in range(length - 1 ): if list_data[i] > lis...
288
0
"""simple docstring""" 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 : Tuple = '''%20'''.join(argv[1:]) if len(argv) > 1 els...
106
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformer...
288
0
from datetime import datetime import requests def __magic_name__ ( A : str ): '''simple docstring''' a = "https://downloadgram.net/wp-json/wppress/video-downloader/video?url=" a = requests.get(base_url + url ).json()[0]["urls"][0]["src"] return requests.get(A ...
107
"""simple docstring""" import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStruct...
288
0
"""simple docstring""" import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def a__ ( SCREAMING_SNAKE_CASE : Optional[Any] ...
108
"""simple docstring""" from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class lowerCAmelCase__ ( A_ ): def __lt__( self : Any , _lowerCamelCase : int ...
288
0
"""simple docstring""" import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def _snake_case ( UpperCamelCase : List[str] , UpperCamelCase : str=None ): UpperCAmelCase : Optional[Any] =...
109
"""simple docstring""" UpperCAmelCase__ = { 'Pillow': 'Pillow', 'accelerate': 'accelerate>=0.11.0', 'compel': 'compel==0.1.8', 'black': 'black~=23.1', 'datasets': 'datasets', 'filelock': 'filelock', 'flax': 'flax>=0.4.1', 'hf-doc-builder': 'hf-doc-builder>=0.3.0...
288
0
import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets _A = "\\n@inproceedings{popovic-2015-chrf,\n title = \"chr{F}: character n-gram {F}-score for automatic {MT} evaluation\",\n author = \"Popovi{\'c}, Maja\",\n booktitle = \"Proceedings of the Tenth Worksh...
231
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_availa...
288
0
"""simple docstring""" import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class _UpperCamelCase ( A_ ): '''simple docstrin...
57
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is truly tiny - # ...
288
0
'''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_ = logging.get_logger(__name__...
139
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : int = 1_00_00_00 ) -> int: _snake_case = limit + 1 _snake_case = [0] * limit for first_term in range(1 , __lowerCamelCase ): for n in range(__lowerCamelCase , __lowerC...
288
0
import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def A (__A : Optional[int] ) -> str: """simple docstring""" if "img_encoder.pos_embed" in name: ...
51
"""simple docstring""" import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def _UpperCAmelCase ( __lowerCamelCase : int = 3 ) -> qiskit.result.counts.Counts: if isinstance(__lowerCamelCase , __l...
288
0
import json from typing import 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_roberta import RobertaTokenizer ...
236
"""simple docstring""" import argparse import os from pathlib import Path import fairseq import torch from packaging import version from torch import nn from transformers import ( BartConfig, BartForConditionalGeneration, BartForSequenceClassification, BartModel, BartTokeniz...
288
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule lowerCamelCase : List[Any] = {"tokenization_bertweet": ["BertweetTokenizer"]} if TYPE_CHECKING: from .tokenization_bertweet import BertweetTokenizer else: import sys lowerCamelCase : Tuple...
47
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : Tuple ) -> Any: stooge(__lowerCamelCase , 0 , len(__lowerCamelCase ) - 1 ) return arr def _UpperCAmelCase ( __lowerCamelCase : str , __lowerCamelCase : List[str] , __low...
288
0
from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. lowerCamelCase__ = 10 def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCR...
212
"""simple docstring""" # Logistic Regression from scratch # In[62]: # In[63]: # importing all the required libraries import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def _UpperCAmelCase ( __lowerCamelCase : str ) -> List[Any]: ret...
288
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils import loggi...
132
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) UpperCAmelCase__ ...
288
0
'''simple docstring''' import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformer...
55
"""simple docstring""" from math import pow def _UpperCAmelCase ( __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : int , ) -> tuple[int, int]: if current_sum =...
288
0
'''simple docstring''' from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _conc...
34
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import requ...
288
0
'''simple docstring''' from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class __A ( A_ ): def __lt__(self : Any , __a : int ): return self[-1] < other[-1] def __e...
1
"""simple docstring""" import os import time import numpy as np import onnxruntime as ort UpperCAmelCase__ = '1' UpperCAmelCase__ = '0' UpperCAmelCase__ = '1' UpperCAmelCase__ = ort.SessionOptions() UpperCAmelCase__ = ort.GraphOptimizationLevel.ORT_D...
288
0
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def lowerCamelCase__ ( __lowerCAmelCase : Optional[int] ): """simple docstring""" lowerCAmelCase_ = os.path.join(args.tf_model_dir , "paramete...
231
"""simple docstring""" import logging from transformers.configuration_utils import PretrainedConfig UpperCAmelCase__ = logging.getLogger(__name__) class lowerCAmelCase__ ( A_ ): __a = """masked_bert""" def __init__( self : Union[str...
288
0
"""simple docstring""" from __future__ import annotations def _lowerCamelCase ( _UpperCamelCase , _UpperCamelCase ): '''simple docstring''' if len(__lowerCamelCase ) <= 1 or n <= 1: return insert_next(__lowerCamelCase , n - 1 ) rec_insertion_sort(__lowerCamelCase ...
57
"""simple docstring""" import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from dataset...
288
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A_ = {"configuration_encoder_decoder": ["EncoderDecoderConfig"]} try: if not i...
139
"""simple docstring""" from math import sqrt def _UpperCAmelCase ( __lowerCamelCase : int = 1_00_00_00 ) -> int: _snake_case = 0 _snake_case = 0 _snake_case = 42 while num_cuboids <= limit: max_cuboid_size += 1 for...
288
0
import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, BertTokenizer, B...
51
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.ut...
288
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Dict = logging.get_logger(__name__) _UpperCAmelCase : Optional[int] = { "microsoft/git-base": "https://huggingface.co/microsoft/git-base/resolve/main/con...
236
"""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 UpperCAmelCase__ = '...
288
0
'''simple docstring''' import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, AdamW, ...
47
"""simple docstring""" import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": UpperCAmelCase__ = argparse.ArgumentParser( description=( 'Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned'...
288
0
import warnings from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature f...
212
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : list , __lowerCamelCase : int = 0 ) -> list: _snake_case = length or len(__lowerCamelCase ) _snake_case = False for i in range(length - 1 ): if list_data[i] > lis...
288
0
"""simple docstring""" def _lowercase ( __lowerCAmelCase ) -> Any: stooge(__lowerCamelCase , 0 , len(__lowerCamelCase ) - 1 ) return arr def _lowercase ( __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ) -> int:...
132
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformer...
288
0
'''simple docstring''' def __snake_case ( UpperCAmelCase_ : str , UpperCAmelCase_ : str ): lowerCamelCase_ = len(__lowerCamelCase ) lowerCamelCase_ = [] for i in range(len(__lowerCamelCase ) - pat_len + 1 ): lowerCamelCase_ = True for j in r...
55
"""simple docstring""" import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStruct...
288
0
'''simple docstring''' import os import unittest from transformers import MobileBertTokenizer, MobileBertTokenizerFast from transformers.models.bert.tokenization_bert import ( VOCAB_FILES_NAMES, BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from...
34
"""simple docstring""" from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class lowerCAmelCase__ ( A_ ): def __lt__( self : Any , _lowerCamelCase : int ...
288
0
'''simple docstring''' from __future__ import annotations def lowerCAmelCase_ ( snake_case_ : list[int] , snake_case_ : int ) -> list[int]: '''simple docstring''' UpperCAmelCase_ = 0 UpperCAmelCase_ = len(__lowerCamelCase ) - ...
1
"""simple docstring""" UpperCAmelCase__ = { 'Pillow': 'Pillow', 'accelerate': 'accelerate>=0.11.0', 'compel': 'compel==0.1.8', 'black': 'black~=23.1', 'datasets': 'datasets', 'filelock': 'filelock', 'flax': 'flax>=0.4.1', 'hf-doc-builder': 'hf-doc-builder>=0.3.0...
288
0
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ...utils.dum...
231
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_availa...
288
0
"""simple docstring""" from collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_torch_available(): im...
57
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is truly tiny - # ...
288
0
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreT...
139
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : int = 1_00_00_00 ) -> int: _snake_case = limit + 1 _snake_case = [0] * limit for first_term in range(1 , __lowerCamelCase ): for n in range(__lowerCamelCase , __lowerC...
288
0
import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def A (__A : Tuple , __A : Optional[Any] , __A : Optional[int] ...
51
"""simple docstring""" import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def _UpperCAmelCase ( __lowerCamelCase : int = 3 ) -> qiskit.result.counts.Counts: if isinstance(__lowerCamelCase , __l...
288
0
import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_available, is_tf_available, is_torch_availa...
236
"""simple docstring""" import argparse import os from pathlib import Path import fairseq import torch from packaging import version from torch import nn from transformers import ( BartConfig, BartForConditionalGeneration, BartForSequenceClassification, BartModel, BartTokeniz...
288
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resi...
47
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : Tuple ) -> Any: stooge(__lowerCamelCase , 0 , len(__lowerCamelCase ) - 1 ) return arr def _UpperCAmelCase ( __lowerCamelCase : str , __lowerCamelCase : List[str] , __low...
288
0
from __future__ import annotations import collections import pprint from pathlib import Path def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ ) -> str: return "".join(sorted(__lowerCamelCase ) ) def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ ) -> list[str]: return word_by_sign...
212
"""simple docstring""" # Logistic Regression from scratch # In[62]: # In[63]: # importing all the required libraries import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def _UpperCAmelCase ( __lowerCamelCase : str ) -> List[Any]: ret...
288
0
"""simple docstring""" def _lowercase ( __lowerCAmelCase ) -> Union[str, Any]: SCREAMING_SNAKE_CASE__ : Tuple = len(__lowerCamelCase ) for i in range(length - 1 ): SCREAMING_SNAKE_CASE__ : List[str] = i for ...
132
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) UpperCAmelCase__ ...
288
0
'''simple docstring''' import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def __snake_case ( UpperCAmelCase_ : str ): return 1 / (1 + np.exp(-z )) def __snake_case ( UpperCAmelCase_ : Optional[Any] , Uppe...
55
"""simple docstring""" from math import pow def _UpperCAmelCase ( __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : int , ) -> tuple[int, int]: if current_sum =...
288
0
'''simple docstring''' def snake_case_ (_a : Union[str, Any]=2_8_1_2_3 ): UpperCAmelCase = [1] * (limit + 1) for i in range(2 , int(limit**0.5 ) + 1 ): sum_divs[i * i] += i for k in range(i + 1 , limit // i + 1 ): sum...
34
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import requ...
288
0
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, StableDiffusio...
1
"""simple docstring""" import os import time import numpy as np import onnxruntime as ort UpperCAmelCase__ = '1' UpperCAmelCase__ = '0' UpperCAmelCase__ = '1' UpperCAmelCase__ = ort.SessionOptions() UpperCAmelCase__ = ort.GraphOptimizationLevel.ORT_D...
288
0
import json import os import re import unicodedata from json.encoder import INFINITY from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import regex from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding from ...utils import T...
231
"""simple docstring""" import logging from transformers.configuration_utils import PretrainedConfig UpperCAmelCase__ = logging.getLogger(__name__) class lowerCAmelCase__ ( A_ ): __a = """masked_bert""" def __init__( self : Union[str...
288
0
"""simple docstring""" from math import isqrt def _lowerCamelCase ( _UpperCamelCase ): '''simple docstring''' return all(number % divisor != 0 for divisor in range(2 , isqrt(__lowerCamelCase ) + 1 ) ) def _lowerCamelCase ( _UpperCamelCase = 10**6 ): '''simple docstr...
57
"""simple docstring""" import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from dataset...
288
0
'''simple docstring''' import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=A_ ) class _snake_case ( A_ ): _A : Optional[Any] ...
139
"""simple docstring""" from math import sqrt def _UpperCAmelCase ( __lowerCamelCase : int = 1_00_00_00 ) -> int: _snake_case = 0 _snake_case = 0 _snake_case = 42 while num_cuboids <= limit: max_cuboid_size += 1 for...
288
0
import argparse import os import subprocess from packaging.version import Version, parse from accelerate.commands.config.config_args import default_config_file, load_config_from_file snake_case_ : Any = "Run commands across TPU VMs for initial setup before running `accelerate launch`."...
51
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.ut...
288
0
from __future__ import annotations from numpy import array, cos, cross, floataa, radians, sin from numpy.typing import NDArray def UpperCAmelCase__ ( lowerCamelCase, lowerCamelCase, lowerCamelCase = False ): if radian_mode: return [magnitude * cos(__lowerCamelCase ), magnitude * sin(...
236
"""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 UpperCAmelCase__ = '...
288
0
'''simple docstring''' import contextlib import faulthandler import io import multiprocessing import os import platform import signal import tempfile def _lowerCAmelCase ( _UpperCamelCase : Any , _UpperCamelCase : Union[str, Any] , _UpperCamelCase : int ,...
47
"""simple docstring""" import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": UpperCAmelCase__ = argparse.ArgumentParser( description=( 'Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned'...
288
0
import math import qiskit def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ = 1 , SCREAMING_SNAKE_CASE_ = 1 , SCREAMING_SNAKE_CASE_ = 1 ) -> qiskit.result.counts.Counts: if ( isinstance(__lowerCamelCase , __lowerCamelCase ) or isinstance(__lowerCa...
212
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : list , __lowerCamelCase : int = 0 ) -> list: _snake_case = length or len(__lowerCamelCase ) _snake_case = False for i in range(length - 1 ): if list_data[i] > lis...
288
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() and is_transformers_version(">=", "4.25.0")): raise OptionalDependencyNotA...
132
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformer...
288
0
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import requ...
55
"""simple docstring""" import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStruct...
288
0
'''simple docstring''' 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_configurati...
34
"""simple docstring""" from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class lowerCAmelCase__ ( A_ ): def __lt__( self : Any , _lowerCamelCase : int ...
288
0
'''simple docstring''' def lowerCAmelCase_ ( snake_case_ : str , snake_case_ : str ) -> bool: '''simple docstring''' UpperCAmelCase_ = len(__lowerCamelCase ) UpperCAmelCase_ = len(__lowerCamelCase ) UpperCAmelCase_ ...
1
"""simple docstring""" UpperCAmelCase__ = { 'Pillow': 'Pillow', 'accelerate': 'accelerate>=0.11.0', 'compel': 'compel==0.1.8', 'black': 'black~=23.1', 'datasets': 'datasets', 'filelock': 'filelock', 'flax': 'flax>=0.4.1', 'hf-doc-builder': 'hf-doc-builder>=0.3.0...
288
0
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, logging, )...
231
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_availa...
288
0
"""simple docstring""" import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() A : Tuple = logging.get_logger(__name__) A : Optional[int] = { "post_extract_proj...
57
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is truly tiny - # ...
288
0
'''simple docstring''' def A_ ( ): return [ a * b * (1000 - a - b) for a in range(1 , 999 ) for b in range(__lowerCamelCase , 999 ) if (a * a + b * b == (1000 - a - b) ** 2) ][0] if __name__ == "__main__": print(f'''{solution()...
139
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : int = 1_00_00_00 ) -> int: _snake_case = limit + 1 _snake_case = [0] * limit for first_term in range(1 , __lowerCamelCase ): for n in range(__lowerCamelCase , __lowerC...
288
0
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 A (__A : Any ...
51
"""simple docstring""" import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def _UpperCAmelCase ( __lowerCamelCase : int = 3 ) -> qiskit.result.counts.Counts: if isinstance(__lowerCamelCase , __l...
288
0
import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokenizer from transformers.models.mbart.modeling_mbart i...
236
"""simple docstring""" import argparse import os from pathlib import Path import fairseq import torch from packaging import version from torch import nn from transformers import ( BartConfig, BartForConditionalGeneration, BartForSequenceClassification, BartModel, BartTokeniz...
288
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCamelCase : List[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependen...
47
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : Tuple ) -> Any: stooge(__lowerCamelCase , 0 , len(__lowerCamelCase ) - 1 ) return arr def _UpperCAmelCase ( __lowerCamelCase : str , __lowerCamelCase : List[str] , __low...
288
0
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ ) -> float: if edge <= 0 or not isinstance(__lowerCamelCase , __lowerCamelCase ): raise ValueError('Length must be a positive.' ) return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2)) * (edge**2) def lowerCAmelCase__ ( SCR...
212
"""simple docstring""" # Logistic Regression from scratch # In[62]: # In[63]: # importing all the required libraries import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def _UpperCAmelCase ( __lowerCamelCase : str ) -> List[Any]: ret...
288
0