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""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase__ = { 'configuration_distilbert': [ ...
288
"""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
1
"""simple docstring""" import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models...
288
"""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
1
"""simple docstring""" from __future__ import annotations from math import gcd def _UpperCAmelCase ( __lowerCamelCase : int , __lowerCamelCase : int = 2 , __lowerCamelCase : int = 1 , __lowerCamelCase : int = 3 , ) -> int | None: # A valu...
288
"""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
1
"""simple docstring""" import argparse import os import re import tensorflow as tf import torch from transformers import BertConfig, BertModel from transformers.utils import logging logging.set_verbosity_info() UpperCAmelCase__ = logging.get_logger(__name__) def _UpperCAmelCase ...
288
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformer...
288
1
"""simple docstring""" import os import numpy import onnx def _UpperCAmelCase ( __lowerCamelCase : int , __lowerCamelCase : Optional[int] ) -> int: _snake_case = a.name _snake_case = b.name _snake_case = '''''' ...
288
"""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
1
"""simple docstring""" import fire from utils import calculate_rouge, save_json def _UpperCAmelCase ( __lowerCamelCase : Tuple , __lowerCamelCase : Tuple , __lowerCamelCase : Union[str, Any]=None , **__lowerCamelCase : Dict ) -> str: _snake_...
288
"""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
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipeline_vq_diffusi...
288
"""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
1
"""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...
288
"""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
1
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : int = 10_00 ) -> int: return sum(e for e in range(3 , __lowerCamelCase ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"{solution() = }")
288
"""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
1
"""simple docstring""" from maths.prime_factors import prime_factors def _UpperCAmelCase ( __lowerCamelCase : int ) -> int: if not isinstance(__lowerCamelCase , __lowerCamelCase ): _snake_case = f'''Input value of [number={number}] must be an integer''' ...
288
"""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
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, PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) U...
288
"""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
1
"""simple docstring""" from argparse import ArgumentParser from .env import EnvironmentCommand def _UpperCAmelCase ( ) -> Union[str, Any]: _snake_case = ArgumentParser('''Diffusers CLI tool''' , usage='''diffusers-cli <command> [<args>]''' ) _snake_case ...
288
"""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
1
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class lowerCAmelCase__ ( nn.Module ): __a = 42 __a = jnp.floataa def lowercase ( self : Union[str, Any] ): _snake_case = ...
288
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : Tuple ) -> Any: stooge(__lowerCamelCase , 0 , len(__lowerCamelCase ) - 1 ) return arr def _UpperCAmelCase ( __lowerCamelCase : str , __lowerCamelCase : List[str] , __low...
288
1
"""simple docstring""" import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() UpperCAmelCase__ = logging.get_logger(__name__) UpperCAmelCase__ = { 'post_...
288
"""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
1
"""simple docstring""" import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available ...
288
"""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
1
"""simple docstring""" 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 i...
288
"""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
1
"""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, PreTr...
288
"""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
1
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : str , __lowerCamelCase : str ) -> bool: _snake_case = len(__lowerCamelCase ) _snake_case = len(__lowerCamelCase ) _snake_case = [[False for _ in range(m...
288
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) UpperCAmelCase__ = { 'con...
288
"""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
1
"""simple docstring""" import torch from diffusers import StableDiffusionPipeline UpperCAmelCase__ = 'path-to-your-trained-model' UpperCAmelCase__ = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.floataa).to('cuda') UpperCAmelCase__ = 'A photo of sks ...
288
"""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
1
"""simple docstring""" import heapq import sys import numpy as np UpperCAmelCase__ = tuple[int, int] class lowerCAmelCase__ : def __init__( self : Union[str, Any] ): _snake_case = [] _snake_case = set() ...
288
"""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
1
"""simple docstring""" from collections import deque from math import floor from random import random from time import time class lowerCAmelCase__ : def __init__( self : Any ): _snake_case = {} def lowercase ( ...
288
"""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
1
"""simple docstring""" import math def _UpperCAmelCase ( __lowerCamelCase : int ) -> bool: if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are no...
288
"""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
1
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : str ) -> list[int]: _snake_case = [0 for i in range(len(__lowerCamelCase ) )] # initialize interval's left pointer and right pointer _snake_case , _snake_case = 0, 0 ...
288
"""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
1
"""simple docstring""" import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Convers...
288
"""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
1
"""simple docstring""" from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCAmelCase__ = logging.get_logger(__name__) UpperCAmelCase__ = { 'CarlCochet/trajectory-transformer-halfcheetah-medium-v2': ( 'https://huggingface.co/CarlCochet...
288
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformer...
288
1
"""simple docstring""" from __future__ import annotations from typing import Any class lowerCAmelCase__ : def __init__( self : Union[str, Any] , _lowerCamelCase : int ): _snake_case = num_of_nodes _snake_case = ...
288
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase__ = { 'configuration_roberta_prelayernorm': [ 'ROBERTA_PR...
288
"""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
1
"""simple docstring""" from __future__ import annotations from typing import Any class lowerCAmelCase__ ( A_ ): pass class lowerCAmelCase__ : def __init__( self : List[str] , _lowerCamelCase : Any ): _snake_case...
288
"""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
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, Stabl...
288
"""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
1
"""simple docstring""" import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, ) from ..test_...
288
"""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
1
"""simple docstring""" import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProces...
288
"""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
1
"""simple docstring""" import os from tempfile import TemporaryDirectory from unittest import TestCase import pytest from absl.testing import parameterized from datasets import config from datasets.arrow_reader import HF_GCP_BASE_URL from datasets.builder import DatasetBuilder from datasets.dataset...
288
"""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
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ...
288
"""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
1
"""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
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : Tuple ) -> Any: stooge(__lowerCamelCase , 0 , len(__lowerCamelCase ) - 1 ) return arr def _UpperCAmelCase ( __lowerCamelCase : str , __lowerCamelCase : List[str] , __low...
288
1
"""simple docstring""" from __future__ import annotations def _UpperCAmelCase ( __lowerCamelCase : float , __lowerCamelCase : float , __lowerCamelCase : float ) -> dict[str, float]: if (voltage, current, resistance).count(0 ) != 1: raise ValueError('...
288
"""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
1
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : Optional[Any] , __lowerCamelCase : Dict ) -> str: _snake_case = [0 for i in range(r + 1 )] # nc0 = 1 _snake_case = 1 for i in range(1 , n + 1 ): # to compu...
288
"""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
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) UpperCAmelCase__ = { 'robert...
288
"""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
1
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : Tuple ) -> Any: stooge(__lowerCamelCase , 0 , len(__lowerCamelCase ) - 1 ) return arr def _UpperCAmelCase ( __lowerCamelCase : str , __lowerCamelCase : List[str] , __low...
288
"""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
1
"""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, ...
288
"""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
1
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : int , __lowerCamelCase : int ) -> Union[str, Any]: _snake_case = 0 while b > 0: if b & 1: res += a a += a b >>= 1 return res def _UpperCAmelCase ( ...
288
"""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
1
"""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, _co...
288
"""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
1
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin ...
288
"""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
1
"""simple docstring""" import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionTextToImagePipeline from diffusers.utils.testing_utils import nightly, require_torch_gpu, torch_device UpperCAmelCase__ = False class lowerCA...
288
"""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
1
"""simple docstring""" import warnings from transformers import AutoTokenizer from transformers.utils import is_torch_available from transformers.utils.generic import ExplicitEnum from ...processing_utils import ProcessorMixin if is_torch_available(): import torch class lowerCAmelCase__...
288
"""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
1
"""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
"""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
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, PNDMScheduler, StableDiffusionLDMaDPipeline, UNetaDConditionModel, ) f...
288
"""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
1
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : float ) -> 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...
288
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformer...
288
1
"""simple docstring""" from __future__ import annotations from cmath import sqrt def _UpperCAmelCase ( __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : int ) -> tuple[complex, complex]: if a == 0: raise ValueError('''Coefficie...
288
"""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
1
"""simple docstring""" import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( A_ ): __a = (PNDMScheduler,) __a = (("""num_inference_steps""", 50),) def...
288
"""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
1
"""simple docstring""" # This code is adapted from OpenAI's release # https://github.com/openai/human-eval/blob/master/human_eval/execution.py import contextlib import faulthandler import io import multiprocessing import os import platform import signal import tempfile def _UpperCAmelCase ...
288
"""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
1
"""simple docstring""" 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 OptionalDependencyNo...
288
"""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
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 PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ = '▁' UpperCAmelCase__ = {'vocab_fi...
288
"""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
1
"""simple docstring""" # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the confi...
288
"""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
1
"""simple docstring""" import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) Up...
288
"""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
1
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : int , __lowerCamelCase : int ) -> int: return int((input_a, input_a).count(1 ) != 0 ) def _UpperCAmelCase ( ) -> None: assert or_gate(0 , 0 ) == 0 assert or_gate(0 , 1 ...
288
"""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
1
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) UpperCAmelCase__ = { 'huggingface/time-series-transformer-tourism-monthly': ( ...
288
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : Tuple ) -> Any: stooge(__lowerCamelCase , 0 , len(__lowerCamelCase ) - 1 ) return arr def _UpperCAmelCase ( __lowerCamelCase : str , __lowerCamelCase : List[str] , __low...
288
1
"""simple docstring""" from __future__ import annotations from numpy import array, cos, cross, floataa, radians, sin from numpy.typing import NDArray def _UpperCAmelCase ( __lowerCamelCase : float , __lowerCamelCase : float , __lowerCamelCase : bool = False ) ...
288
"""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
1
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary # Register SEW's fairseq modules from sew_asapp import tasks # noqa: F401 from transformers import ( SEWConfig, SEWForCTC, SEWModel, WavaVecaCTCTokeniz...
288
"""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
1
"""simple docstring""" import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def _UpperCAmelCase ( ) -> Optional[Any]: _snake_case = ArgumentParser( descriptio...
288
"""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
1
"""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
"""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
1
"""simple docstring""" 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 tran...
288
"""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
1
"""simple docstring""" # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
288
"""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
1
"""simple docstring""" from math import sqrt import numpy as np from sympy import symbols # Coefficient # Speed of light (m/s) UpperCAmelCase__ = 299792458 # Symbols UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ = symbols('ct x y z') de...
288
"""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
1
"""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 OptionalDe...
288
"""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
1
"""simple docstring""" import os def _UpperCAmelCase ( ) -> str: with open(os.path.dirname(__lowerCamelCase ) + '''/grid.txt''' ) as f: _snake_case = [] # noqa: E741 for _ in range(20 ): l.append([int(__lowerCamelCase ) for x in f.readline().split()] ...
288
"""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
1
"""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
"""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
1
"""simple docstring""" from __future__ import annotations import math def _UpperCAmelCase ( __lowerCamelCase : int , __lowerCamelCase : int , __lowerCamelCase : bool , __lowerCamelCase : list[int] , __lowerCamelCase : float ) -> int...
288
"""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
1
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtr...
288
"""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
1
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_c...
288
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformer...
288
1
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : int ) -> int: _snake_case = [[0 for _ in range(__lowerCamelCase )] for _ in range(m + 1 )] for i in range(m + 1 ): _snake_case = 1 for n in range(m + 1 ): for k in r...
288
"""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
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
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase__ = { 'configuration_nezha': ['NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'NezhaConfig'], } try: if not is_...
288
"""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
1
"""simple docstring""" import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common impo...
288
"""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
1
"""simple docstring""" import inspect import warnings from typing import Any, Dict, Optional, Union from packaging import version def _UpperCAmelCase ( *__lowerCamelCase : Tuple , __lowerCamelCase : Optional[Union[Dict, Any]] = None , __lowerCamelCase : Any=True ...
288
"""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
1
"""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 UpperCAmelCase__ = logging.get_l...
288
"""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
1
"""simple docstring""" import os from typing import Dict, List, Union import tensorflow as tf from keras_nlp.tokenizers import BytePairTokenizer from tensorflow_text import pad_model_inputs from .tokenization_gpta import GPTaTokenizer class lowerCAmelCase__ ( tf.keras.layers.Layer ): ...
288
"""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
1
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional from packaging import version if TYPE_CHECKING: from ... import PreTrainedTokenizer, TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxCo...
288
"""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
1
"""simple docstring""" import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# UpperCAmelCase__ = [ # (stable-diffusion, HF Diffusers) ('time_embed.0.weight',...
288
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : Tuple ) -> Any: stooge(__lowerCamelCase , 0 , len(__lowerCamelCase ) - 1 ) return arr def _UpperCAmelCase ( __lowerCamelCase : str , __lowerCamelCase : List[str] , __low...
288
1
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inp...
288
"""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
1
"""simple docstring""" from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) UpperCAmelCase__ = { 'microsoft/xprophetnet-large-wiki100-cased': ( 'h...
288
"""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
1
"""simple docstring""" # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
288
"""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
1
"""simple docstring""" import os import re import sys import traceback import warnings from pathlib import Path from typing import Dict, Optional, Union from uuid import uuida from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami from huggingface_hub.file_download i...
288
"""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
1
"""simple docstring""" import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def _UpperCAmelCase ( __lowerCamelCase : Optional[int] ) -> str: _snake_case = os.path.join(args.tf_mode...
288
"""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
1
"""simple docstring""" from packaging import version from .import_utils import is_accelerate_available if is_accelerate_available(): import accelerate def _UpperCAmelCase ( __lowerCamelCase : List[str] ) -> Optional[int]: if not is_accelerate_available(): return me...
288
"""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
1
"""simple docstring""" 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 _UpperCAmelCase ( __lowerCamelCase : Tuple , __lowerC...
288
"""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
1
"""simple docstring""" import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from .....
288
"""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
1
"""simple docstring""" 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 UpperCAmelCase__ = logging.get_logger(__name__) UpperCAme...
288
"""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
1
"""simple docstring""" from __future__ import annotations from collections.abc import Callable def _UpperCAmelCase ( __lowerCamelCase : Callable[[int | float], int | float] , __lowerCamelCase : int | float , __lowerCamelCase : int | float , __lowerCamelCase :...
288
"""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
1
"""simple docstring""" import inspect import unittest import numpy as np from transformers import ViTConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixi...
288
"""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
1
"""simple docstring""" def _UpperCAmelCase ( __lowerCamelCase : Dict ) -> Union[str, Any]: _snake_case = len(__lowerCamelCase ) for i in range(length - 1 ): _snake_case = i for k in range(i + 1 , __lowerCamelCase ): if colle...
288
"""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
1
"""simple docstring""" from scipy.stats import pearsonr import datasets UpperCAmelCase__ = '\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value reli...
288
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transformer...
288
1
"""simple docstring""" import json import os import shutil import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoConfig, BertConfig, ...
288
"""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
1
"""simple docstring""" from __future__ import annotations from typing import Any class lowerCAmelCase__ : def __init__( self : Tuple , _lowerCamelCase : int , _lowerCamelCase : int , _lowerCamelCase : float = 0 ): _snake...
288
"""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
1
"""simple docstring""" import random def _UpperCAmelCase ( __lowerCamelCase : list , __lowerCamelCase : List[str] ) -> tuple: _snake_case , _snake_case , _snake_case = [], [], [] for element in data: if element < pivot: le...
288
"""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
1
"""simple docstring""" import math def _UpperCAmelCase ( __lowerCamelCase : int ) -> bool: assert isinstance(__lowerCamelCase , __lowerCamelCase ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes r...
288
"""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
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase__ = { 'configuration_tapas': ['TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TapasConfig'], 'tokenization_tapas': ['Ta...
288
"""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
1
"""simple docstring""" import unittest import torch from diffusers import VQModel from diffusers.utils import floats_tensor, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNetTesterMixin enable_full_determinism...
288
"""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
1
"""simple docstring""" import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common imp...
288
"""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
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ = logging.get_logger(__name__) UpperCAmelCase__ = { 'microsoft/markuplm-base': 'https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json', ...
288
"""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
1