code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
class lowerCamelCase__ : """simple docstring""" def __init__(self ): '''simple docstring''' lowerCamelCase = 0 lowerCamelCase = 0 lowerCamelCase = {} def _a (...
623
import argparse import os import re import numpy as np import PIL import torch from timm import create_model from torch.optim.lr_scheduler import OneCycleLR from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, RandomResizedCrop, Resize, ToTensor from acceler...
623
1
from __future__ import annotations import os from collections.abc import Mapping a_ : Optional[Any] = tuple[int, int] class lowerCamelCase__ : """simple docstring""" def __init__(self , __a , __a ): '''simple docstrin...
623
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from diffusers.u...
623
1
import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class lowerCamelCase__ : """simple docstring""" def __init__(self , __a ): ...
623
from __future__ import annotations def __lowercase( UpperCAmelCase__ ): """simple docstring""" lowerCamelCase = 2 lowerCamelCase = [] while i * i <= n: if n % i: i += 1 else: ...
623
1
from __future__ import annotations a_ : str = list[list[int]] # assigning initial values to the grid a_ : Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, 0, 8, 6, 3, 0, 0...
623
import socket def __lowercase( ): """simple docstring""" lowerCamelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) lowerCamelCase = socket.gethostname() lowerCamelCase = 12312 sock.connect((host, port...
623
1
from math import isqrt def __lowercase( UpperCAmelCase__ ): """simple docstring""" return all(number % divisor != 0 for divisor in range(2 , isqrt(UpperCAmelCase__ ) + 1 ) ) def __lowercase( UpperCAmelCase__ = 10**6 ): """simple docstring"""...
623
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( UpperCAmelCase_): """simple docstring""" _A = (PNDMScheduler,) _A = (('num_inference_steps', 50),) ...
623
1
from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor...
623
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets a_ : Tuple = datasets.logging.get_logger(__name__) a_ : List[str] = '\\n@InProceedings{moosavi2019minimum,\n...
623
1
import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version('>=', FSDP_PYTORCH_VERSION): import torch.distributed.checkpoint as dist_cp from torch.distributed.c...
623
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) a_ : Tuple = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} ...
623
1
def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: lowerCamelCase = mf_knapsack(i...
623
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 im...
623
1
def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" if a < 0 or b < 0: raise ValueError("the value of both inputs must be positive" ) lowerCamelCase = str(bin(UpperCAmelCase__ ) )[2:] # remove the leading "0...
623
from __future__ import annotations from math import pow, sqrt def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" if (resistance, reactance, impedance).count(0 ) != 1: raise ValueError("One and only one argume...
623
1
from __future__ import annotations import time a_ : Tuple = list[tuple[int, int]] a_ : List[Any] = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, ...
623
import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, Au...
623
1
import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_get, ...
623
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids...
623
1
import logging import os import sys from dataclasses import dataclass, field from typing import Optional import evaluate import numpy as np import torch from datasets import load_dataset from PIL import Image from torchvision.transforms import ( CenterCrop, Compose, Normalize, Ra...
623
a_ : Dict = 8.314462 # Unit - J mol-1 K-1 def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" if moles < 0 or kelvin < 0 or volume < 0: raise ValueError("Invalid inputs. Enter positive value." ) ...
623
1
from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Optional[Any] = logging.get_logger(__name__) a_ : Union[str, Any] = { 'facebook/xglm-564M': 'https://huggingface.co/facebook/xglm-564M/resolve/main/config.json', # See all XGLM models...
623
import argparse import json import os import torch from transformers import LukeConfig, LukeModel, LukeTokenizer, RobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , UpperCA...
623
1
def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" lowerCamelCase = [[] for _ in range(UpperCAmelCase__ )] lowerCamelCase = key - 1 if key <= 0: raise ValueError("Height of grid can't be 0 or...
623
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, re...
623
1
import math def __lowercase( UpperCAmelCase__ ): """simple docstring""" if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): lowerCamelCase = F"""Input value of [number={number}] must be an integer""" raise TypeError(UpperCAmelC...
623
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...
623
1
import unittest from transformers import DonutProcessor a_ : List[Any] = 'naver-clova-ix/donut-base' class lowerCamelCase__ ( unittest.TestCase): """simple docstring""" def _a (self ): '''simple docstring''' ...
623
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """...
623
1
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 a_ : Dict = False class lowerCamelCase__ ( unittest.T...
623
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_mo...
623
1
import collections import inspect import unittest from transformers import SwinvaConfig 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 imp...
623
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, ...
623
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a_ : str = logging.get_logger(__name__) a_ : List[Any] = { 'andreasmadsen/efficient_mlm_m0.40'...
623
def __lowercase( UpperCAmelCase__ ): """simple docstring""" if n == 1 or not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): return 0 elif n == 2: return 1 else: lowerCamelCase = [0, 1] for i i...
623
1
from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Any = logging.get_logger(__name__) a_ : int = { 'google/fnet-base': 'https://huggingface.co/google/fnet-base/resolve/main/config.json', 'google/fnet-large': 'https://huggingface.co/go...
623
from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def __lowercase( UpperCAmelCase__ = "laptop" ): """simple docstring""" lowerCamelCase = F"""https://www.amazon.in/laptop/s?k={product}""" l...
623
1
import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_params im...
623
from ..utils import DummyObject, requires_backends class lowerCamelCase__ ( metaclass=UpperCAmelCase_): """simple docstring""" _A = ['transformers', 'torch', 'note_seq'] def __init__(self , *__a , **__a ): ...
623
1
import numpy as np def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ = 1E-12 , UpperCAmelCase__ = 100 , ): """simple docstring""" assert np.shape(UpperCAmelCase__ )[0] == np.shape(UpperCAmelCase__ )[1] # Ensure proper dimensionality. a...
623
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf a_ : Any = logging.get_logger(__n...
623
1
import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils import logging if version.p...
623
import argparse import os import re import numpy as np import PIL import torch from timm import create_model from torch.optim.lr_scheduler import OneCycleLR from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, RandomResizedCrop, Resize, ToTensor from acceler...
623
1
def __lowercase( UpperCAmelCase__ ): """simple docstring""" if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): raise ValueError("Input series is not valid, valid series - [2, 4, 6]" ) if len(UpperCAmelCase__ ) == 0: raise ValueErro...
623
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from diffusers.u...
623
1
import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin...
623
from __future__ import annotations def __lowercase( UpperCAmelCase__ ): """simple docstring""" lowerCamelCase = 2 lowerCamelCase = [] while i * i <= n: if n % i: i += 1 else: ...
623
1
import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class lowerCamelCase__ ( unittest.TestCase): """simple docstring""" ...
623
import socket def __lowercase( ): """simple docstring""" lowerCamelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) lowerCamelCase = socket.gethostname() lowerCamelCase = 12312 sock.connect((host, port...
623
1
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 OptionalDependencyNotAvai...
623
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( UpperCAmelCase_): """simple docstring""" _A = (PNDMScheduler,) _A = (('num_inference_steps', 50),) ...
623
1
def __lowercase( UpperCAmelCase__ ): """simple docstring""" if num <= 0: raise ValueError("Input must be a positive integer" ) lowerCamelCase = [True] * (num + 1) lowerCamelCase = 2 while p * p <= num: ...
623
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets a_ : Tuple = datasets.logging.get_logger(__name__) a_ : List[str] = '\\n@InProceedings{moosavi2019minimum,\n...
623
1
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers ...
623
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) a_ : Tuple = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} ...
623
1
def __lowercase( UpperCAmelCase__ ): """simple docstring""" return " ".join( "".join(word[::-1] ) if len(UpperCAmelCase__ ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print...
623
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 im...
623
1
import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class lowerCamelCase__ ( tf.keras.optimizers.schedules.LearningRateS...
623
from __future__ import annotations from math import pow, sqrt def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" if (resistance, reactance, impedance).count(0 ) != 1: raise ValueError("One and only one argume...
623
1
import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCas...
623
import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, Au...
623
1
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 a_ : Any = logging.get_logger(__name__) a_ : Optional[int] = '▁' a_...
623
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids...
623
1
from scipy.stats import spearmanr import datasets a_ : Optional[int] = '\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 ...
623
a_ : Dict = 8.314462 # Unit - J mol-1 K-1 def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" if moles < 0 or kelvin < 0 or volume < 0: raise ValueError("Invalid inputs. Enter positive value." ) ...
623
1
from typing import Any def __lowercase( UpperCAmelCase__ ): """simple docstring""" if not input_list: return [] lowerCamelCase = [input_list.count(UpperCAmelCase__ ) for value in input_list] lowerCamelCase = max(UpperC...
623
import argparse import json import os import torch from transformers import LukeConfig, LukeModel, LukeTokenizer, RobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , UpperCA...
623
1
import numpy as np def __lowercase( UpperCAmelCase__ ): """simple docstring""" return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
623
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, re...
623
1
import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def __lowercase( UpperCAmelCase__ , UpperCAmelCase__=1 ): """simple docstring""" if n_shave_prefix_segments >= 0: return ".".join(path.split(...
623
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...
623
1
import itertools import math def __lowercase( UpperCAmelCase__ ): """simple docstring""" 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 nu...
623
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """...
623
1
from dataclasses import dataclass from typing import Optional import numpy as np import torch import torch.nn as nn from ..utils import BaseOutput, is_torch_version, randn_tensor from .attention_processor import SpatialNorm from .unet_ad_blocks import UNetMidBlockaD, get_down_block, get_up_block ...
623
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_mo...
623
1
a_ : List[Any] = { 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 __lowercase( UpperCAmelCase__ ): ...
623
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, ...
623
1
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration a_ : str = 5_0_0_0_0_0 a_ , a_ : Any = os.path.split(__file__) a_ : Dict = os.path.join(RESULTS_BASEPATH, 'results', RESULTS...
623
def __lowercase( UpperCAmelCase__ ): """simple docstring""" if n == 1 or not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): return 0 elif n == 2: return 1 else: lowerCamelCase = [0, 1] for i i...
623
1
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTConfig, MobileViTForImageClassification, MobileViTForSemanticSegmentation, MobileViTImageProcesso...
623
from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def __lowercase( UpperCAmelCase__ = "laptop" ): """simple docstring""" lowerCamelCase = F"""https://www.amazon.in/laptop/s?k={product}""" l...
623
1
from collections import Counter from timeit import timeit def __lowercase( UpperCAmelCase__ = "" , ): """simple docstring""" return sum(c % 2 for c in Counter(input_str.replace(" " , "" ).lower() ).values() ) < 2 def __lowercase( UpperCAmelCase__ = "" )...
623
from ..utils import DummyObject, requires_backends class lowerCamelCase__ ( metaclass=UpperCAmelCase_): """simple docstring""" _A = ['transformers', 'torch', 'note_seq'] def __init__(self , *__a , **__a ): ...
623
1
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" low...
623
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf a_ : Any = logging.get_logger(__n...
623
1
import os import tempfile import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from torch import nn from transformers import ( Adafactor, AdamW, get_cons...
623
import argparse import os import re import numpy as np import PIL import torch from timm import create_model from torch.optim.lr_scheduler import OneCycleLR from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, RandomResizedCrop, Resize, ToTensor from acceler...
623
1
from pathlib import Path import fire from tqdm import tqdm def __lowercase( UpperCAmelCase__="ro" , UpperCAmelCase__="en" , UpperCAmelCase__="wmt16" , UpperCAmelCase__=None ): """simple docstring""" try: import datasets except (ModuleNotFoundError, ...
623
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from diffusers.u...
623
1
def __lowercase( UpperCAmelCase__ = 1000 ): """simple docstring""" lowerCamelCase , lowerCamelCase = 1, 1 lowerCamelCase = 2 while True: lowerCamelCase = 0 lowerCamelCase = fa ...
623
from __future__ import annotations def __lowercase( UpperCAmelCase__ ): """simple docstring""" lowerCamelCase = 2 lowerCamelCase = [] while i * i <= n: if n % i: i += 1 else: ...
623
1
import argparse import json from pathlib import Path import torch import torchaudio from datasets import load_dataset from huggingface_hub import hf_hub_download from transformers import ASTConfig, ASTFeatureExtractor, ASTForAudioClassification from transformers.utils import logging logging.set...
623
import socket def __lowercase( ): """simple docstring""" lowerCamelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) lowerCamelCase = socket.gethostname() lowerCamelCase = 12312 sock.connect((host, port...
623
1
a_ : Dict = 8.314462 # Unit - J mol-1 K-1 def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" if moles < 0 or kelvin < 0 or volume < 0: raise ValueError("Invalid inputs. Enter positive value." ) ...
623
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( UpperCAmelCase_): """simple docstring""" _A = (PNDMScheduler,) _A = (('num_inference_steps', 50),) ...
623
1
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_mo...
623
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets a_ : Tuple = datasets.logging.get_logger(__name__) a_ : List[str] = '\\n@InProceedings{moosavi2019minimum,\n...
623
1
from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : int = logging.get_logger(__name__) a_ : Union[str, Any] = { 'caidas/swin2sr-classicalsr-x2-64': ( 'https://huggingface.co/caidas/swin2sr-classicalsr-x2-64/resolve/main/config.json...
623
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) a_ : Tuple = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} ...
623
1
import unittest from transformers import BigBirdConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax from transformers.mode...
623
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 im...
623
1
import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py a_ : Dict = '\\n@INPROCEEDINGS{Papineni02bleu:a,\n author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu},\n title = {BLEU: a Method for Au...
623
from __future__ import annotations from math import pow, sqrt def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" if (resistance, reactance, impedance).count(0 ) != 1: raise ValueError("One and only one argume...
623
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a_ : int = { 'configuration_roformer': ['ROFORMER_PRETRAINED_CONFIG_ARCH...
623
import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, Au...
623
1
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class lowerCamelCase__ : """simple docstring""" _A = 42 _A = 42 class lowerCamelCase__ : ...
623
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids...
623
1
from ....configuration_utils import PretrainedConfig from ....utils import logging a_ : Union[str, Any] = logging.get_logger(__name__) a_ : Optional[int] = { 'Visual-Attention-Network/van-base': ( 'https://huggingface.co/Visual-Attention-Network/van-base/blob/main/...
623
a_ : Dict = 8.314462 # Unit - J mol-1 K-1 def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" if moles < 0 or kelvin < 0 or volume < 0: raise ValueError("Invalid inputs. Enter positive value." ) ...
623
1
import socket def __lowercase( ): """simple docstring""" lowerCamelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) lowerCamelCase = socket.gethostname() lowerCamelCase = 12312 sock.connect((host, port...
623
import argparse import json import os import torch from transformers import LukeConfig, LukeModel, LukeTokenizer, RobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , UpperCA...
623
1
import math import sys def __lowercase( UpperCAmelCase__ ): """simple docstring""" lowerCamelCase = "" try: with open(UpperCAmelCase__ , "rb" ) as binary_file: lowerCamelCase = binary_file.read() ...
623
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, re...
623
1
def __lowercase( UpperCAmelCase__ = 50 ): """simple docstring""" lowerCamelCase = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_len...
623
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...
623
1
import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from transformers i...
623
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """...
623
1
import enum import warnings from .. import MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING from ..utils import add_end_docstrings, is_tf_available from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf class lowerCamelCase__ ( enu...
623
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_mo...
623
1
from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Optional[Any] = logging.get_logger(__name__) a_ : Dict = { 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models...
623
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, ...
623
1
import warnings from .generation import TFGenerationMixin class lowerCamelCase__ ( UpperCAmelCase_): """simple docstring""" warnings.warn( 'Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will ' 'be removed in...
623
def __lowercase( UpperCAmelCase__ ): """simple docstring""" if n == 1 or not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): return 0 elif n == 2: return 1 else: lowerCamelCase = [0, 1] for i i...
623
1
import re import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class lowerCamelCase__ ( UpperCAmelCase_): """simple docstring""" _A = ['image_processor', 'tokenizer'] _A = 'AutoImageProcessor' _...
623
from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def __lowercase( UpperCAmelCase__ = "laptop" ): """simple docstring""" lowerCamelCase = F"""https://www.amazon.in/laptop/s?k={product}""" l...
623
1
import argparse import os from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_task_guides.py a_ : int = 'src/transformers' a_ : Any = 'docs/sou...
623
from ..utils import DummyObject, requires_backends class lowerCamelCase__ ( metaclass=UpperCAmelCase_): """simple docstring""" _A = ['transformers', 'torch', 'note_seq'] def __init__(self , *__a , **__a ): ...
623
1
from scipy.stats import pearsonr import datasets a_ : List[Any] = '\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 relies on the assumption th...
623
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf a_ : Any = logging.get_logger(__n...
623
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a_ : Union[str, Any] = { 'configuration_nezha': ['NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'NezhaConfig'], } try: if not is_torch_availab...
623
import argparse import os import re import numpy as np import PIL import torch from timm import create_model from torch.optim.lr_scheduler import OneCycleLR from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, RandomResizedCrop, Resize, ToTensor from acceler...
623
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available, ) a_ : int = { 'configuration_speecht5': [ 'SPEECHT5_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SPEECHT5_PRET...
623
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from diffusers.u...
623
1
def __lowercase( UpperCAmelCase__ ): """simple docstring""" return 1 if digit in (0, 1) else (digit * factorial(digit - 1 )) def __lowercase( UpperCAmelCase__ ): """simple docstring""" lowerCamelCase = 0 lowerCamelC...
623
from __future__ import annotations def __lowercase( UpperCAmelCase__ ): """simple docstring""" lowerCamelCase = 2 lowerCamelCase = [] while i * i <= n: if n % i: i += 1 else: ...
623
1
def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" while a != 0: lowerCamelCase , lowerCamelCase = b % a, a return b def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ ): ...
623
import socket def __lowercase( ): """simple docstring""" lowerCamelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) lowerCamelCase = socket.gethostname() lowerCamelCase = 12312 sock.connect((host, port...
623
1
import argparse import importlib from pathlib import Path # Test all the extensions added in the setup a_ : Tuple = [ 'kernels/rwkv/wkv_cuda.cu', 'kernels/rwkv/wkv_op.cpp', 'kernels/deformable_detr/ms_deform_attn.h', 'kernels/deformable_detr/cuda/ms_deform_im2col_cuda.cuh...
623
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( UpperCAmelCase_): """simple docstring""" _A = (PNDMScheduler,) _A = (('num_inference_steps', 50),) ...
623
1
def __lowercase( UpperCAmelCase__ = 2000000 ): """simple docstring""" lowerCamelCase = [0 for i in range(n + 1 )] lowerCamelCase = 1 lowerCamelCase = 1 for i in range(2 , int(n**0.5 ) + 1 ): if p...
623
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets a_ : Tuple = datasets.logging.get_logger(__name__) a_ : List[str] = '\\n@InProceedings{moosavi2019minimum,\n...
623
1
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : int = logging.get_logger(__name__) a_ : str = { 'asapp/sew-d-tiny-100k': 'https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json', ...
623
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) a_ : Tuple = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} ...
623
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available a_ : Any = { 'configuration_gpt_neo': ['GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTNeoConfig', 'GPTNeoOnnxConfig'], } try: if not is_torch_...
623
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 im...
623
1
from __future__ import annotations import matplotlib.pyplot as plt # type: ignore import numpy # initial triangle of Koch snowflake a_ : Optional[int] = numpy.array([0, 0]) a_ : int = numpy.array([0.5, 0.8660254]) a_ : Dict = numpy.array([1, 0]) a_ : Optional[...
623
from __future__ import annotations from math import pow, sqrt def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" if (resistance, reactance, impedance).count(0 ) != 1: raise ValueError("One and only one argume...
623
1
import collections import gzip import os import urllib import numpy from tensorflow.python.framework import dtypes, random_seed from tensorflow.python.platform import gfile from tensorflow.python.util.deprecation import deprecated a_ : Optional[Any] = collections.namedtuple('_Datasets', ...
623
import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, Au...
623
1
import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, Au...
623
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids...
623
1
import numpy as np def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" return np.where(vector > 0 , UpperCAmelCase__ , (alpha * (np.exp(UpperCAmelCase__ ) - 1)) ) if __name__ == "__main__": import doctest doctest.testmod()
623
a_ : Dict = 8.314462 # Unit - J mol-1 K-1 def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" if moles < 0 or kelvin < 0 or volume < 0: raise ValueError("Invalid inputs. Enter positive value." ) ...
623
1
import os import sys import unittest a_ : List[Any] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import get_test_info # noqa: E402 from get_test_info import ( # noqa: E402 get_model_to_test_map...
623
import argparse import json import os import torch from transformers import LukeConfig, LukeModel, LukeTokenizer, RobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , UpperCA...
623
1
a_ : Union[str, Any] = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} a_ : Optional[int] = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" lowerC...
623
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, re...
623
1
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, ...
623
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...
623
1
from __future__ import annotations from random import random class lowerCamelCase__ : """simple docstring""" def __init__(self , __a = None ): '''simple docstring''' lowerCamelCase = value lowerCamel...
623
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """...
623
1
from ..utils import DummyObject, requires_backends class lowerCamelCase__ ( metaclass=UpperCAmelCase_): """simple docstring""" _A = ['transformers', 'torch', 'note_seq'] def __init__(self , *__a , **__a ): ...
623
from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_mo...
623
1
def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" lowerCamelCase = len(UpperCAmelCase__ ) lowerCamelCase = len(UpperCAmelCase__ ) lowerCamelCase = [[False for _ in range(m + 1 )] for _ in ...
623
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, ...
623
1
from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time a_ : Optional[int] = Lock() def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__...
623
def __lowercase( UpperCAmelCase__ ): """simple docstring""" if n == 1 or not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): return 0 elif n == 2: return 1 else: lowerCamelCase = [0, 1] for i i...
623
1
import mpmath # for roots of unity import numpy as np class lowerCamelCase__ : """simple docstring""" def __init__(self , __a=None , __a=None ): '''simple docstring''' lowerCamelCase = list(poly_a or [0]...
623
from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def __lowercase( UpperCAmelCase__ = "laptop" ): """simple docstring""" lowerCamelCase = F"""https://www.amazon.in/laptop/s?k={product}""" l...
623
1
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids...
623
from ..utils import DummyObject, requires_backends class lowerCamelCase__ ( metaclass=UpperCAmelCase_): """simple docstring""" _A = ['transformers', 'torch', 'note_seq'] def __init__(self , *__a , **__a ): ...
623
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : List[str] = logging.get_logger(__name__) a_ : Optional[Any] = { 'microsoft/git-base': 'https://huggingface.co/microsoft/git-base/resolve...
623
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf a_ : Any = logging.get_logger(__n...
623
1
import math import unittest from transformers import BioGptConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common i...
623
import argparse import os import re import numpy as np import PIL import torch from timm import create_model from torch.optim.lr_scheduler import OneCycleLR from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, RandomResizedCrop, Resize, ToTensor from acceler...
623
1
from __future__ import annotations from math import pow, sqrt def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" if (resistance, reactance, impedance).count(0 ) != 1: raise ValueError("One and only one argume...
623
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from diffusers.u...
623
1
from decimal import Decimal, getcontext from math import ceil, factorial def __lowercase( UpperCAmelCase__ ): """simple docstring""" if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): raise TypeError("Undefined for non-integers" ) elif precis...
623
from __future__ import annotations def __lowercase( UpperCAmelCase__ ): """simple docstring""" lowerCamelCase = 2 lowerCamelCase = [] while i * i <= n: if n % i: i += 1 else: ...
623
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : int = logging.get_logger(__name__) a_ : List[Any] = { 'BAAI/AltCLIP': 'https://huggingface.co/BAAI/AltCLIP/resolve/main/config.json', ...
623
import socket def __lowercase( ): """simple docstring""" lowerCamelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) lowerCamelCase = socket.gethostname() lowerCamelCase = 12312 sock.connect((host, port...
623
1
from __future__ import annotations from collections.abc import MutableSequence class lowerCamelCase__ : """simple docstring""" def __init__(self , __a , __a ): '''simple docstring''' if len(__a ) != degree + 1: ...
623
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( UpperCAmelCase_): """simple docstring""" _A = (PNDMScheduler,) _A = (('num_inference_steps', 50),) ...
623
1
import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency a_ : int = { 'E': 12.70, 'T': 9.06, 'A': 8.17, 'O': 7.51, 'I': 6.97, 'N': 6.75, 'S': 6.33, 'H': 6.09, 'R': 5.99, 'D': 4.25, 'L': 4.03, 'C': 2.78, '...
623
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets a_ : Tuple = datasets.logging.get_logger(__name__) a_ : List[str] = '\\n@InProceedings{moosavi2019minimum,\n...
623
1
from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMix...
623
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) a_ : Tuple = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} ...
623
1
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowerCamelCase__ ( UpperCAmelCase_): """simple docstring""" _A = (PNDMScheduler,) _A = (('num_inference_steps', 50),) ...
623
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 im...
623
1
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from diffusers.u...
623
from __future__ import annotations from math import pow, sqrt def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" if (resistance, reactance, impedance).count(0 ) != 1: raise ValueError("One and only one argume...
623
1
import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLICommand if not is_tf_ava...
623
import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, Au...
623
1
import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder a_ : Optional[Any] = '__DUMMY_TRANSFORMERS_USER__' a_ : List[Any] = 'Dummy User' a_ : Optional[Any] = 'hf_...
623
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids...
623
1
import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer a_ : Optional[An...
623
a_ : Dict = 8.314462 # Unit - J mol-1 K-1 def __lowercase( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ): """simple docstring""" if moles < 0 or kelvin < 0 or volume < 0: raise ValueError("Invalid inputs. Enter positive value." ) ...
623
1