code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedC...
707
"""simple docstring""" import importlib import torch import yaml from omegaconf import OmegaConf from taming.models.vqgan import VQModel def __magic_name__ ( _lowerCamelCase : int , _lowerCamelCase : Optional[Any]=False ): __a : Dict = Omeg...
63
0
"""simple docstring""" from math import pi, sqrt def __magic_name__ ( _lowerCamelCase : float ): if num <= 0: raise ValueError("""math domain error""" ) if num > 1_7_1.5: raise OverflowError("""math range error""" ) el...
708
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) lowercase__ = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_...
63
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) lowercase__ = {"configuration_reformer": ["REFORMER_PRETRAINED_CONFIG_...
709
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { "microsoft/unispeech-large-1500h-cv": ( "https://huggingface.co/microsoft/...
63
0
"""simple docstring""" from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class SCREAMING_SNAKE_CASE__ : _lowerCAmelCase = 4_2 _lowerCAmelCase = 4_2 ...
710
"""simple docstring""" import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_availabl...
63
0
"""simple docstring""" from ..utils import ( OptionalDependencyNotAvailable, is_flax_available, is_scipy_available, is_torch_available, is_torchsde_available, ) try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ..utils.dum...
711
"""simple docstring""" from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class SCRE...
63
0
"""simple docstring""" import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers impo...
712
"""simple docstring""" import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers impo...
63
0
"""simple docstring""" from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def __magic_name__ ( _lowerCamelCase : str , _lowerCamelCase : str , _lowerCamelCase : Optional[str] = None ): ...
713
"""simple docstring""" import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils i...
63
0
"""simple docstring""" import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets lowercase__ = "\n@inproceedings{xu-etal-2016-optimizing,\n title = {Optimizing Statistical Machine Translation for Text Simpl...
714
"""simple docstring""" import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": lowercase__ = argparse.ArgumentParser() parser.add_argument( "--checkpoint_path", default=None, type=str, requi...
63
0
"""simple docstring""" 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 lowercase__ = collections.namedtuple(...
715
"""simple docstring""" import torch from diffusers import DiffusionPipeline class SCREAMING_SNAKE_CASE__ ( __snake_case ): def __init__(self , _lowercase , _lowercase ): '''simple docstring''' super().__init__(...
63
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowercase__ = {"configur...
716
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { "sayakpaul/vit-msn-base": "https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json", # See all ViT M...
63
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowercase__ = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
717
"""simple docstring""" 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 ...
63
0
"""simple docstring""" class SCREAMING_SNAKE_CASE__ : def __init__(self ): '''simple docstring''' __a : dict[str, TrieNode] = {} # Mapping from char to TrieNode __a : List[Any] = False d...
718
"""simple docstring""" import os def __magic_name__ ( _lowerCamelCase : Dict ): __a : List[str] = len(grid[0] ) __a : int = len(_lowerCamelCase ) __a : Tuple = 0 __a : List[Any] = ...
63
0
"""simple docstring""" import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeli...
719
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class SCREAMING_SNAKE_CASE_...
63
0
"""simple docstring""" import qiskit def __magic_name__ ( _lowerCamelCase : int , _lowerCamelCase : int ): __a : Optional[int] = qiskit.Aer.get_backend("""aer_simulator""" ) # Create a Quantum Circuit acting on the q register ...
720
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TextClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, req...
63
0
"""simple docstring""" def __magic_name__ ( _lowerCamelCase : Tuple , _lowerCamelCase : Tuple ): print("""\nThe shortest path matrix using Floyd Warshall algorithm\n""" ) for i in range(_lowerCamelCase ): for j in range(_lowerCamelCase ):...
721
"""simple docstring""" import unittest from knapsack import knapsack as k class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): def lowerCAmelCase__(self ): '''simple docstring''' __a : str = 0 __...
63
0
"""simple docstring""" from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __magic_name__ ( _lowerCamelCase : int ): __a : Optional[int] = prime_factors(_lowerCamelCase ) if is_square_free(_lowerCa...
700
"""simple docstring""" from manim import * class SCREAMING_SNAKE_CASE__ ( __snake_case ): def lowerCAmelCase__(self ): '''simple docstring''' __a : List[str] = Rectangle(height=0.5 , width=0.5 ) ...
63
0
"""simple docstring""" lowercase__ = { "a": "AAAAA", "b": "AAAAB", "c": "AAABA", "d": "AAABB", "e": "AABAA", "f": "AABAB", "g": "AABBA", "h": "AABBB", "i": "ABAAA", "j": "BBBAA", "k": "ABAAB", "l": "ABABA", "m": "ABABB", "n": "ABBAA"...
701
"""simple docstring""" def __magic_name__ ( _lowerCamelCase : int , _lowerCamelCase : float , _lowerCamelCase : float ): return round(float(moles / volume ) * nfactor ) def __magic_name__ ( _lowerCamelCase : float , _lowerC...
63
0
import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging lowercase__ = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( __snake_case ): ...
702
"""simple docstring""" def __magic_name__ ( _lowerCamelCase : list[int] ): if not nums: # Makes sure that the list is not empty raise ValueError("""List is empty""" ) __a : Any = sum(_lowerCamelCase ) / len(_lowerCamelCase ) # C...
63
0
"""simple docstring""" from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientStat...
703
"""simple docstring""" import math import sys import cva import numpy as np def __magic_name__ ( _lowerCamelCase : np.ndarray , _lowerCamelCase : float ): # For applying gaussian function for each element in matrix. __a : int = math....
63
0
"""simple docstring""" import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tok...
704
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __magic_name__ ( ): __a : Dict = { """repo_name""": ["""test_repo1""", """test_rep...
63
0
"""simple docstring""" import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": lowercase__ = argparse.ArgumentParser() parser.add_argument( "--checkpoint_path", default=None, type=str, requi...
705
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tensorflow_text_available, is_torch_available lowercase__ = { "configuration_ernie": ["ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP", "ErnieConfig", "ErnieOnnxConfig"], } ...
63
0
"""simple docstring""" import qiskit def __magic_name__ ( _lowerCamelCase : int , _lowerCamelCase : int ): __a : List[Any] = qiskit.Aer.get_backend("""aer_simulator""" ) # Create a Quantum Circuit acting on the q register __...
706
"""simple docstring""" import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging lowercase__ = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( __...
63
0
"""simple docstring""" from tempfile import TemporaryDirectory from unittest import TestCase from unittest.mock import MagicMock, patch from transformers import AutoModel, TFAutoModel from transformers.onnx import FeaturesManager from transformers.testing_utils import SMALL_MODEL_IDENTIFIER, require_t...
707
"""simple docstring""" import importlib import torch import yaml from omegaconf import OmegaConf from taming.models.vqgan import VQModel def __magic_name__ ( _lowerCamelCase : int , _lowerCamelCase : Optional[Any]=False ): __a : Dict = Omeg...
63
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor lowercase__ = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( __snake_case ): def __init__(self , *_lowercase , *...
708
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) lowercase__ = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_...
63
0
"""simple docstring""" from __future__ import annotations from random import random class SCREAMING_SNAKE_CASE__ : def __init__(self , _lowercase = None ): '''simple docstring''' __a : List[Any] = value ...
709
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { "microsoft/unispeech-large-1500h-cv": ( "https://huggingface.co/microsoft/...
63
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { "facebook/s2t-wav2vec2-large-en-de": ( "https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/c...
710
"""simple docstring""" import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_availabl...
63
0
"""simple docstring""" import argparse import os # New Code # 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 ...
711
"""simple docstring""" from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class SCRE...
63
0
"""simple docstring""" from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class SCREAMING_SNAKE_CASE__ ( yaml.SafeLoader ): def lowerCAmelCase__(self , _lowercase ): '''simple ...
712
"""simple docstring""" import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers impo...
63
0
"""simple docstring""" class SCREAMING_SNAKE_CASE__ : def __init__(self , _lowercase ): '''simple docstring''' __a : Union[str, Any] = size __a : Dict = [0] * size __a : Tuple...
713
"""simple docstring""" import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils i...
63
0
"""simple docstring""" from __future__ import annotations def __magic_name__ ( _lowerCamelCase : str ): return [ord(_lowerCamelCase ) - 9_6 for elem in plain] def __magic_name__ ( _lowerCamelCase : list[int] ): return "".join(chr(e...
714
"""simple docstring""" import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": lowercase__ = argparse.ArgumentParser() parser.add_argument( "--checkpoint_path", default=None, type=str, requi...
63
0
"""simple docstring""" def __magic_name__ ( _lowerCamelCase : list ): if len(_lowerCamelCase ) <= 1: return lst __a : Tuple = 1 while i < len(_lowerCamelCase ): if lst[i - 1] <= lst[i]: i...
715
"""simple docstring""" import torch from diffusers import DiffusionPipeline class SCREAMING_SNAKE_CASE__ ( __snake_case ): def __init__(self , _lowercase , _lowercase ): '''simple docstring''' super().__init__(...
63
0
"""simple docstring""" from collections import deque def __magic_name__ ( _lowerCamelCase : int ): __a : Optional[Any] = len(_lowerCamelCase ) __a : int = deque() __a : List[str] = [False for _ in range(_...
716
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { "sayakpaul/vit-msn-base": "https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json", # See all ViT M...
63
0
"""simple docstring""" import argparse import tensorflow as tf import torch from transformers import BertConfig, BertForMaskedLM from transformers.models.bert.modeling_bert import ( BertIntermediate, BertLayer, BertOutput, BertPooler, BertSelfAttention, BertSelfOutput, ...
717
"""simple docstring""" 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 ...
63
0
"""simple docstring""" from __future__ import annotations from math import pi # Define the Reduced Planck Constant ℏ (H bar), speed of light C, value of # Pi and the function lowercase__ = 1.054_571_817e-34 # unit of ℏ : J * s lowercase__ = 3e8 # unit of c : m * s^-1 def ...
718
"""simple docstring""" import os def __magic_name__ ( _lowerCamelCase : Dict ): __a : List[str] = len(grid[0] ) __a : int = len(_lowerCamelCase ) __a : Tuple = 0 __a : List[Any] = ...
63
0
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class SCREAMING_SN...
719
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class SCREAMING_SNAKE_CASE_...
63
0
"""simple docstring""" from __future__ import annotations lowercase__ = list[list[int]] # assigning initial values to the grid lowercase__ = [ [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,...
720
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TextClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, req...
63
0
"""simple docstring""" from manim import * class SCREAMING_SNAKE_CASE__ ( __snake_case ): def lowerCAmelCase__(self ): '''simple docstring''' __a : List[str] = Rectangle(height=0.5 , width=0.5 ) ...
721
"""simple docstring""" import unittest from knapsack import knapsack as k class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): def lowerCAmelCase__(self ): '''simple docstring''' __a : str = 0 __...
63
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { "facebook/timesformer": "https://huggingface.co/facebook/timesformer/resolve/main/config.json", } class SCREAM...
700
"""simple docstring""" from manim import * class SCREAMING_SNAKE_CASE__ ( __snake_case ): def lowerCAmelCase__(self ): '''simple docstring''' __a : List[str] = Rectangle(height=0.5 , width=0.5 ) ...
63
0
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __magic_name__ ( ): __a : Dict = { """repo_name""": ["""test_repo1""", """test_rep...
701
"""simple docstring""" def __magic_name__ ( _lowerCamelCase : int , _lowerCamelCase : float , _lowerCamelCase : float ): return round(float(moles / volume ) * nfactor ) def __magic_name__ ( _lowerCamelCase : float , _lowerC...
63
0
from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler...
702
"""simple docstring""" def __magic_name__ ( _lowerCamelCase : list[int] ): if not nums: # Makes sure that the list is not empty raise ValueError("""List is empty""" ) __a : Any = sum(_lowerCamelCase ) / len(_lowerCamelCase ) # C...
63
0
"""simple docstring""" import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_availabl...
703
"""simple docstring""" import math import sys import cva import numpy as np def __magic_name__ ( _lowerCamelCase : np.ndarray , _lowerCamelCase : float ): # For applying gaussian function for each element in matrix. __a : int = math....
63
0
"""simple docstring""" 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 note...
704
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __magic_name__ ( ): __a : Dict = { """repo_name""": ["""test_repo1""", """test_rep...
63
0
"""simple docstring""" import inspect import logging import os import random import shutil import tempfile import unittest import pytest import torch from torch import nn from torch.utils.data import DataLoader, TensorDataset from accelerate import Accelerator from accelerate.test_utils impor...
705
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tensorflow_text_available, is_torch_available lowercase__ = { "configuration_ernie": ["ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP", "ErnieConfig", "ErnieOnnxConfig"], } ...
63
0
"""simple docstring""" import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( """files""" , [ ["""full:README.md""", """dataset_infos.json"""], ...
706
"""simple docstring""" import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging lowercase__ = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( __...
63
0
"""simple docstring""" from __future__ import annotations lowercase__ = "Muhammad Umer Farooq" lowercase__ = "MIT" lowercase__ = "1.0.0" lowercase__ = "Muhammad Umer Farooq" lowercase__ = "contact@muhammadumerfarooq.me" lowercase__ = "Alpha" import re from html...
707
"""simple docstring""" import importlib import torch import yaml from omegaconf import OmegaConf from taming.models.vqgan import VQModel def __magic_name__ ( _lowerCamelCase : int , _lowerCamelCase : Optional[Any]=False ): __a : Dict = Omeg...
63
0
"""simple docstring""" from __future__ import annotations lowercase__ = [True] * 1000001 lowercase__ = 2 while i * i <= 1000000: if seive[i]: for j in range(i * i, 1000001, i): lowercase__ = False i += 1 def __magic_name__ ( _lowerCamelCase : int ...
708
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) lowercase__ = { "configuration_llama": ["LLAMA_PRETRAINED_CONFIG_...
63
0
"""simple docstring""" def __magic_name__ ( _lowerCamelCase : int , _lowerCamelCase : float , _lowerCamelCase : float ): return round(float(moles / volume ) * nfactor ) def __magic_name__ ( _lowerCamelCase : float , _lowerC...
709
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { "microsoft/unispeech-large-1500h-cv": ( "https://huggingface.co/microsoft/...
63
0
"""simple docstring""" 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 __magic_name__ ( _lowerCamelCase : List[Any] , _lowerCamelCase : List[str] )...
710
"""simple docstring""" import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_availabl...
63
0
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LDMTextToImagePipeline, UNetaDConditionModel from diffusers.utils.testing_utils import ( enable_full_deter...
711
"""simple docstring""" from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) class SCRE...
63
0
"""simple docstring""" import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercas...
712
"""simple docstring""" import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers impo...
63
0
"""simple docstring""" def __magic_name__ ( _lowerCamelCase : int = 1_0**1_2 ): __a : List[str] = 1 __a : Any = 0 __a : Any = 1 __a : List[Any] = 1 while numerator <= 2 * min_total - ...
713
"""simple docstring""" import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils i...
63
0
"""simple docstring""" import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingT...
714
"""simple docstring""" import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": lowercase__ = argparse.ArgumentParser() parser.add_argument( "--checkpoint_path", default=None, type=str, requi...
63
0
"""simple docstring""" from __future__ import annotations def __magic_name__ ( _lowerCamelCase : list[int] ): # This function is recursive __a : str = len(_lowerCamelCase ) # If the array contains only one element, we return it (it's the stop ...
715
"""simple docstring""" import torch from diffusers import DiffusionPipeline class SCREAMING_SNAKE_CASE__ ( __snake_case ): def __init__(self , _lowercase , _lowercase ): '''simple docstring''' super().__init__(...
63
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor lowercase__ = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( __snake_case ): def __init__(self , *_lowerca...
716
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { "sayakpaul/vit-msn-base": "https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json", # See all ViT M...
63
0
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJob...
717
"""simple docstring""" 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 ...
63
0
"""simple docstring""" import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import DetrConfig, MaskFormerConfig, SwinConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch...
718
"""simple docstring""" import os def __magic_name__ ( _lowerCamelCase : Dict ): __a : List[str] = len(grid[0] ) __a : int = len(_lowerCamelCase ) __a : Tuple = 0 __a : List[Any] = ...
63
0
"""simple docstring""" from collections.abc import Iterable from typing import Any class SCREAMING_SNAKE_CASE__ : def __init__(self , _lowercase = None ): '''simple docstring''' __a : int = value _...
719
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class SCREAMING_SNAKE_CASE_...
63
0
"""simple docstring""" from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def __magic_name__ ( _lowerCamelCase : int , _lowerCamelCase : int , _lowerCamelCase : float = 1 / sqrt(2 ) ): __a : Optional[int] ...
720
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TextClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, req...
63
0
"""simple docstring""" import tempfile import unittest from make_student import create_student_by_copying_alternating_layers from transformers import AutoConfig from transformers.file_utils import cached_property from transformers.testing_utils import require_torch lowercase__ = "sshleife...
721
"""simple docstring""" import unittest from knapsack import knapsack as k class SCREAMING_SNAKE_CASE__ ( unittest.TestCase ): def lowerCAmelCase__(self ): '''simple docstring''' __a : str = 0 __...
63
0
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu_available(check_device=False): ...
64
import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore A_ : Dict = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" A_ : Optional[Any] = [file for file in filepaths if file != f...
64
1
import inspect import logging import os import random import shutil import tempfile import unittest import pytest import torch from torch import nn from torch.utils.data import DataLoader, TensorDataset from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_cuda from ...
64
import inspect import warnings from typing import Any, Dict, Optional, Union from packaging import version def UpperCamelCase (*lowercase_: Optional[int] , lowercase_: Optional[Union[Dict, Any]] = None , lowercase_: Dict=True , lowercase_: Tuple=2 ) -> Dict: from .. imp...
64
1
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTesterMix...
64
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.convert_switch_t...
64
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : str = { 'configuration_blip_2': [ 'BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Blip2Config', 'Blip2QFormerConfig', 'Blip2VisionConfig', ], '...
64
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available A_ : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass else: A_ : str ...
64
1
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch i...
64
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration A_ : Dict = { 'tiny.en': 'https://openaipublic.azureedge.net/main/whisper/models/d3dd57d32accea0b29...
64
1
import warnings from .generation import TFGenerationMixin class _a (__magic_name__ ): '''simple docstring''' warnings.warn( '''Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will ''' '''be removed in Transformers v5. I...
64
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils import is_xformers_availabl...
64
1
def UpperCamelCase (lowercase_: int = 1000 ) -> int: A__ : Dict = -1 A__ : str = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c A__ : Optional[int] = (n * n - 2 * a * n) // (2 * n -...
64
def UpperCamelCase (lowercase_: int ) -> int: if not isinstance(lowercase_ , lowercase_ ): raise TypeError("""Input value must be an 'int' type""" ) A__ : int = 0 while number: position += 1 number >>= 1 return position if __name__ == "__main__": import...
64
1
import enum import shutil import sys A_ , A_ : Optional[Any] = shutil.get_terminal_size() A_ : Optional[int] = {'UP': 'A', 'DOWN': 'B', 'RIGHT': 'C', 'LEFT': 'D'} class _a (enum.Enum ): '''simple docstring''' UpperCAmelCase__: str = 0 ...
64
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def UpperCamelCase (lowercase_: np.ndarray , lowercase_: np.ndarray , lowercase_: np.ndarray , lowercase_: int , lowercase_: int ) -> np.ndarray: A__ : Any ...
64
1
import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset from transformers import AutoTo...
64
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @require_torch class _...
64
1
from __future__ import annotations from collections.abc import Iterator from typing import Any class _a : '''simple docstring''' def __init__( self , A__ ): A__ : Any = data A__ : Node | None = None class _a : '''simple ...
64
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow having multiple repository ...
64
1
def UpperCamelCase (lowercase_: Optional[int] ) -> List[Any]: A__ : Any = 0 A__ : int = len(lowercase_ ) for i in range(n - 1 ): for j in range(i + 1 , lowercase_ ): if arr[i] > arr[j]: num_inversions += 1 return num_inversions def...
64
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 import Config...
64
1
from datetime import datetime as dt import os from github import Github A_ : Optional[int] = [ 'good first issue', 'good second issue', 'good difficult issue', 'feature request', 'new model', 'wip', ] def UpperCamelCase () -> Dict: A__ : Union[str, Any] ...
64
class _a : '''simple docstring''' def __init__( self ): A__ : str = """""" A__ : Any = """""" A__ : List[Any] = [] def __A ( self , A__ , A__ ): if m == -1: return n + 1 ...
64
1
def UpperCamelCase (lowercase_: list ) -> list: if len(lowercase_ ) <= 1: return [tuple(lowercase_ )] A__ : Optional[Any] = [] def generate(lowercase_: int , lowercase_: list ): A__ : int = [0] * n res.append(tuple(lowercase_ ...
64
def UpperCamelCase (lowercase_: int , lowercase_: int ) -> int: while second != 0: A__ : int = first & second first ^= second A__ : int = c << 1 return first if __name__ == "__main__": import doctest doctest.testmod() A_ : Optional[Any] ...
64
1
A_ : Any = [ 'DownloadConfig', 'DownloadManager', 'DownloadMode', 'StreamingDownloadManager', ] from .download_config import DownloadConfig from .download_manager import DownloadManager, DownloadMode from .streaming_download_manager import StreamingDownloadManager
64
from __future__ import annotations from collections.abc import Callable A_ : List[Any] = list[list[float | int]] def UpperCamelCase (lowercase_: Matrix , lowercase_: Matrix ) -> Matrix: A__ : int = len(lowercase_ ) A__ : Matrix = [[0 for...
64
1
from __future__ import annotations from math import pi def UpperCamelCase (lowercase_: float , lowercase_: float , lowercase_: float ) -> dict[str, float]: if (inductance, frequency, reactance).count(0 ) != 1: raise ValueError("""One and only one argument must be 0""" ...
64
from functools import lru_cache @lru_cache def UpperCamelCase (lowercase_: int ) -> int: if num < 0: raise ValueError("""Number should not be negative.""" ) return 1 if num in (0, 1) else num * factorial(num - 1 ) if __name__ == "__main__": import doctest doctest.testmod()
64
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) A_ : Dict = { 'configuration_speech_to_text': ['SPEECH_TO_TEXT_PRETRAINED_CONFIG_ARCHI...
64
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 _a (datasets.BeamBasedBuilder ): '''simple docstring''' def __A ( self ):...
64
1
A_ : int = tuple[float, float, float] A_ : Optional[Any] = tuple[float, float, float] def UpperCamelCase (lowercase_: Pointad , lowercase_: Pointad ) -> Vectorad: A__ : List[Any] = end_pointa[0] - end_pointa[0] A__ : Union[str, Any] ...
64
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor A_ : Union[str, Any] = logging.get_logger(__name__) class _a (__magic_name__ ): '''simple docstring''' def __init__( self , *A__ , **A__ ): ...
64
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 from ..auto import CONFIG_MAPPING A_ : Union[str, Any] = logging.get_logger(__name__) A_ : An...
64
import inspect import logging import os import random import shutil import tempfile import unittest import pytest import torch from torch import nn from torch.utils.data import DataLoader, TensorDataset from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_cuda from ...
64
1
import argparse import torch from safetensors.torch import load_file from diffusers import StableDiffusionPipeline def UpperCamelCase (lowercase_: Optional[int] , lowercase_: str , lowercase_: Any , lowercase_: List[Any] , lowercase_: Tuple ) -> Any: # load ba...
64
def UpperCamelCase (lowercase_: str , lowercase_: str ) -> bool: A__ : Union[str, Any] = len(lowercase_ ) A__ : List[Any] = len(lowercase_ ) A__ : List[Any] = [[False for _ in range(m + 1 )] for _ in range(n + 1 )] A__ ...
64
1
def UpperCamelCase (lowercase_: int ) -> bool: return number & 1 == 0 if __name__ == "__main__": import doctest doctest.testmod()
64
import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceFeatu...
64
1
import importlib import os import sys # This is required to make the module import works (when the python process is running from the root of the repo) sys.path.append('.') def UpperCamelCase (lowercase_: Union[str, Any] ) -> Optional[int]: A__ : Union[str, Any] = test_file.split...
64
from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class _a (__magi...
64
1
def UpperCamelCase (lowercase_: int = 10 , lowercase_: int = 22 ) -> int: A__ : Any = range(1 , lowercase_ ) A__ : str = range(1 , lowercase_ ) return sum( 1 for power in powers for base in bases if len(str(base**power ) ...
64
import io import itertools import json from dataclasses import dataclass from typing import Optional import pyarrow as pa import pyarrow.json as paj import datasets from datasets.table import table_cast from datasets.utils.file_utils import readline A_ : Tuple = datasets.utils.logging.get_logger(__nam...
64
1
import os import pytest from attr import dataclass A_ : Union[str, Any] = 'us-east-1' # defaults region @dataclass class _a : '''simple docstring''' UpperCAmelCase__: str UpperCAmelCase__: Any = '''arn:aws:iam::558105141721:role/sagemaker_execution_r...
64
import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore A_ : Dict = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" A_ : Optional[Any] = [file for file in filepaths if file != f...
64
1
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, flip_channel_order, get_resize_output_image_size, rescale, resize, to_channel_dimensio...
64
import inspect import warnings from typing import Any, Dict, Optional, Union from packaging import version def UpperCamelCase (*lowercase_: Optional[int] , lowercase_: Optional[Union[Dict, Any]] = None , lowercase_: Dict=True , lowercase_: Tuple=2 ) -> Dict: from .. imp...
64
1
import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class _a (__magic_name__ ): '''simple docstring''' @require_torch def __A ( self ): # this...
64
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.convert_switch_t...
64
1
from __future__ import annotations from typing import Generic, TypeVar A_ : Optional[Any] = TypeVar('T') class _a (Generic[T] ): '''simple docstring''' def __init__( self , A__ ): A__ : int = data A__ : Optional[int] ...
64
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available A_ : Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass else: A_ : str ...
64
1
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : int = logging.get_logger(__name__) A_ : Optional[Any] = { 'facebook/vit-mae-base': 'https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json', # See all ViT MAE models at https://huggi...
64
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration A_ : Dict = { 'tiny.en': 'https://openaipublic.azureedge.net/main/whisper/models/d3dd57d32accea0b29...
64
1
from __future__ import annotations import inspect import unittest from math import floor import numpy as np from transformers import CvtConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_c...
64
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils import is_xformers_availabl...
64
1
import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.stable_diffusion_safe i...
64
def UpperCamelCase (lowercase_: int ) -> int: if not isinstance(lowercase_ , lowercase_ ): raise TypeError("""Input value must be an 'int' type""" ) A__ : int = 0 while number: position += 1 number >>= 1 return position if __name__ == "__main__": import...
64
1
from __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup A_ : Union[str, Any] = 'https://www.indeed.co.in/jobs?q=mobile+app+development&l=' def UpperCamelCase (lowercase_: str = "mumbai" ) -> Generator[tuple[str, str], Non...
64
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def UpperCamelCase (lowercase_: np.ndarray , lowercase_: np.ndarray , lowercase_: np.ndarray , lowercase_: int , lowercase_: int ) -> np.ndarray: A__ : Any ...
64
1
from ..utils import DummyObject, requires_backends class _a (metaclass=__magic_name__ ): '''simple docstring''' UpperCAmelCase__: List[str] = ['''torch''', '''transformers''', '''onnx'''] def __init__( self , *A__ , **A__ ): requires_back...
64
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @require_torch class _...
64
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available A_ : int = {'configuration_glpn': ['GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GLPNConfig']} try: if not is_vision_available(): raise OptionalDependencyNotAvailable(...
64
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow having multiple repository ...
64
1
import argparse import torch from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert from transformers.utils import logging logging.set_verbosity_info() def UpperCamelCase (lowercase_: Optional[int] , lowercase_: Union[str, Any] , lowercase_: Optional[in...
64
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 import Config...
64
1
import darl # noqa import gym import tqdm from diffusers.experimental import ValueGuidedRLPipeline A_ : List[Any] = { 'n_samples': 64, 'horizon': 32, 'num_inference_steps': 20, 'n_guide_steps': 2, # can set to 0 for faster sampling, does not use value network 'scale_grad_by_std': T...
64
class _a : '''simple docstring''' def __init__( self ): A__ : str = """""" A__ : Any = """""" A__ : List[Any] = [] def __A ( self , A__ , A__ ): if m == -1: return n + 1 ...
64
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A_ : Optional[int] = { 'configuration_vision_encoder_decoder': ['VisionEncoderDecoderConfig', 'VisionEncoderDecoderOnnxC...
64
def UpperCamelCase (lowercase_: int , lowercase_: int ) -> int: while second != 0: A__ : int = first & second first ^= second A__ : int = c << 1 return first if __name__ == "__main__": import doctest doctest.testmod() A_ : Optional[Any] ...
64
1
from math import ceil from typing import List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor from ...utils import TensorType, logging A_ : List[str] = l...
64
from __future__ import annotations from collections.abc import Callable A_ : List[Any] = list[list[float | int]] def UpperCamelCase (lowercase_: Matrix , lowercase_: Matrix ) -> Matrix: A__ : int = len(lowercase_ ) A__ : Matrix = [[0 for...
64
1
def UpperCamelCase (lowercase_: list[int] , lowercase_: list[int] , lowercase_: int ) -> bool: return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(lowercase_ ) ) def UpperCamelCase (lowercase_: list[list[int]...
64
from functools import lru_cache @lru_cache def UpperCamelCase (lowercase_: int ) -> int: if num < 0: raise ValueError("""Number should not be negative.""" ) return 1 if num in (0, 1) else num * factorial(num - 1 ) if __name__ == "__main__": import doctest doctest.testmod()
64
1
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow having multiple repository ...
64
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 _a (datasets.BeamBasedBuilder ): '''simple docstring''' def __A ( self ):...
64
1
from PIL import Image def UpperCamelCase (lowercase_: Image ) -> Image: A__ , A__ : List[Any] = image.size A__ : Optional[int] = 0 A__ : Tuple = image.load() for i in range(lowercase_ ): for j in range(lowercase_ ): A__ ...
64
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor A_ : Union[str, Any] = logging.get_logger(__name__) class _a (__magic_name__ ): '''simple docstring''' def __init__( self , *A__ , **A__ ): ...
64
1
import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever A_ : List[Any] = logging.getLogger(__name__) class _a (__magic_name__ ): '''simple docstring''' ...
64
import inspect import logging import os import random import shutil import tempfile import unittest import pytest import torch from torch import nn from torch.utils.data import DataLoader, TensorDataset from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_cuda from ...
64
1
from math import factorial def UpperCamelCase (lowercase_: int , lowercase_: int ) -> 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 if n < k or k < 0: raise ValueError("""Please enter po...
64
def UpperCamelCase (lowercase_: str , lowercase_: str ) -> bool: A__ : Union[str, Any] = len(lowercase_ ) A__ : List[Any] = len(lowercase_ ) A__ : List[Any] = [[False for _ in range(m + 1 )] for _ in range(n + 1 )] A__ ...
64
1