code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase = 1000 ): lowerCamelCase__ : str = -1 lowerCamelCase__ : List[Any] = 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 lowerCam...
316
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class a_ ( snake_case_ ): '''simple docstring''' @staticmethod @abstractmethod def a__ (lowerCamelCase_ ): '''simple docstring''' raise NotImp...
316
1
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_OBJECT_DETECTION_MAPPING, AutoFeatureExtractor, AutoModelForObjectDetection, ObjectDetectionPipeline, is_vision_available, pipeline, ) from transformers.testing_utils import ( is_pipeline_test, nested_sim...
316
"""simple docstring""" import re def lowerCamelCase_ ( _lowerCamelCase ): if len(re.findall('[ATCG]' , _lowerCamelCase ) ) != len(_lowerCamelCase ): raise ValueError('Invalid Strand' ) return dna.translate(dna.maketrans('ATCG' , 'TAGC' ) ) if __name...
316
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : List[str] = '' for i in table: res += inp[i - 1] return res def lowerCamelCase_ ( _lowerCamelCase ): return data[1:] + data[0] def lowerCame...
316
"""simple docstring""" import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : Any ...
316
1
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ......
316
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ......
316
1
"""simple docstring""" import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn...
316
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): while second != 0: lowerCamelCase__ : Tuple = first & second first ^= second lowerCamelCase__ : int = c << 1 return first if __name__ == "__main__": i...
316
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : str = [0] * len(_lowerCamelCase ) lowerCamelCase__ : Any = [] lowerCamelCase__ : Dict = [] lowerCamelCase__ : List[Any] = 0 ...
316
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A_ : List[str] = {"configuration_encoder_decoder": ["EncoderDecoderConfig"]} try: if n...
316
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : List[Any] = { "configuration_megatron_bert": ["MEGATRON_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MegatronBertConfig"], } try: if not is_torch...
316
"""simple docstring""" import numpy as np def lowerCamelCase_ ( _lowerCamelCase ): return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
316
1
"""simple docstring""" from __future__ import annotations import string from itertools import cycle, product from pathlib import Path A_ : str = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) A_ : list[int] = [ord(letter) for letter in string...
316
"""simple docstring""" print((lambda quine: quine % quine)("print((lambda quine: quine %% quine)(%r))"))
316
1
"""simple docstring""" from __future__ import annotations A_ : List[Any] = 8.988E9 # units = N * m^s * C^-2 def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : List[Any] ...
316
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) A_ : int = { "configuration_clip": ...
316
1
"""simple docstring""" import multiprocessing import os from typing import BinaryIO, Optional, Union import fsspec from .. import Dataset, Features, NamedSplit, config from ..formatting import query_table from ..packaged_modules.json.json import Json from ..utils import logging from ..utils.typing import Neste...
316
"""simple docstring""" import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from datasets.config impo...
316
1
"""simple docstring""" from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException fr...
316
"""simple docstring""" class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_ ): '''simple docstring''' lowerCamelCase__ : Tuple = len(lowerCamelCase_ ) lowerCamelCase__ : Any = [0] * len_array ...
316
1
"""simple docstring""" import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoM...
316
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class a_ ( snake_case_ ): '''simple docstring''' lowerCamelCase__ : Dict = ['image_processor', 'tokenizer'] lowerCamelCase__...
316
1
"""simple docstring""" import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase=7 ): lowerCamelCase__ : List[str] = None if token is not None: l...
316
"""simple docstring""" import cva import numpy as np class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_, lowerCamelCase_ ): '''simple docstring''' if k in (0.04, 0.06): lowerCamelCase__ : Tuple = k lower...
316
1
"""simple docstring""" import math import tensorflow as tf from packaging import version def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Any = tf.convert_to_tensor(_lowerCamelCase ) lowerCamelCase__ : List[str] = 0.5 * (1.0 + tf.math.e...
316
"""simple docstring""" from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar A_ : str = TypeVar("KEY") A_ : List[Any] = TypeVar("VAL") @dataclass(frozen=snake_case_ , slots=snake_case_ ) class a_ (...
316
1
"""simple docstring""" import unittest from transformers import TrOCRConfig from transformers.testing_utils import is_torch_available, require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import...
316
"""simple docstring""" def lowerCamelCase_ ( ): lowerCamelCase__ : Optional[Any] = [] lowerCamelCase__ : List[Any] = 1 while len(_lowerCamelCase ) < 1e6: constant.append(str(_lowerCamelCase ) ) i += 1 lowerCamelCase__ : str = ...
316
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): while b: lowerCamelCase__ , lowerCamelCase__ : Dict = b, a % b return a def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): return a if b == 0...
316
"""simple docstring""" # Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position A_ : Union[str, Any] = "2.13.1" import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < ve...
316
1
"""simple docstring""" from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : ...
316
"""simple docstring""" import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings A_ : str = ...
316
1
"""simple docstring""" import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( Ma...
316
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Union[str, Any] = [] lowerCamelCase__ : List[str] = [] lowerCamelCase__ : Tuple = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, ...
316
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Union[str, Any] = [] lowerCamelCase__ : List[str] = [] lowerCamelCase__ : Tuple = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, ...
316
"""simple docstring""" import json import os import shutil import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoConfig, BertConfig, GPTaConfig fro...
316
1
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_download, hf_hub_url from PIL import Image from transformers import DetaConfig, DetaForObjectDetection, DetaImageProcessor, SwinConfig from transformers.u...
316
"""simple docstring""" from __future__ import annotations def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : list[list[int]] = [] lowerCamelCase__ : list[int] = [] lowerCamelCase__ : List[str] = ...
316
1
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class a_ ( snake_case_ ): '''simple docstring''' lowerCamelCase__ : Dict = ['image_processor', 'tokenizer'] lowerCamelCase__...
316
"""simple docstring""" from __future__ import annotations import queue class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_ ): '''simple docstring''' lowerCamelCase__ : Union[str, Any] = data lowerCamelCase__ : ...
316
1
"""simple docstring""" import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCamelCase_ ( _lowerCamelCase , _l...
316
"""simple docstring""" # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config # -...
316
1
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING A_ : List[Any] = logging.get_logger(__name__) A_ : str = { "SenseTime/deformable-detr": "https://huggingface.co/sensetime/def...
316
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class a_ ( snake_case_ ): '''simple docstring''' @staticmethod @abstractmethod def a__ (lowerCamelCase_ ): '''simple docstring''' raise NotImp...
316
1
"""simple docstring""" from ....utils import logging A_ : List[str] = logging.get_logger(__name__) class a_ ( snake_case_ ): '''simple docstring''' def __init__(self, lowerCamelCase_, lowerCamelCase_=None, lowerCamelCase_=2_0_4_8 ): '''simple...
316
"""simple docstring""" import re def lowerCamelCase_ ( _lowerCamelCase ): if len(re.findall('[ATCG]' , _lowerCamelCase ) ) != len(_lowerCamelCase ): raise ValueError('Invalid Strand' ) return dna.translate(dna.maketrans('ATCG' , 'TAGC' ) ) if __name...
316
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) A_ : int = { "configuration_clip": ...
316
"""simple docstring""" import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : Any ...
316
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : List[Any] = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): lowerCamelCase__ : Optional[int] = n - k # Calculat...
316
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ......
316
1
"""simple docstring""" 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 ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ...
316
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): while second != 0: lowerCamelCase__ : Tuple = first & second first ^= second lowerCamelCase__ : int = c << 1 return first if __name__ == "__main__": i...
316
1
"""simple docstring""" import numpy # List of input, output pairs A_ : Optional[Any] = ( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) A_ : List[str] = (((5_15, 22, 13), 5_55), ((61, 35, 49), 1_50)) A_ : Optio...
316
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A_ : List[str] = {"configuration_encoder_decoder": ["EncoderDecoderConfig"]} try: if n...
316
1
"""simple docstring""" from __future__ import annotations from collections import deque class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_ ): '''simple docstring''' lowerCamelCase__ : list[dict] = [] self.adlist.app...
316
"""simple docstring""" import numpy as np def lowerCamelCase_ ( _lowerCamelCase ): return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
316
1
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : str = logging.get_logger(__name__) A_ : Tuple = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/...
316
"""simple docstring""" print((lambda quine: quine % quine)("print((lambda quine: quine %% quine)(%r))"))
316
1
"""simple docstring""" import io import json import unittest from parameterized import parameterized from transformers import FSMTForConditionalGeneration, FSMTTokenizer from transformers.testing_utils import get_tests_dir, require_torch, slow, torch_device from utils import calculate_bleu A_ : Tuple ...
316
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) A_ : int = { "configuration_clip": ...
316
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): if exponent == 1: return base if exponent % 2 == 0: lowerCamelCase__ : Any = _modexpt(_lowerCamelCase , exponent // 2 , _lowerCame...
316
"""simple docstring""" import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from datasets.config impo...
316
1
"""simple docstring""" from __future__ import annotations def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): if (voltage, current, resistance).count(0 ) != 1: raise ValueError('One and only one argument must be 0' ) if resistance < 0: ra...
316
"""simple docstring""" class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_ ): '''simple docstring''' lowerCamelCase__ : Tuple = len(lowerCamelCase_ ) lowerCamelCase__ : Any = [0] * len_array ...
316
1
"""simple docstring""" import argparse import torch from datasets import load_dataset from donut import DonutModel from transformers import ( DonutImageProcessor, DonutProcessor, DonutSwinConfig, DonutSwinModel, MBartConfig, MBartForCausalLM, VisionEncoderDecoderModel, XLMRobert...
316
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class a_ ( snake_case_ ): '''simple docstring''' lowerCamelCase__ : Dict = ['image_processor', 'tokenizer'] lowerCamelCase__...
316
1
"""simple docstring""" from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse("3.8"): import importlib_metadata else: import importlib.metadata as importlib_metadata A_...
316
"""simple docstring""" import cva import numpy as np class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_, lowerCamelCase_ ): '''simple docstring''' if k in (0.04, 0.06): lowerCamelCase__ : Tuple = k lower...
316
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : Any = len(_lowerCamelCase ) print('The following activities are selected:' ) # The first activity is always selected lowerCamelCase__ : Union[str, An...
316
"""simple docstring""" from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar A_ : str = TypeVar("KEY") A_ : List[Any] = TypeVar("VAL") @dataclass(frozen=snake_case_ , slots=snake_case_ ) class a_ (...
316
1
"""simple docstring""" import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transformers from transformers impo...
316
"""simple docstring""" def lowerCamelCase_ ( ): lowerCamelCase__ : Optional[Any] = [] lowerCamelCase__ : List[Any] = 1 while len(_lowerCamelCase ) < 1e6: constant.append(str(_lowerCamelCase ) ) i += 1 lowerCamelCase__ : str = ...
316
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): if len(_lowerCamelCase ) <= 1: return [tuple(_lowerCamelCase )] lowerCamelCase__ : Dict = [] def generate(_lowerCamelCase , _lowerCamelCase ): if k == 1: res.append(tuple(arr[:] ) ...
316
"""simple docstring""" # Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position A_ : Union[str, Any] = "2.13.1" import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < ve...
316
1
"""simple docstring""" import numpy as np # Importing the Keras libraries and packages import tensorflow as tf from tensorflow.keras import layers, models if __name__ == "__main__": # Initialising the CNN # (Sequential- Building the model layer by layer) A_ : Optional[int] = mo...
316
"""simple docstring""" import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings A_ : str = ...
316
1
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class a_ ( snake_case_ ): '''simple docstring''' de...
316
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Union[str, Any] = [] lowerCamelCase__ : List[str] = [] lowerCamelCase__ : Tuple = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, ...
316
1
"""simple docstring""" import cva import numpy as np class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_, lowerCamelCase_ ): '''simple docstring''' if k in (0.04, 0.06): lowerCamelCase__ : Tuple = k lower...
316
"""simple docstring""" import json import os import shutil import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoConfig, BertConfig, GPTaConfig fro...
316
1
"""simple docstring""" # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
316
"""simple docstring""" from __future__ import annotations def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : list[list[int]] = [] lowerCamelCase__ : list[int] = [] lowerCamelCase__ : List[str] = ...
316
1
"""simple docstring""" A_ : Tuple = 2_56 # Modulus to hash a string A_ : str = 1_00_00_03 def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : List[str] = len(_lowerCamelCase ) lowerCamelCase__ : ...
316
"""simple docstring""" from __future__ import annotations import queue class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_ ): '''simple docstring''' lowerCamelCase__ : Union[str, Any] = data lowerCamelCase__ : ...
316
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : int = len(_lowerCamelCase ) lowerCamelCase__ : int = len(_lowerCamelCase ) lowerCamelCase__ : int = ( first_str...
316
"""simple docstring""" # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config # -...
316
1
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): if p < 2: raise ValueError('p should not be less than 2!' ) elif p == 2: return True lowerCamelCase__ : str = 4 lowerCamelCase__ : List[str] = (1 << p) - 1 for _ in range(p - 2 )...
316
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class a_ ( snake_case_ ): '''simple docstring''' @staticmethod @abstractmethod def a__ (lowerCamelCase_ ): '''simple docstring''' raise NotImp...
316
1
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .schedul...
316
"""simple docstring""" import re def lowerCamelCase_ ( _lowerCamelCase ): if len(re.findall('[ATCG]' , _lowerCamelCase ) ) != len(_lowerCamelCase ): raise ValueError('Invalid Strand' ) return dna.translate(dna.maketrans('ATCG' , 'TAGC' ) ) if __name...
316
1
"""simple docstring""" import os import time import numpy as np import onnxruntime as ort A_ : Tuple = "1" A_ : Any = "0" A_ : Union[str, Any] = "1" A_ : Union[str, Any] = ort.SessionOptions() A_ : str = ort.GraphOptimizationLevel.ORT...
316
"""simple docstring""" import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : Any ...
316
1
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
316
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ......
316
1
"""simple docstring""" import inspect import unittest from typing import List import numpy as np from transformers import EfficientFormerConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...t...
316
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): while second != 0: lowerCamelCase__ : Tuple = first & second first ^= second lowerCamelCase__ : int = c << 1 return first if __name__ == "__main__": i...
316
1
"""simple docstring""" import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def lowerCamelCase_ ( ): print('Making key files...' ) make_key_files('rsa' , 1024 ) print('Key files gen...
316
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A_ : List[str] = {"configuration_encoder_decoder": ["EncoderDecoderConfig"]} try: if n...
316
1
"""simple docstring""" import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, B...
316
"""simple docstring""" import numpy as np def lowerCamelCase_ ( _lowerCamelCase ): return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
316
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor A_ : int = logging.get_logger(__name__) class a_ ( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' def __init__(self, *lowerCa...
350
"""simple docstring""" print((lambda quine: quine % quine)("print((lambda quine: quine %% quine)(%r))"))
316
0
"""simple docstring""" from ...utils import deprecate from ..controlnet.pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline # noqa: F401 deprecate( "stable diffusion controlnet", "0.22.0", "Importing `FlaxStableDiffusionControlNetPipeline` from diffusers.pipelines.stable_diffusio...
351
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) A_ : int = { "configuration_clip": ...
316
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, ...
352
"""simple docstring""" import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from datasets.config impo...
316
0
"""simple docstring""" import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller A_ : Optional[int] = 3 def lowerCamelCase_ ( _lowerCamelCase ): """simple docstring""" print('Generating primitive root of p' ) while...
353
"""simple docstring""" class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_ ): '''simple docstring''' lowerCamelCase__ : Tuple = len(lowerCamelCase_ ) lowerCamelCase__ : Any = [0] * len_array ...
316
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_feature...
354
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class a_ ( snake_case_ ): '''simple docstring''' lowerCamelCase__ : Dict = ['image_processor', 'tokenizer'] lowerCamelCase__...
316
0
"""simple docstring""" import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/facebook/musicgen-small/r...
355
"""simple docstring""" import cva import numpy as np class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_, lowerCamelCase_ ): '''simple docstring''' if k in (0.04, 0.06): lowerCamelCase__ : Tuple = k lower...
316
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, is_vision_available, ) A_ : List[Any] = {"""processing_layoutxlm""": ["""L...
356
"""simple docstring""" from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar A_ : str = TypeVar("KEY") A_ : List[Any] = TypeVar("VAL") @dataclass(frozen=snake_case_ , slots=snake_case_ ) class a_ (...
316
0
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand from datase...
357
"""simple docstring""" def lowerCamelCase_ ( ): lowerCamelCase__ : Optional[Any] = [] lowerCamelCase__ : List[Any] = 1 while len(_lowerCamelCase ) < 1e6: constant.append(str(_lowerCamelCase ) ) i += 1 lowerCamelCase__ : str = ...
316
0
"""simple docstring""" import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase=7 ): lowerCamelCase__ : Dict = None if token is not None: lowerC...
358
"""simple docstring""" # Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position A_ : Union[str, Any] = "2.13.1" import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < ve...
316
0
"""simple docstring""" 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, f...
359
"""simple docstring""" import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings A_ : str = ...
316
0
import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, slow, ) fro...
360
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Union[str, Any] = [] lowerCamelCase__ : List[str] = [] lowerCamelCase__ : Tuple = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, ...
316
0
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_tokenization_...
361
"""simple docstring""" import json import os import shutil import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoConfig, BertConfig, GPTaConfig fro...
316
0
"""simple docstring""" import numpy # List of input, output pairs A_ : int = ( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) A_ : Tuple = (((5_15, 22, 13), 5_55), ((61, 35, 49), 1_50)) A_ : List[Any] = ...
362
"""simple docstring""" from __future__ import annotations def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : list[list[int]] = [] lowerCamelCase__ : list[int] = [] lowerCamelCase__ : List[str] = ...
316
0
from math import sqrt def lowerCamelCase_ ( _lowerCamelCase ): assert isinstance(_lowerCamelCase , _lowerCamelCase ) and ( number >= 0 ), "'number' must been an int and positive" lowerCamelCase__ : Optional[Any] = True # 0 and 1 are none primes. if ...
363
"""simple docstring""" from __future__ import annotations import queue class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_ ): '''simple docstring''' lowerCamelCase__ : Union[str, Any] = data lowerCamelCase__ : ...
316
0
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils ...
364
"""simple docstring""" # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config # -...
316
0
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): return round(float(moles / volume ) * nfactor ) def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): return round(fl...
365
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class a_ ( snake_case_ ): '''simple docstring''' @staticmethod @abstractmethod def a__ (lowerCamelCase_ ): '''simple docstring''' raise NotImp...
316
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor A_ : Dict = logging.get_logger(__name__) class a_ ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__(self, *lo...
366
"""simple docstring""" import re def lowerCamelCase_ ( _lowerCamelCase ): if len(re.findall('[ATCG]' , _lowerCamelCase ) ) != len(_lowerCamelCase ): raise ValueError('Invalid Strand' ) return dna.translate(dna.maketrans('ATCG' , 'TAGC' ) ) if __name...
316
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A_ : List[str] = {"configuration_plbart": ["PLBART_PRETRAINED_CONFIG_ARCHIVE...
367
"""simple docstring""" import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : Any ...
316
0
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging A_ : Optional[Any] = logging.get_logger(__name__) A_ : Dict ...
368
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ......
316
0
"""simple docstring""" import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCal...
369
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): while second != 0: lowerCamelCase__ : Tuple = first & second first ^= second lowerCamelCase__ : int = c << 1 return first if __name__ == "__main__": i...
316
0
"""simple docstring""" from __future__ import annotations def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): if (direction == 1 and array[indexa] > array[indexa]) or ( direction == 0 and array[indexa] < array[indexa]...
370
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A_ : List[str] = {"configuration_encoder_decoder": ["EncoderDecoderConfig"]} try: if n...
316
0
"""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 import BertTokenizer A_ : Optional[Any] = logg...
371
"""simple docstring""" import numpy as np def lowerCamelCase_ ( _lowerCamelCase ): return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
316
0
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Any = len(__a ) while cur > 1: # Find the maximum number in arr lowerCamelCase__ : Optional[Any] = arr.index(max(arr[0:cur] ) ) # Reverse from 0 to mi lowerCame...
350
"""simple docstring""" print((lambda quine: quine % quine)("print((lambda quine: quine %% quine)(%r))"))
316
0
"""simple docstring""" import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_v...
351
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) A_ : int = { "configuration_clip": ...
316
0
"""simple docstring""" from itertools import permutations def lowerCamelCase_ ( _lowerCamelCase ): if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if num[5] % 5 != 0: return False lowerCamelCase__ : str = [7, 11, 13, 17...
352
"""simple docstring""" import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from datasets.config impo...
316
0
"""simple docstring""" import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_mo...
353
"""simple docstring""" class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_ ): '''simple docstring''' lowerCamelCase__ : Tuple = len(lowerCamelCase_ ) lowerCamelCase__ : Any = [0] * len_array ...
316
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Tuple = logging.get_logger(__name__) A_ : Dict = { "bigcode/gpt_bigcode-santacoder": "https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json", ...
354
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class a_ ( snake_case_ ): '''simple docstring''' lowerCamelCase__ : Dict = ['image_processor', 'tokenizer'] lowerCamelCase__...
316
0
"""simple docstring""" import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import load...
355
"""simple docstring""" import cva import numpy as np class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_, lowerCamelCase_ ): '''simple docstring''' if k in (0.04, 0.06): lowerCamelCase__ : Tuple = k lower...
316
0
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig 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_backbone_common import Back...
356
"""simple docstring""" from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar A_ : str = TypeVar("KEY") A_ : List[Any] = TypeVar("VAL") @dataclass(frozen=snake_case_ , slots=snake_case_ ) class a_ (...
316
0
from __future__ import annotations A_ : int = list[list[int]] # assigning initial values to the grid A_ : Optional[Any] = [ [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,...
357
"""simple docstring""" def lowerCamelCase_ ( ): lowerCamelCase__ : Optional[Any] = [] lowerCamelCase__ : List[Any] = 1 while len(_lowerCamelCase ) < 1e6: constant.append(str(_lowerCamelCase ) ) i += 1 lowerCamelCase__ : str = ...
316
0
"""simple docstring""" class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_ ): '''simple docstring''' lowerCamelCase__ : Any = size lowerCamelCase__ : Optional[int] = [0] * size lowerCamelCase...
358
"""simple docstring""" # Lint as: python3 # pylint: enable=line-too-long # pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position A_ : Union[str, Any] = "2.13.1" import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < ve...
316
0
"""simple docstring""" import math from numpy import inf from scipy.integrate import quad def lowerCamelCase_ ( _lowerCamelCase ): if num <= 0: raise ValueError('math domain error' ) return quad(_UpperCamelCase , 0 , _UpperCamelCase , args=(_UpperC...
359
"""simple docstring""" import logging from dataclasses import dataclass, field from pathlib import Path from typing import Optional, Union from .generation.configuration_utils import GenerationConfig from .training_args import TrainingArguments from .utils import add_start_docstrings A_ : str = ...
316
0
import argparse import requests import torch from PIL import Image from torchvision.transforms import Compose, Normalize, Resize, ToTensor from transformers import SwinaSRConfig, SwinaSRForImageSuperResolution, SwinaSRImageProcessor def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ ...
360
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase ): lowerCamelCase__ : Union[str, Any] = [] lowerCamelCase__ : List[str] = [] lowerCamelCase__ : Tuple = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, ...
316
0
import math class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_=0 ): # a graph with Node 0,1,...,N-1 '''simple docstring''' lowerCamelCase__ : Optional[int] = n lowerCamelCase__ : Union[str, Any] = ...
361
"""simple docstring""" import json import os import shutil import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoConfig, BertConfig, GPTaConfig fro...
316
0
"""simple docstring""" import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope='session' ) def lowerCamelCase_ ( )...
362
"""simple docstring""" from __future__ import annotations def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : list[list[int]] = [] lowerCamelCase__ : list[int] = [] lowerCamelCase__ : List[str] = ...
316
0
import baseaa def lowerCamelCase_ ( _lowerCamelCase ): return baseaa.baaencode(string.encode('utf-8' ) ) def lowerCamelCase_ ( _lowerCamelCase ): return baseaa.baadecode(UpperCamelCase__ ).decode('utf-8' ) if __name__ == "__main__": A_ : List[str] =...
363
"""simple docstring""" from __future__ import annotations import queue class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_ ): '''simple docstring''' lowerCamelCase__ : Union[str, Any] = data lowerCamelCase__ : ...
316
0
"""simple docstring""" from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image ...
364
"""simple docstring""" # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config # -...
316
0
"""simple docstring""" from collections import deque from math import floor from random import random from time import time class a_ : '''simple docstring''' def __init__(self ): '''simple docstring''' lowerCamelCase__ : Union[str, Any] = {} ...
365
"""simple docstring""" from abc import ABC, abstractmethod from argparse import ArgumentParser class a_ ( snake_case_ ): '''simple docstring''' @staticmethod @abstractmethod def a__ (lowerCamelCase_ ): '''simple docstring''' raise NotImp...
316
0
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , ): lowerCamelCase__ : List[Any] = [redshift, radiation_density, matter_density, dark_energy] ...
366
"""simple docstring""" import re def lowerCamelCase_ ( _lowerCamelCase ): if len(re.findall('[ATCG]' , _lowerCamelCase ) ) != len(_lowerCamelCase ): raise ValueError('Invalid Strand' ) return dna.translate(dna.maketrans('ATCG' , 'TAGC' ) ) if __name...
316
0
"""simple docstring""" import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionTextToImagePipeline from diffusers.utils.testing_utils import nightly, require_torch_gpu, torch_device A_ : Union[str, Any] = False class a_ ( un...
367
"""simple docstring""" import argparse import os import torch from transformers import FlavaImageCodebook, FlavaImageCodebookConfig def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ): lowerCamelCase__ : Any ...
316
0
"""simple docstring""" import os import tempfile import unittest import uuid from pathlib import Path from transformers.testing_utils import get_tests_dir, require_soundfile, require_torch, require_vision from transformers.tools.agent_types import AgentAudio, AgentImage, AgentText from transformers.utils import...
368
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ......
316
0
"""simple docstring""" import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class a_ ( snake_case_ , unittest.TestCase ): '''simple docstring''' ...
369
"""simple docstring""" def lowerCamelCase_ ( _lowerCamelCase , _lowerCamelCase ): while second != 0: lowerCamelCase__ : Tuple = first & second first ^= second lowerCamelCase__ : int = c << 1 return first if __name__ == "__main__": i...
316
0
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer A_ : str = logging.get_logger(__name__) A_ ...
370
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) A_ : List[str] = {"configuration_encoder_decoder": ["EncoderDecoderConfig"]} try: if n...
316
0
"""simple docstring""" import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict A_ : Union[str, Any] = namedtuple( "_TestComma...
371
"""simple docstring""" import numpy as np def lowerCamelCase_ ( _lowerCamelCase ): return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
316
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices A_ : Tuple = logging.get_logger(__name__) A_ : int = { "shi-labs/dinat-mini...
350
"""simple docstring""" print((lambda quine: quine % quine)("print((lambda quine: quine %% quine)(%r))"))
316
0
"""simple docstring""" import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import ( Auto...
351
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) A_ : int = { "configuration_clip": ...
316
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : List[str] = {"""configuration_ibert""": ["""IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """IBertConfig""", """IBertOnnxConfig"""]} try: if not is_...
352
"""simple docstring""" import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from datasets.config impo...
316
0
"""simple docstring""" import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_R...
353
"""simple docstring""" class a_ : '''simple docstring''' def __init__(self, lowerCamelCase_ ): '''simple docstring''' lowerCamelCase__ : Tuple = len(lowerCamelCase_ ) lowerCamelCase__ : Any = [0] * len_array ...
316
0
"""simple docstring""" import warnings from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import com...
354
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class a_ ( snake_case_ ): '''simple docstring''' lowerCamelCase__ : Dict = ['image_processor', 'tokenizer'] lowerCamelCase__...
316
0