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 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_mvp import...
185
def UpperCAmelCase_ ( __UpperCAmelCase : int , __UpperCAmelCase : int ) -> int: return number | (1 << position) def UpperCAmelCase_ ( __UpperCAmelCase : int , __UpperCAmelCase : int ) -> int: return number & ~(1 << positio...
225
0
import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from torch.utils.data import Da...
259
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCamelCase__ : List[Any] = logging.get_logger(__name__) lowerCamelCase__ : List[str] = { 'vocab_file': 'vocab.json', 'toke...
225
0
from __future__ import annotations from math import gcd def a_ ( lowerCAmelCase_ : int, lowerCAmelCase_ : int = 2, lowerCAmelCase_ : int = 1, lowerCAmelCase_ : int = 3, ): # A value less than 2 can cause an infinite loop in the algorithm. if num < 2: raise ValueError...
284
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) lowerCamelCase__ : Union[str, Any] = { 'configuration_layoutlmv2': ['LAYOUTLMV2_PRETRAINED_CONFIG_ARCHIVE_M...
225
0
def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase ) -> list: '''simple docstring''' return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(__UpperCAmelCase ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('''doctest''').testmo...
138
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCamelCase__ : str = { 'configuration_mask2former': [ 'MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Mask2FormerConfig', ], } try: ...
225
0
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase :Dict = logging.get_logger(__name__) _lowerCAmelCase :Optional[Any] = { 'asapp/sew-d-tiny-100k': 'https://huggingface.co/asapp/sew-d-...
263
import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): import onnxruntime as or...
225
0
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner impo...
110
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transformers.testing_utils import DUMMY_UNKNOWN_IDE...
225
0
from __future__ import annotations def lowerCamelCase__ ( _a): # This function is recursive SCREAMING_SNAKE_CASE : Dict = len(__UpperCAmelCase) # If the array contains only one element, we return it (it's the stop condition of # recursion) if array_length <= 1: return array # ...
76
import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print('Googling.....') lowerCamelCase__ : List[Any] = 'https://www.google.com/search?q=' + ' '.join(sys.argv[1:]) lowerCamelCase__ : List[Any] = ...
225
0
from typing import TYPE_CHECKING from ...utils import _LazyModule lowerCamelCase : str ={'tokenization_byt5': ['ByT5Tokenizer']} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys lowerCamelCase : Tuple =_LazyModule(__name__, globals()['...
189
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ : List[str] = logging.get_logger(__name__) lowerCamelCase__ : List[str] = { 'facebook/s2t-small-librispeech-asr': ( 'https://huggingface.co/facebook/s2t-small-librispeech-asr/res...
225
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a_ : Optional[Any] = {'configuration_opt': ['OPT_PRETRAI...
55
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor lowerCamelCase__ : List[str] = logging.get_logger(__name__) class lowerCamelCase_ ( _SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__( sel...
225
0
import glob import os import random from string import ascii_lowercase, digits import cva _lowerCAmelCase : Tuple = '' _lowerCAmelCase : Optional[Any] = '' _lowerCAmelCase : Any = '' _lowerCAmelCase : Optional[int] = 1 # (0 is vertical, 1 is horizon...
169
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer lowerCamelCase__ : Union[str, Any] = logging.get_logger(__na...
225
0
import numpy as np # Importing the Keras libraries and packages import tensorflow as tf from tensorflow.keras import layers, models if __name__ == "__main__": # Initialising the CNN # (Sequential- Building the model layer by layer) __UpperCAmelCase = models.Sequential() #...
29
from math import sqrt def UpperCAmelCase_ ( __UpperCAmelCase : 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 multiple...
225
0
'''simple docstring''' from math import sqrt def UpperCAmelCase__ ( UpperCAmelCase_ : 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, a...
185
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) def ...
225
0
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Dataset from ...
259
import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope='session' ) def UpperCAmelCase_ ( ) -> str: ...
225
0
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 datasets.config import MAX_SHARD_SIZE from d...
284
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Dataset from tr...
225
0
import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, ...
138
class lowerCamelCase_ : '''simple docstring''' def __init__( self : List[Any] ): SCREAMING_SNAKE_CASE_ = {} def lowerCAmelCase_ ( self : List[str] ): print(self.vertex ) for i in self.vertex: print(_lowerCAm...
225
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_deformable_detr import DeformableDetrImageProcessor _lowerCAmelCase :Optional[Any] = logging.get_logger(__name__) class _UpperCAmelCase ( _SCREAMING_SNAKE_CASE ): '''simple docstring'...
263
from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common...
225
0
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCAmelCase = TypeVar('T') lowerCAmelCase = TypeVar('U') class _a ( Generic[T, U] ): def __init__( self: Any , UpperCamelCase...
110
import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester fro...
225
0
from __future__ import annotations import math a_ = '2020.9.26' a_ = 'xcodz-dot, cclaus, dhruvmanila' def lowerCamelCase__ ( _a , _a , _a , _a , _a): if not all(isinstance(__UpperCAmelCase , (float, int)) for val in locals().values()): SCREAMING_SNAKE_CA...
76
from __future__ import annotations from math import gcd def UpperCAmelCase_ ( __UpperCAmelCase : int , __UpperCAmelCase : int = 2 , __UpperCAmelCase : int = 1 , __UpperCAmelCase : int = 3 , ) -> int | None: # A value less than 2 can cause an infinite ...
225
0
# Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
189
# Copyright 2021 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
225
0
'''simple docstring''' from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_com...
55
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def UpperCAmelCase_ ( __UpperCAmelCase : bytes , __UpperCAmelCase : int ) -> np.array: SCREAMING_SNAKE_CASE_ = f"{sampling_rate}" SCREAMING_SN...
225
0
# NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controlnet.pipeline_controlnet im...
169
import re from filelock import FileLock try: import nltk lowerCamelCase__ : str = True except (ImportError, ModuleNotFoundError): lowerCamelCase__ : Union[str, Any] = False if NLTK_AVAILABLE: with FileLock('.lock') as lock: nltk.download('punkt', quiet=True) def ...
225
0
from __future__ import annotations __UpperCAmelCase = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] __UpperCAmelCase = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def lowercase__ ( __snake_case : list[float] ): ...
29
from __future__ import annotations lowerCamelCase__ : Optional[int] = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] lowerCamelCase__ : List[Any] = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def UpperCAmelCase_ ( __UpperCAmelCase : list[fl...
225
0
'''simple docstring''' import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def UpperCAmelCase__ ( UpperCAmelCase_ : int = 3 ) -> qiskit.result.counts.Counts: if isinstance(__UpperCAmelCase , __Upp...
185
def UpperCAmelCase_ ( __UpperCAmelCase : int , __UpperCAmelCase : int ) -> int: return number | (1 << position) def UpperCAmelCase_ ( __UpperCAmelCase : int , __UpperCAmelCase : int ) -> int: return number & ~(1 << positio...
225
0
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class UpperCAmelCase_ ( _SCREAMING_SNAKE_CASE ): """si...
259
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCamelCase__ : List[Any] = logging.get_logger(__name__) lowerCamelCase__ : List[str] = { 'vocab_file': 'vocab.json', 'toke...
225
0
class _UpperCAmelCase : """simple docstring""" def __init__( self : List[Any] ) -> List[Any]: __lowerCAmelCase = {} def lowercase ( self : List[str] ) -> Union[str, Any]: print(self.vertex ) for i in self.vertex: pr...
284
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) lowerCamelCase__ : Union[str, Any] = { 'configuration_layoutlmv2': ['LAYOUTLMV2_PRETRAINED_CONFIG_ARCHIVE_M...
225
0
import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class __A ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CA...
138
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCamelCase__ : str = { 'configuration_mask2former': [ 'MASK2FORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Mask2FormerConfig', ], } try: ...
225
0
"""simple docstring""" from collections import deque class _UpperCAmelCase : '''simple docstring''' def __init__( self , A , A , A ) -> Optional[Any]: _UpperCAmelCase : str = process_name # process name _UpperCAme...
263
import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onnx_available(): import onnxruntime as or...
225
0
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 AutoFeatureExtractor, WavaVecaFeatureExtractor from transformers.testing_utils import TO...
110
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transformers.testing_utils import DUMMY_UNKNOWN_IDE...
225
0
import os def lowerCamelCase__ ( _a = "input.txt"): with open(os.path.join(os.path.dirname(__UpperCAmelCase) , __UpperCAmelCase)) as input_file: SCREAMING_SNAKE_CASE : Optional[int] = [ [int(__UpperCAmelCase) for element in line.split(",")] for line in input_file....
76
import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print('Googling.....') lowerCamelCase__ : List[Any] = 'https://www.google.com/search?q=' + ' '.join(sys.argv[1:]) lowerCamelCase__ : List[Any] = ...
225
0
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, get_resize_output_image_size, normalize, rescale, resize, to_channel_d...
189
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ : List[str] = logging.get_logger(__name__) lowerCamelCase__ : List[str] = { 'facebook/s2t-small-librispeech-asr': ( 'https://huggingface.co/facebook/s2t-small-librispeech-asr/res...
225
0
'''simple docstring''' from math import factorial def __snake_case ( UpperCAmelCase_ : int , UpperCAmelCase_ : int ): # If either of the conditions are true, the function is being asked # to calculate a factorial of a negative number, which is not possible ...
55
import warnings from ...utils import logging from .image_processing_imagegpt import ImageGPTImageProcessor lowerCamelCase__ : List[str] = logging.get_logger(__name__) class lowerCamelCase_ ( _SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__( sel...
225
0
import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig _lowerCAmelCase : List[str] = logging.get_logger(__name__) class _UpperCamelCase : def __init__( self ...
169
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer lowerCamelCase__ : Union[str, Any] = logging.get_logger(__na...
225
0
from __future__ import annotations def lowercase__ ( __snake_case : list[int] ): '''simple docstring''' if not nums: return 0 UpperCAmelCase_ : Optional[Any] = nums[0] UpperCAmelCase_ : int ...
29
from math import sqrt def UpperCAmelCase_ ( __UpperCAmelCase : 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 multiple...
225
0
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transfo...
185
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) def ...
225
0
from __future__ import annotations def _A ( SCREAMING_SNAKE_CASE__ : int ): UpperCamelCase :str = [True] * limit UpperCamelCase :str = False UpperCamelCase :List[Any] = False UpperCamelCase :Any = True for i in range...
259
import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope='session' ) def UpperCAmelCase_ ( ) -> str: ...
225
0
import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup _snake_case : List[str] = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' ' (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.19582' } ...
284
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Dataset from tr...
225
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging __A : Tuple = logging.get_logger(__name__) __A : int = { 'Salesforce/blip-vqa-base': 'https://huggingface.co/Salesforce/blip-vqa-base/resolve/main/con...
138
class lowerCamelCase_ : '''simple docstring''' def __init__( self : List[Any] ): SCREAMING_SNAKE_CASE_ = {} def lowerCAmelCase_ ( self : List[str] ): print(self.vertex ) for i in self.vertex: print(_lowerCAm...
225
0
"""simple docstring""" import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def lowerCamelCase_ (UpperCamelCase__ : bytes , UpperCamelCase__ : int ): _UpperCAmelCase : Tuple = F'{sampling_rate}' _Up...
263
from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common...
225
0
from datetime import datetime import requests from bsa import BeautifulSoup if __name__ == "__main__": lowerCAmelCase = input('Enter image url: ').strip() print(f"""Downloading image from {url} ...""") lowerCAmelCase = BeautifulSoup(requests.get(url).content, 'html.parse...
110
import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester fro...
225
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) __A ={ "configuration_mobilebert": [ "MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "Mob...
226
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import ...
226
1
from manim import * class UpperCAmelCase__ ( __UpperCamelCase ): '''simple docstring''' def snake_case__ ( self : Optional[Any] ): '''simple docstring''' __UpperCAmelCase : Dict = Rectangle(height=0.5 , widt...
226
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, PreTrainedTokenizerBase, T...
226
1
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image...
226
# # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 torch-distr...
226
1
import pytest import datasets # Import fixture modules as plugins __A =["tests.fixtures.files", "tests.fixtures.hub", "tests.fixtures.fsspec"] def a ( _UpperCAmelCase : Tuple , _UpperCAmelCase : str ): '''simple docstring''' ...
226
import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __A =logging.get_logger(__name__) class UpperCAmelCase__ ( __UpperCamelCase ): '''simple docstring''' ...
226
1
__A ={ 0: "0", 1: "1", 2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", 1_0: "a", 1_1: "b", 1_2: "c", 1_3: "d", 1_4: "e", 1_5: "f", } def a ( _UpperCAmelCase : float ): ...
226
import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class UpperCAmelCase__ ( uni...
226
1
__A ="\n# Installazione di Transformers\n! pip install transformers datasets\n# Per installare dalla fonte invece dell'ultima versione rilasciata, commenta il comando sopra e\n# rimuovi la modalità commento al comando seguente.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" __A ...
226
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
226
1
__A =9.8_0665 def a ( _UpperCAmelCase : float , _UpperCAmelCase : float , _UpperCAmelCase : float = g ): '''simple docstring''' if fluid_density <= 0: raise ValueError('''Impossible fluid density''' ) if v...
226
from __future__ import annotations class UpperCAmelCase__ : '''simple docstring''' def __init__( self : Optional[Any] , a_ : Optional[int]=None ): '''simple docstring''' __UpperCAmelCase : Optional[Any] = data ...
226
1
import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def a ( _UpperCAmelCase : int , _UpperCAmelCase : Any , _UpperCAmelCase : Tuple , _UpperCAmelCase : Union[str, Any] ): ...
226
import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu, calculate...
226
1
from scipy.stats import spearmanr import datasets __A ="\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implying no correlation.\nPositive correlations imply that...
226
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_download, hf_hub_url from PIL import Image from transformers import DetaConfig, DetaForObjectDetection, DetaImageProcessor, SwinConfig from transformers.utils import ...
226
1
import argparse import collections import json from pathlib import Path import requests import torch import yaml from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTImageProcessor, MobileViTVaConfig, MobileViTVaForImageClassification,...
226
import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_...
226
1
import json import os import tempfile from unittest.mock import patch import torch from torch.utils.data import DataLoader, TensorDataset from accelerate import DistributedType, infer_auto_device_map, init_empty_weights from accelerate.accelerator import Accelerator from accelerate.state import Grad...
226
import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer ...
226
1
import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def a ( _UpperCAmelCase : List[Any] ): '''simple docstring''' __UpperCAmelCase : Any = [ '''enco...
226
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class UpperCAmelCase__ : '''simple docstring''' UpperCamelCase = None def snake_case__ ( self : List[str] ): '''sim...
226
1
import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase from ...utils...
226
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_ava...
226
1
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__": __A ="%20".join(argv[1:]) if len(argv) > 1 else quote(str(input("Search: "))) print("Googling.....
226
import argparse import shlex import runhouse as rh if __name__ == "__main__": # Refer to https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup for cloud access # setup instructions, if using on-demand hardware # If user passes --user <user> --hos...
226
1
import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class UpperCAmelCase__ ( __UpperCamelCase ,unittest....
226
import glob import os import random from string import ascii_lowercase, digits import cva __A ="" __A ="" __A ="" __A =1 # (0 is vertical, 1 is horizontal) def a ( ): '''simple docstring''' __UpperCAmelCase , __UpperCAmel...
226
1
import argparse import shlex import runhouse as rh if __name__ == "__main__": # Refer to https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup for cloud access # setup instructions, if using on-demand hardware # If user passes --user <user> --hos...
226
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, P...
226
1
import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu, calculate...
226
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def a ( _UpperCAmelCase : Any , _UpperCAmelCase : Any=None ): '''simple docstring''' ...
226
1
import argparse import json from typing import List from ltp import LTP from transformers import BertTokenizer def a ( _UpperCAmelCase : Any ): '''simple docstring''' if ( (cp >= 0x4E00 and cp <= 0x9FFF) or (cp >= 0x3400 and ...
226
import qiskit def a ( _UpperCAmelCase : int , _UpperCAmelCase : int ): '''simple docstring''' __UpperCAmelCase : List[str] = qiskit.Aer.get_backend('''aer_simulator''' ) __UpperCAmelCase : Optional[A...
226
1
import os from math import logaa def a ( _UpperCAmelCase : str = "base_exp.txt" ): '''simple docstring''' __UpperCAmelCase : float = 0 __UpperCAmelCase : str = 0 for i, line in enumerate(open(os.path.jo...
226
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, resize, ...
226
1
import json import multiprocessing as mp import re from collections import defaultdict from functools import partial from typing import Dict, List, Optional, Set, Tuple, Type from datasets import Dataset from datasketch import MinHash, MinHashLSH from dpu_utils.utils.iterators import ThreadedIterator ...
226
import numpy as np class UpperCAmelCase__ : '''simple docstring''' def __init__( self : List[Any] ): '''simple docstring''' __UpperCAmelCase : Optional[Any] = (0, 0) __UpperCAmelCase : List[str] = None ...
226
1
import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_...
226
def a ( _UpperCAmelCase : Any ): '''simple docstring''' __UpperCAmelCase : Any = 0 __UpperCAmelCase : str = len(_UpperCAmelCase ) for i in range(n - 1 ): for j in range(i + 1 , _UpperCAme...
226
1
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() def ...
226
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def a ( _UpperCAmelCase : Tuple , _UpperCAmelCase : Optional[int] ): '''simple do...
226
1
from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common...
226
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import ...
226
1
import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNetaDConditionModel, ) f...
226
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, PreTrainedTokenizerBase, T...
226
1
__A =frozenset( [ "prompt", "height", "width", "guidance_scale", "negative_prompt", "prompt_embeds", "negative_prompt_embeds", "cross_attention_kwargs", ] ) __A =frozenset(["prompt", "negative_prompt"]) __A =...
226
# # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 torch-distr...
226
1
def a ( _UpperCAmelCase : str ): '''simple docstring''' assert column_title.isupper() __UpperCAmelCase : Union[str, Any] = 0 __UpperCAmelCase : Optional[Any] = len(_UpperCAmelCase ) - 1 __UpperCAmel...
226
import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __A =logging.get_logger(__name__) class UpperCAmelCase__ ( __UpperCamelCase ): '''simple docstring''' ...
226
1
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import List import timm import torch import torch.nn as nn from huggingface_hub import hf_hub_download from torch import Tensor from transformers import AutoImag...
226
import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class UpperCAmelCase__ ( uni...
226
1
from heapq import heappop, heappush import numpy as np def a ( _UpperCAmelCase : np.ndarray , _UpperCAmelCase : tuple[int, int] , _UpperCAmelCase : tuple[int, int] , _UpperCAmelCase : bool , ): '''simple docstring''' ...
226
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
226
1
import argparse import os import shutil from pathlib import Path import onnx import torch from packaging import version from torch.onnx import export from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, StableDiffusionPipeline __A =version.parse(version.parse(torch.__versio...
226
from __future__ import annotations class UpperCAmelCase__ : '''simple docstring''' def __init__( self : Optional[Any] , a_ : Optional[int]=None ): '''simple docstring''' __UpperCAmelCase : Optional[Any] = data ...
226
1
from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fastapi.routi...
226
import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu, calculate...
226
1
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class UpperCAmelCase__ ( datasets.BeamBasedBuilder ): '''simple docstring''' ...
226
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_download, hf_hub_url from PIL import Image from transformers import DetaConfig, DetaForObjectDetection, DetaImageProcessor, SwinConfig from transformers.utils import ...
226
1
import argparse import json import os import torch from transformers.file_utils import has_file from diffusers import UNetaDConditionModel, UNetaDModel __A =False __A =True __A =False if __name__ == "__main__": __A =argparse.ArgumentParser() parser.add_argume...
226
import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_...
226
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A ={ "configuration_instructblip": [ "INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "InstructBlipConfig", "InstructBlipQFormerConfig", "Ins...
226
import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer ...
226
1
import qiskit def a ( _UpperCAmelCase : int , _UpperCAmelCase : int ): '''simple docstring''' __UpperCAmelCase : List[str] = qiskit.Aer.get_backend('''aer_simulator''' ) __UpperCAmelCase : Optional[A...
226
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class UpperCAmelCase__ : '''simple docstring''' UpperCamelCase = None def snake_case__ ( self : List[str] ): '''sim...
226
1
import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, UNetaDConditionModel, VideoToVideoSDPipeline, ) from diffusers.utils import floats_tensor, is_x...
226
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_ava...
226
1
import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() __A =logging.get_logger(__name__) def a ( _UpperCAmelCase : Optional[Any] ): ...
226
import argparse import shlex import runhouse as rh if __name__ == "__main__": # Refer to https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup for cloud access # setup instructions, if using on-demand hardware # If user passes --user <user> --hos...
226
1
import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTeste...
226
import glob import os import random from string import ascii_lowercase, digits import cva __A ="" __A ="" __A ="" __A =1 # (0 is vertical, 1 is horizontal) def a ( ): '''simple docstring''' __UpperCAmelCase , __UpperCAmel...
226
1
def a ( _UpperCAmelCase : str , _UpperCAmelCase : int ): '''simple docstring''' return [sentence[i : i + ngram_size] for i in range(len(_UpperCAmelCase ) - ngram_size + 1 )] if __name__ == "__main__": from doctest impo...
226
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, P...
226
1
import glob import os import random from string import ascii_lowercase, digits import cva __A ="" __A ="" __A ="" __A =1 # (0 is vertical, 1 is horizontal) def a ( ): '''simple docstring''' __UpperCAmelCase , __UpperCAmel...
226
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def a ( _UpperCAmelCase : Any , _UpperCAmelCase : Any=None ): '''simple docstring''' ...
226
1
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 ( _UpperCAmelCas...
226
import qiskit def a ( _UpperCAmelCase : int , _UpperCAmelCase : int ): '''simple docstring''' __UpperCAmelCase : List[str] = qiskit.Aer.get_backend('''aer_simulator''' ) __UpperCAmelCase : Optional[A...
226
1
import requests from bsa import BeautifulSoup def a ( _UpperCAmelCase : str , _UpperCAmelCase : dict ): '''simple docstring''' __UpperCAmelCase : int = BeautifulSoup(requests.get(_UpperCAmelCase , params=_UpperCAm...
226
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, resize, ...
226
1
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert_fast import BertTokenizerFast from .tokenization_dpr import DPRContextEncoderTo...
226
import numpy as np class UpperCAmelCase__ : '''simple docstring''' def __init__( self : List[Any] ): '''simple docstring''' __UpperCAmelCase : Optional[Any] = (0, 0) __UpperCAmelCase : List[str] = None ...
226
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __A ={ "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP", "LlamaConfig"], } ...
226
def a ( _UpperCAmelCase : Any ): '''simple docstring''' __UpperCAmelCase : Any = 0 __UpperCAmelCase : str = len(_UpperCAmelCase ) for i in range(n - 1 ): for j in range(i + 1 , _UpperCAme...
226
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A ={ "configuration_rembert": ["REMBERT_PRETRAINED_CONFIG_ARCHIVE_MA...
226
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def a ( _UpperCAmelCase : Tuple , _UpperCAmelCase : Optional[int] ): '''simple do...
226
1
from datetime import datetime import requests from bsa import BeautifulSoup if __name__ == "__main__": __A =input("Enter image url: ").strip() print(f'''Downloading image from {url} ...''') __A =BeautifulSoup(requests.get(url).content, "html.parser") # The image URL is in th...
226
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import ...
226
1
from ...configuration_utils import PretrainedConfig __A ={ "google/tapas-base-finetuned-sqa": ( "https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json" ), "google/tapas-base-finetuned-wtq": ( "https://huggingface.co/google/tapas-base-finetuned...
226
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, PreTrainedTokenizerBase, T...
226
1
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching b...
226
# # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 torch-distr...
226
1
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class UpperCAmelCase__ ( unittest.TestCase ): '''simple docstring''' UpperCamelCase = JukeboxTokenizer UpperCamelCase = { ...
226
import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __A =logging.get_logger(__name__) class UpperCAmelCase__ ( __UpperCamelCase ): '''simple docstring''' ...
226
1
# # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 torch-distr...
226
import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class UpperCAmelCase__ ( uni...
226
1
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def a ( _UpperCAmelCase : BertModel , _UpperCAmelCase : str , _UpperCAmelCase : str ): '''simple docstring''' ...
226
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailab...
226
1
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be check...
226
from __future__ import annotations class UpperCAmelCase__ : '''simple docstring''' def __init__( self : Optional[Any] , a_ : Optional[int]=None ): '''simple docstring''' __UpperCAmelCase : Optional[Any] = data ...
226
1
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 __A =logging.get_logger(__name__) __A ={ "facebook/deit-base-distilled-patc...
226
import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu, calculate...
226
1
# This model implementation is heavily inspired by https://github.com/haofanwang/ControlNet-for-Diffusers/ import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffu...
226
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_download, hf_hub_url from PIL import Image from transformers import DetaConfig, DetaForObjectDetection, DetaImageProcessor, SwinConfig from transformers.utils import ...
226
1
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 Conversation __A =...
226
import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_...
226
1
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer __A =logging.get_logger(__name__) __A ={"...
226
import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer ...
226
1
import argparse import json import os import tensorstore as ts import torch from flax import serialization from flax.traverse_util import flatten_dict, unflatten_dict from tensorflow.io import gfile from transformers.modeling_utils import dtype_byte_size from transformers.models.switch_transformers...
226
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class UpperCAmelCase__ : '''simple docstring''' UpperCamelCase = None def snake_case__ ( self : List[str] ): '''sim...
226
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available __A ={ "configuration_longt5": ["LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP", "LongT5Config", "LongT5OnnxConfig"], } try: if not is_torch_available(): ...
226
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_ava...
226
1
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import ...
226
import argparse import shlex import runhouse as rh if __name__ == "__main__": # Refer to https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup for cloud access # setup instructions, if using on-demand hardware # If user passes --user <user> --hos...
226
1
# Lint as: python3 import itertools import os import re __A =re.compile(R"([A-Z]+)([A-Z][a-z])") __A =re.compile(R"([a-z\d])([A-Z])") __A =re.compile(R"(?<!_)_(?!_)") __A =re.compile(R"(_{2,})") __A =R"^\w+(\.\w+)*$" __A =R"<>:/\|?*" def a ( _...
226
import glob import os import random from string import ascii_lowercase, digits import cva __A ="" __A ="" __A ="" __A =1 # (0 is vertical, 1 is horizontal) def a ( ): '''simple docstring''' __UpperCAmelCase , __UpperCAmel...
226
1
from __future__ import annotations def a ( _UpperCAmelCase : float , _UpperCAmelCase : float , _UpperCAmelCase : float ): '''simple docstring''' if days_between_payments <= 0: raise ValueError('''days_between_payments ...
226
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, P...
226
1
def a ( _UpperCAmelCase : Any ): '''simple docstring''' __UpperCAmelCase : Any = 0 __UpperCAmelCase : str = len(_UpperCAmelCase ) for i in range(n - 1 ): for j in range(i + 1 , _UpperCAme...
226
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def a ( _UpperCAmelCase : Any , _UpperCAmelCase : Any=None ): '''simple docstring''' ...
226
1