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
from __future__ import annotations def UpperCAmelCase ( _lowerCamelCase : list[int | float] , _lowerCamelCase : int , _lowerCamelCase : int ): '''simple docstring''' if len(_lowerCamelCase ) == 0: raise ValueError("find_max() ...
709
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before to...
26
0
def UpperCAmelCase ( _lowerCamelCase : int = 1_000 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Dict = -1 SCREAMING_SNAKE_CASE__ : str = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**...
710
from __future__ import annotations def UpperCAmelCase ( _lowerCamelCase : list[int] , _lowerCamelCase : int ): '''simple docstring''' if len(_lowerCamelCase ) < k or k < 0: raise ValueError("Invalid Input" ) SCREAMING_SNAKE_CA...
26
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowercase :List[str] = { "configuration_roberta": ["ROBERTA_PRETRAINED_CONFIG_ARCHIV...
711
from __future__ import annotations def UpperCAmelCase ( _lowerCamelCase : list[int | float] , _lowerCamelCase : int , _lowerCamelCase : int ): '''simple docstring''' if len(_lowerCamelCase ) == 0: raise ValueError("find_max() ...
26
0
def UpperCAmelCase ( _lowerCamelCase : int ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = [0] * len(_lowerCamelCase ) SCREAMING_SNAKE_CASE__ : Dict = [] SCREAMING_SNAKE_CASE__ : int = [1] * len(...
712
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import IterableDataset fro...
26
0
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import load_numpy, ...
713
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowercase :str = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependen...
26
0
__lowercase :Optional[int] = 0 # The first color of the flag. __lowercase :Union[str, Any] = 1 # The second color of the flag. __lowercase :List[str] = 2 # The third color of the flag. __lowercase :Optional[Any] = (red, white, blue) def UpperCAme...
714
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, TFAutoModelForSequen...
26
0
import os import sys __lowercase :int = os.path.join(os.path.dirname(__file__), "src") sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSequenceClassification, ...
715
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) ...
26
0
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva __lowercase :Any = "" __lowercase :Optional[Any] = "" __lowercase :Tuple = "" __lowercase :List[Any] = 1 # (0 is vertical, 1 is horizontal) ...
716
import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_...
26
0
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available from .timesteps import ( fastaa_timesteps, smartaa_timesteps, smartaa_timesteps, ...
717
# 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 reposit...
26
0
from __future__ import annotations import math def UpperCAmelCase ( _lowerCamelCase : int , _lowerCamelCase : int , _lowerCamelCase : bool , _lowerCamelCase : list[int] , _lowerCamelCase : float ): '''simple docstring''' ...
718
def UpperCAmelCase ( _lowerCamelCase : int = 1_000 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Dict = -1 SCREAMING_SNAKE_CASE__ : str = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2...
26
0
from sklearn.metrics import recall_score import datasets __lowercase :List[Any] = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is the true positives and FN is...
719
from __future__ import annotations def UpperCAmelCase ( _lowerCamelCase : list , _lowerCamelCase : int | None = None , _lowerCamelCase : int | None = None ): '''simple docstring''' if start is None: SCREAMING_SNAKE_CASE__ : ...
26
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging __lowercase :List[str] = logging.get_logger(__name__) class UpperCamelCase__ ( lowercase__ ): """simple docstring""" snake_case_ = "encoder-decoder" ...
720
from __future__ import annotations from fractions import Fraction def UpperCAmelCase ( _lowerCamelCase : int , _lowerCamelCase : int ): '''simple docstring''' return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num ...
26
0
'''simple docstring''' from __future__ import annotations class _a : """simple docstring""" def __init__( self : int , a : list[list[int]] ) ->List[Any]: SCREAMING_SNAKE_CASE__ : Optional[int] = TypeError( "...
721
import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class _a ( unittest.TestCase ): """simple docstring""" ...
26
0
import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available, is_vision_available f...
700
import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( CONFIG_MAPPING, FEATUR...
26
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
701
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _a ( lowercase__ ): """simple docstring""" snake_case_ = ["image_processor", "tokenizer"] snake_case_ = "CLIPImageProces...
26
0
import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLICommand if not is_tf_available() an...
702
import sys from collections import defaultdict class _a : """simple docstring""" def __init__( self : Any ) ->Dict: SCREAMING_SNAKE_CASE__ : Tuple = [] def A_ ( self : int , a : List[str] ) ->Dict: ...
26
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowercase :Optional[Any] = logging.get_logger(__name__) __lowercase :List[str] = { "microsoft/trocr-base-handwritten": ( "https://huggingface.co/microsoft/trocr-base-handwritten/resolve/main...
703
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import PatchingSpec from ...tokeniz...
26
0
import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def UpperCAmelCase ( _lowerCamelCase : Any ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : List[Any] = [ "encoder.ve...
704
def UpperCAmelCase ( _lowerCamelCase : int = 4_000_000 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Any = [0, 1] SCREAMING_SNAKE_CASE__ : List[Any] = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) ...
26
0
import argparse import os import re import packaging.version __lowercase :int = "examples/" __lowercase :List[Any] = { "examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init": (re.compile(R"^__version__\s+=\s+...
705
import unittest from typing import Dict, List, Optional, Union 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...
26
0
import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () __lowercase :List[str] = np.linspace(start=0, stop=75, num=75, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership function # (...
706
def UpperCAmelCase ( _lowerCamelCase : int , _lowerCamelCase : bool = False ): '''simple docstring''' if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 10 not in (1, 3, 7, 9): # can quickly check ...
26
0
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __lowercase :Any = "http://www.mocksite.com/file1.txt...
707
import numpy class _a : """simple docstring""" def __init__( self : Optional[int] , a : numpy.ndarray , a : numpy.ndarray ) ->None: SCREAMING_SNAKE_CASE__ : Any = input_array # Random initial weights ar...
26
0
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def UpperCAmelCase ( _lowerCamelCase : Tuple , _lowerCamelCase : Union[str, Any] , _lower...
708
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo __lowercase :Tuple = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yongh...
26
0
import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class _a ( lowercase__ , unittest.TestCase ): ...
709
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before to...
26
0
from __future__ import annotations from typing import Any class _a : """simple docstring""" def __init__( self : Tuple , a : int , a : int , a : float = 0 ) ->None: SCREAMING_SNAKE_CASE__ : List[str] = ...
710
from __future__ import annotations def UpperCAmelCase ( _lowerCamelCase : list[int] , _lowerCamelCase : int ): '''simple docstring''' if len(_lowerCamelCase ) < k or k < 0: raise ValueError("Invalid Input" ) SCREAMING_SNAKE_CA...
26
0
import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInput from ...utils import loggi...
711
from __future__ import annotations def UpperCAmelCase ( _lowerCamelCase : list[int | float] , _lowerCamelCase : int , _lowerCamelCase : int ): '''simple docstring''' if len(_lowerCamelCase ) == 0: raise ValueError("find_max() ...
26
0
import inspect import warnings from typing import Any, Dict, Optional, Union from packaging import version def UpperCAmelCase ( *_lowerCamelCase : Optional[Any] , _lowerCamelCase : Optional[Union[Dict, Any]] = None , _lowerCamelCase : Dict=True , _lowerCamelCa...
712
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import IterableDataset fro...
26
0
from __future__ import annotations def UpperCAmelCase ( _lowerCamelCase : list[int] , _lowerCamelCase : int ): '''simple docstring''' if len(_lowerCamelCase ) < k or k < 0: raise ValueError("Invalid Input" ) SCREAMING_SNAKE_CA...
713
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowercase :str = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependen...
26
0
from __future__ import annotations from collections.abc import Iterator class _a : """simple docstring""" def __init__( self : List[Any] , a : int ) ->None: SCREAMING_SNAKE_CASE__ : Optional[int] = value SCREAMING_S...
714
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, TFAutoModelForSequen...
26
0
from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, slow from ..test_modeli...
715
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) ...
26
0
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.se...
716
import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_...
26
0
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, RegNetYaagf, RegNetY...
717
# 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 reposit...
26
0
import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_...
718
def UpperCAmelCase ( _lowerCamelCase : int = 1_000 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Dict = -1 SCREAMING_SNAKE_CASE__ : str = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2...
26
0
def UpperCAmelCase ( _lowerCamelCase : int = 10 , _lowerCamelCase : int = 1_000 , _lowerCamelCase : bool = True ): '''simple docstring''' assert ( isinstance(_lowerCamelCase , _lowerCamelCase ) and isinstance(_lowerCamelC...
719
from __future__ import annotations def UpperCAmelCase ( _lowerCamelCase : list , _lowerCamelCase : int | None = None , _lowerCamelCase : int | None = None ): '''simple docstring''' if start is None: SCREAMING_SNAKE_CASE__ : ...
26
0
import numpy as np import qiskit def UpperCAmelCase ( _lowerCamelCase : int = 8 , _lowerCamelCase : int | None = None ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = np.random.default_rng(seed=_lowerCamelCase ) ...
720
from __future__ import annotations from fractions import Fraction def UpperCAmelCase ( _lowerCamelCase : int , _lowerCamelCase : int ): '''simple docstring''' return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num ...
26
0
'''simple docstring''' import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, lo...
721
import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class _a ( unittest.TestCase ): """simple docstring""" ...
26
0
def UpperCAmelCase ( _lowerCamelCase : list ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : List[Any] = 0 while len(_lowerCamelCase ) > 1: SCREAMING_SNAKE_CASE__ : str = 0 # Consider two files with minimum ...
700
import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( CONFIG_MAPPING, FEATUR...
26
0
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassific...
701
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _a ( lowercase__ ): """simple docstring""" snake_case_ = ["image_processor", "tokenizer"] snake_case_ = "CLIPImageProces...
26
0
import sys from collections import defaultdict class _a : """simple docstring""" def __init__( self : Any ) ->Dict: SCREAMING_SNAKE_CASE__ : Tuple = [] def A_ ( self : int , a : List[str] ) ->Dict: ...
702
import sys from collections import defaultdict class _a : """simple docstring""" def __init__( self : Any ) ->Dict: SCREAMING_SNAKE_CASE__ : Tuple = [] def A_ ( self : int , a : List[str] ) ->Dict: ...
26
0
from __future__ import annotations import math import random from typing import Any class _a : """simple docstring""" def __init__( self : Any ) ->None: SCREAMING_SNAKE_CASE__ : list[Any] = [] SCREAMING_SNAKE_CASE__ : int...
703
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import PatchingSpec from ...tokeniz...
26
0
from __future__ import annotations __lowercase :Optional[int] = list[list[int]] # assigning initial values to the grid __lowercase :Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, ...
704
def UpperCAmelCase ( _lowerCamelCase : int = 4_000_000 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Any = [0, 1] SCREAMING_SNAKE_CASE__ : List[Any] = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) ...
26
0
from typing import List from .keymap import KEYMAP, get_character def UpperCAmelCase ( _lowerCamelCase : str ): '''simple docstring''' def decorator(_lowerCamelCase : Dict ): SCREAMING_SNAKE_CASE__ : Tuple = getattr(_lowerCame...
705
import unittest from typing import Dict, List, Optional, Union 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...
26
0
import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class _a ( lowercase__ ): """simple docstring""" snake_case_ = (EulerDiscreteScheduler,) snake_case_ ...
706
def UpperCAmelCase ( _lowerCamelCase : int , _lowerCamelCase : bool = False ): '''simple docstring''' if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 10 not in (1, 3, 7, 9): # can quickly check ...
26
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowercase :Any = { "configuration_deberta": ["DEBERTA_PRETRAINED_CONFIG_ARCHIVE_MAP", "DebertaConfig", "Deb...
707
import numpy class _a : """simple docstring""" def __init__( self : Optional[int] , a : numpy.ndarray , a : numpy.ndarray ) ->None: SCREAMING_SNAKE_CASE__ : Any = input_array # Random initial weights ar...
26
0
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor __lowercase :Optional[int] = logging.get_logger(__name__) class _a ( lowercase__ ): """simple docstring""" def __init__( self : int , *a :...
708
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo __lowercase :Tuple = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yongh...
26
0
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def UpperCAmelCase ( _lowerCamelCase : List[str] , _lowerCamelCase : Optional[Any] , _lowerCamelCase : Dict , _lowerCamelCase : Any=1_024...
709
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before to...
26
0
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class _a ( unittest.TestCase ): """simple docstring""" def A_ ( self : List[Any] ) ->int: debug_launch...
710
from __future__ import annotations def UpperCAmelCase ( _lowerCamelCase : list[int] , _lowerCamelCase : int ): '''simple docstring''' if len(_lowerCamelCase ) < k or k < 0: raise ValueError("Invalid Input" ) SCREAMING_SNAKE_CA...
26
0
# 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 reposit...
711
from __future__ import annotations def UpperCAmelCase ( _lowerCamelCase : list[int | float] , _lowerCamelCase : int , _lowerCamelCase : int ): '''simple docstring''' if len(_lowerCamelCase ) == 0: raise ValueError("find_max() ...
26
0
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) ...
712
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import IterableDataset fro...
26
0
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional from packaging import version if TYPE_CHECKING: from ... import PreTrainedTokenizer, TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ....
713
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowercase :str = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependen...
26
0
import importlib.metadata import warnings from copy import deepcopy from packaging import version from ..utils import logging from .import_utils import is_accelerate_available, is_bitsandbytes_available if is_bitsandbytes_available(): import bitsandbytes as bnb import torch import torch.nn a...
714
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, TFAutoModelForSequen...
26
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowercase :Union[str, Any] = { "configuration_longformer": [ "LONGFORMER_PRETRAINED_CONFIG_ARCHIVE_...
715
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) ...
26
0
'''simple docstring''' import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from_submodules, ) from acceler...
716
import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_...
26
0
import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, Value, load_dataset from transformers import DPRCo...
717
# 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 reposit...
26
0
import logging import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import librosa import torch from datasets import DatasetDict, load_dataset from packaging import version from torch import nn from transformers import ( HfArgumentParser, Trainer, T...
718
def UpperCAmelCase ( _lowerCamelCase : int = 1_000 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Dict = -1 SCREAMING_SNAKE_CASE__ : str = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2...
26
0
import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available from ...test_backbone_com...
719
from __future__ import annotations def UpperCAmelCase ( _lowerCamelCase : list , _lowerCamelCase : int | None = None , _lowerCamelCase : int | None = None ): '''simple docstring''' if start is None: SCREAMING_SNAKE_CASE__ : ...
26
0
from __future__ import annotations from functools import lru_cache from math import ceil __lowercase :Tuple = 100 __lowercase :Optional[int] = set(range(3, NUM_PRIMES, 2)) primes.add(2) __lowercase :int for prime in range(3, ceil(NUM_PRIMES**0.5), 2): if prime not in primes...
720
from __future__ import annotations from fractions import Fraction def UpperCAmelCase ( _lowerCamelCase : int , _lowerCamelCase : int ): '''simple docstring''' return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num ...
26
0
'''simple docstring''' from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo __lowercase :Tuple = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Transl...
721
import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class _a ( unittest.TestCase ): """simple docstring""" ...
26
0
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 from accelerate import...
700
import json import os import sys import tempfile import unittest from pathlib import Path from shutil import copyfile from huggingface_hub import HfFolder, Repository, create_repo, delete_repo from requests.exceptions import HTTPError import transformers from transformers import ( CONFIG_MAPPING, FEATUR...
26
0
def UpperCAmelCase ( _lowerCamelCase : int ): '''simple docstring''' if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("only integers accepted as input" ) else: SCREAMING_SNAKE_CASE__ : List[str] = ...
701
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _a ( lowercase__ ): """simple docstring""" snake_case_ = ["image_processor", "tokenizer"] snake_case_ = "CLIPImageProces...
26
0
import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class _a ( lowercase__ ): """simple docstring""" def __init__( self : Any , a : List[str] , a : List[str] ...
702
import sys from collections import defaultdict class _a : """simple docstring""" def __init__( self : Any ) ->Dict: SCREAMING_SNAKE_CASE__ : Tuple = [] def A_ ( self : int , a : List[str] ) ->Dict: ...
26
0
import torch def UpperCAmelCase ( ): '''simple docstring''' if torch.cuda.is_available(): SCREAMING_SNAKE_CASE__ : str = torch.cuda.device_count() else: SCREAMING_SNAKE_CASE__ : str = 0 print(f"""Successfully r...
703
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import PatchingSpec from ...tokeniz...
26
0
import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() __lowercase :Any = logging.get_logger(__name__) __lowercase :List[Any] = [ ["attention", "attn"], ["...
704
def UpperCAmelCase ( _lowerCamelCase : int = 4_000_000 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Any = [0, 1] SCREAMING_SNAKE_CASE__ : List[Any] = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) ...
26
0
from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. __lowercase :Union[str, Any] = 200 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst of that generati...
705
import unittest from typing import Dict, List, Optional, Union 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...
26
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __lowercase :Tuple = {"configuration_fnet": ["FNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "FNetConfig"]} try:...
706
def UpperCAmelCase ( _lowerCamelCase : int , _lowerCamelCase : bool = False ): '''simple docstring''' if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 10 not in (1, 3, 7, 9): # can quickly check ...
26
0
def UpperCAmelCase ( _lowerCamelCase : int , _lowerCamelCase : int , _lowerCamelCase : list[list[int]] ): '''simple docstring''' def update_area_of_max_square(_lowerCamelCase : int , _lowerCamelCase : int ) -> int: # ...
707
import numpy class _a : """simple docstring""" def __init__( self : Optional[int] , a : numpy.ndarray , a : numpy.ndarray ) ->None: SCREAMING_SNAKE_CASE__ : Any = input_array # Random initial weights ar...
26
0
from typing import Dict, Iterable, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ( IMAGENET_STANDARD_MEA...
708
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo __lowercase :Tuple = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yongh...
26
0
from random import shuffle import tensorflow as tf from numpy import array def UpperCAmelCase ( _lowerCamelCase : Tuple , _lowerCamelCase : Dict ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Optional[Any] = int(_lowerCamelCase ) ...
709
import sys from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before to...
26
0
from __future__ import annotations from cmath import sqrt def UpperCAmelCase ( _lowerCamelCase : int , _lowerCamelCase : int , _lowerCamelCase : int ): '''simple docstring''' if a == 0: raise ValueError("Coefficient 'a' must not...
710
from __future__ import annotations def UpperCAmelCase ( _lowerCamelCase : list[int] , _lowerCamelCase : int ): '''simple docstring''' if len(_lowerCamelCase ) < k or k < 0: raise ValueError("Invalid Input" ) SCREAMING_SNAKE_CA...
26
0
from statistics import mean, stdev def UpperCAmelCase ( _lowerCamelCase : list , _lowerCamelCase : int = 3 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Tuple = min(_lowerCamelCase ) SCREAMING_SNAKE_CASE__ : int = ...
711
from __future__ import annotations def UpperCAmelCase ( _lowerCamelCase : list[int | float] , _lowerCamelCase : int , _lowerCamelCase : int ): '''simple docstring''' if len(_lowerCamelCase ) == 0: raise ValueError("find_max() ...
26
0
from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
712
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import IterableDataset fro...
26
0
import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor __lowercase = logging.get_logger(__name__) class _a ( lowercase__ ): """simple docstring""" def __init__( self : str , *a : Optional[Any...
713
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowercase :str = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependen...
26
0
from __future__ import annotations from fractions import Fraction def UpperCAmelCase ( _lowerCamelCase : int , _lowerCamelCase : int ): '''simple docstring''' return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num ...
714
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, TFAutoModelForSequen...
26
0
from random import randint from tempfile import TemporaryFile import numpy as np def UpperCAmelCase ( _lowerCamelCase : Optional[int] , _lowerCamelCase : int , _lowerCamelCase : Union[str, Any] ): '''simple docstring''' SCREAMING_SNAKE_CASE_...
715
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) ...
26
0
'''simple docstring''' import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def UpperCAmelCase (...
716
import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_...
26
0
import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB_FILES_NAMES, save_json fr...
717
# 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 reposit...
26
0
import unittest from typing import Dict, List, Optional, Union 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...
718
def UpperCAmelCase ( _lowerCamelCase : int = 1_000 ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Dict = -1 SCREAMING_SNAKE_CASE__ : str = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2...
26
0
from __future__ import annotations def UpperCAmelCase ( _lowerCamelCase : Any , _lowerCamelCase : Any , _lowerCamelCase : int , _lowerCamelCase : Union[str, Any] ): # noqa: E741 '''simple docstring''' while r - l > 1: S...
719
from __future__ import annotations def UpperCAmelCase ( _lowerCamelCase : list , _lowerCamelCase : int | None = None , _lowerCamelCase : int | None = None ): '''simple docstring''' if start is None: SCREAMING_SNAKE_CASE__ : ...
26
0
def UpperCAmelCase ( _lowerCamelCase : int ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : int = (1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def UpperCAmelCase ( _lowerCamelCase : int = 5_000 ): ...
720
from __future__ import annotations from fractions import Fraction def UpperCAmelCase ( _lowerCamelCase : int , _lowerCamelCase : int ): '''simple docstring''' return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) == num ...
26
0
'''simple docstring''' from typing import TYPE_CHECKING from ..utils import _LazyModule __lowercase :Optional[int] = { "config": [ "EXTERNAL_DATA_FORMAT_SIZE_LIMIT", "OnnxConfig", "OnnxConfigWithPast", "OnnxSeq2SeqConfigWithPast", "PatchingSpec", ...
721
import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class _a ( unittest.TestCase ): """simple docstring""" ...
26
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __magic_name__ = {'configuration_wavlm': ['WAVLM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'WavLMConfig']} try: if not is_torch_available(): raise OptionalDep...
27
'''simple docstring''' import argparse import json from typing import List from ltp import LTP from transformers.models.bert.tokenization_bert import BertTokenizer def lowerCamelCase ( lowerCamelCase : Optional[Any]): # This defines a "chinese character" as anything in the CJK Unico...
27
1
'''simple docstring''' import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin from .feature_extraction_wavaveca import WavaVecaFeatureExtractor from .tokenization_wavaveca import WavaVecaCTCTokenizer class __lowerCAmelCase ( __SCREAMING_SNAKE_CASE ): ...
27
'''simple docstring''' import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __lowerCAmelCase ( ...
27
1
'''simple docstring''' def lowerCamelCase ( lowerCamelCase : int): if n == 1 or not isinstance(lowerCamelCase , lowerCamelCase): return 0 elif n == 2: return 1 else: A_ : List[str] = [0, 1] for i in r...
27
'''simple docstring''' from ..utils import DummyObject, requires_backends class __lowerCAmelCase ( metaclass=__SCREAMING_SNAKE_CASE ): '''simple docstring''' a_ = ["""torch""", """torchsde"""] def __init__( self : Any ,*_a : Union[str, Any] ,**_a : ...
27
1
'''simple docstring''' def lowerCamelCase ( lowerCamelCase : str): A_ : int = 0 # if input_string is "aba" than new_input_string become "a|b|a" A_ : Dict = """""" A_ : Any = """""" # append each character + "|...
27
'''simple docstring''' import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data ...
27
1
'''simple docstring''' def lowerCamelCase ( lowerCamelCase : List[str] , lowerCamelCase : Optional[int]): A_ : Union[str, Any] = [1] for i in range(2 , lowerCamelCase): factorials.append(factorials[-1] * i) assert 0 <= ...
27
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) __magic_name__ = {} try: if not is_sentencepiece_available(): raise Op...
27
1
'''simple docstring''' import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax.jax...
27
'''simple docstring''' import gc import random import unittest import numpy as np import torch from diffusers import ( DDIMScheduler, KandinskyVaaControlnetPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_numpy, ...
27
1
'''simple docstring''' from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) __magic_name__...
27
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedToke...
27
1
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedToke...
27
'''simple docstring''' import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print('Googling.....') __magic_name__ = 'https://www.google.com/search?q=' + ' '.join(sys.argv[1:]) __magic_name__ = reque...
27
1
'''simple docstring''' import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHECKIN...
27
'''simple docstring''' from ... import PretrainedConfig __magic_name__ = { 'sijunhe/nezha-cn-base': 'https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json', } class __lowerCAmelCase ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' a_ = NEZHA_PRE...
27
1
'''simple docstring''' def lowerCamelCase ( lowerCamelCase : list , lowerCamelCase : int , lowerCamelCase : int = 0 , lowerCamelCase : int = 0): A_ : str = right or len(lowerCamelCase) - 1 if left > right: ...
27
'''simple docstring''' from __future__ import annotations def lowerCamelCase ( lowerCamelCase : dict , lowerCamelCase : str): A_ , A_ : List[Any] = set(lowerCamelCase), [start] while stack: A_ : Optional[Any] =...
27
1
'''simple docstring''' import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from trans...
27
'''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 ( MobileViTConfig, MobileViTForImageClassification, MobileViTForSemanticSegmentation, MobileViTImageP...
27
1
'''simple docstring''' import os def lowerCamelCase ( ): with open(os.path.dirname(lowerCamelCase) + """/grid.txt""") as f: A_ : str = [] # noqa: E741 for _ in range(20): l.append([int(lowerCamelCase) for x in f.readline().split()...
27
'''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, r...
27
1
'''simple docstring''' import sys __magic_name__ = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '668966489504452445231...
27
'''simple docstring''' import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor __magic_name__ = logging.get_logger(__name__) class __lowerCAmelCase ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__( self : ...
27
1
'''simple docstring''' import datasets from .evaluate import evaluate __magic_name__ = '\\n@inproceedings{Rajpurkar2016SQuAD10,\n title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text},\n author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang},\n booktitle={EMNLP}...
27
'''simple docstring''' from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def lowerCamelCase ( lowerCamelCase : str , lowerCamelCase : complex , lowerCamelCase : str = "x" , lowerCamelCase : float = 10**-1...
27
1
'''simple docstring''' import qiskit def lowerCamelCase ( lowerCamelCase : int , lowerCamelCase : int): A_ : Tuple = qiskit.Aer.get_backend("""aer_simulator""") # Create a Quantum Circuit acting on the q register A_ : Optional[int]...
27
'''simple docstring''' import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset __magic_name__ = {1: (1, 1), 2: (2, 1), 3: (3, 1), 4: (2, 2), 5: (5, 1),...
27
1
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
27
'''simple docstring''' from __future__ import annotations import math def lowerCamelCase ( lowerCamelCase : int): if num <= 0: A_ : List[Any] = F'{num}: Invalid input, please enter a positive integer.' raise ValueError(lowerCamelCase) ...
27
1
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.modelin...
27
'''simple docstring''' import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate import Accelerator from datase...
27
1
'''simple docstring''' import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def lowerCamelCase ...
27
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __magic_name__ = { 'configuration_convnext': ['CONVNEXT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ConvNext...
27
1
'''simple docstring''' import argparse import json from typing import List from ltp import LTP from transformers.models.bert.tokenization_bert import BertTokenizer def lowerCamelCase ( lowerCamelCase : Optional[Any]): # This defines a "chinese character" as anything in the CJK Unico...
27
'''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 PretrainedConfig fr...
27
1
'''simple docstring''' import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_available, ...
27
'''simple docstring''' import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFe...
27
1
'''simple docstring''' from __future__ import annotations class __lowerCAmelCase : '''simple docstring''' def __init__( self : Union[str, Any] ,_a : Any=None ): '''simple docstring''' A_ : List[Any] = data A_ : Optional[int] ...
27
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTes...
27
1