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
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def A_ ( _lowerCAmelCase , _lowerCAmelCase=None ) -> Union[str, Any]: UpperCamelCase : List[str] = None if token is not None: U...
38
import logging import os import threading import time try: import warnings except ImportError: __lowerCamelCase : str = None try: import msvcrt except ImportError: __lowerCamelCase : str = None try: import fcntl except ImportError: __lowerCamelCase : List[Any] ...
38
1
import os import re from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __lowerCamelCase : Optional[Any] = logging.get_logger(__name__) __lowerCamelCase : Optional[Any] = { """vocab_fi...
38
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = None ...
38
1
from typing import List, Optional, Union import numpy as np from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging __lowerCamelCase : List[Any] = logging.get_logger(__na...
38
from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tens...
38
1
import os import sys __lowerCamelCase : Union[str, Any] = os.path.join(os.path.dirname(__file__), """src""") sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSeque...
38
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCamelCase : Tuple = logging.get_logger(__name__) __lowerCamelCase : str = { """camembert-base""": """h...
38
1
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def A_ ( ) -> Dict: UpperCamelCase : Tuple = ArgumentParser( description=( "PyTorch TPU distributed training laun...
38
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> int: return int(input_a == input_a == 0 ) def A_ ( ) -> None: print("Truth Table of NOR Gate:" ) print("| Input 1 | Input 2 | Output |" ) print(F"""| 0 | 0 | {nor_gate(0 , 0 )} |"""...
38
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase : Optional[Any] = logging.get_logger(__name__) __lowerCamelCase : Dict = { """uw-madison/mra-base-512-4""": """https://huggingface.co/uw-madison/mra-base-512-4/resolve/main/config.json"""...
38
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class A__ ( __snake_ca...
38
1
import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from transformers.testing_utils imp...
38
from math import ceil from typing import List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor from ...utils import TensorType, logging __lowerCamelCase : Dict ...
38
1
from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.r...
38
from __future__ import annotations from random import random from typing import Generic, TypeVar __lowerCamelCase : Dict = TypeVar("""KT""") __lowerCamelCase : Dict = TypeVar("""VT""") class A__ ( Generic[KT, VT] ): def __init__( self , A_ = "root" , ...
38
1
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() __lowerCamelCase : Optional[int] = [ """word_embedding...
38
from PIL import Image def A_ ( _lowerCAmelCase ) -> Image: UpperCamelCase , UpperCamelCase : List[Any] = image.size UpperCamelCase : Union[str, Any] = 0 UpperCamelCase : List[str] = image.load() for i in range(_lowerCAmelCase ): for j in range...
38
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipeline_vq_diffusion import LearnedClassifierFreeSam...
38
from math import loga def A_ ( _lowerCAmelCase ) -> int: if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(_lowerCAmelCase , _lowerCAmelCase ): raise TypeError("Input value must be a 'int' type" ) return 0 if (a == 0) else int(loga(a & -a ) ...
38
1
from __future__ import annotations def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> tuple[float, list[float]]: UpperCamelCase : List[str] = list(range(len(_lowerCAmelCase ) ) ) UpperCamelCase : Dict = [v / w for v, w in zip(_low...
38
from __future__ import annotations __lowerCamelCase : Optional[int] = """Muhammad Umer Farooq""" __lowerCamelCase : Tuple = """MIT""" __lowerCamelCase : Optional[int] = """1.0.0""" __lowerCamelCase : int = """Muhammad Umer Farooq""" __lowerCamelCase : Optional[int] ...
38
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowerCamelCase : Any = {"""configuration_xglm""": ["""XGLM...
38
from __future__ import annotations def A_ ( _lowerCAmelCase ) -> list[int]: UpperCamelCase : Optional[Any] = [True] * limit UpperCamelCase : Optional[Any] = False UpperCamelCase : List[str] = False UpperCamelCase : Tuple = True for i in...
38
1
from __future__ import annotations from typing import Any class A__ : def __init__( self , A_ = 6 ): '''simple docstring''' UpperCamelCase : Node | None = None UpperCamelCase : Node | None = None self.create_linked_l...
38
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class A__ ( __snake_case ): def __init__( self , A_ , A_ = None , A_ = None , A_ = False , ...
38
1
def A_ ( _lowerCAmelCase ) -> int: if not isinstance(_lowerCAmelCase , _lowerCAmelCase ) or number < 0: raise ValueError("Input must be a non-negative integer" ) UpperCamelCase : int = 0 while number: # This way we arrive at next set bit (next 1) instead of looping ...
38
import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unordered, map_nested, ...
38
1
from __future__ import annotations def A_ ( _lowerCAmelCase ) -> int: if not nums: return 0 UpperCamelCase : Optional[int] = nums[0] UpperCamelCase : Any = 0 for num in nums[1:]: UpperCamelCase , UpperCamelCase : Tuple = ( max_excluding...
38
from ..utils import DummyObject, requires_backends class A__ ( metaclass=__snake_case ): _UpperCAmelCase :Tuple = ['note_seq'] def __init__( self , *A_ , **A_ ): '''simple docstring''' requires_backends(self , ["note_seq"] ...
38
1
import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_...
38
import math import tensorflow as tf from packaging import version def A_ ( _lowerCAmelCase ) -> Any: UpperCamelCase : List[Any] = tf.convert_to_tensor(_lowerCAmelCase ) UpperCamelCase : Any = 0.5 * (1.0 + tf.math.erf(x / tf.cast(tf.sqrt(2.0 ) , x.dtype )...
38
1
from typing import Any, Dict, List, Optional, Tuple, Union import torch from torch import nn from torch.utils.data import DistributedSampler, RandomSampler from transformers import PreTrainedModel, Trainer, logging from transformers.integrations import is_fairscale_available from transformers.models.fsmt.config...
38
import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_f...
38
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCamelCase : Optional[Any] = logging.get_logger(__name__) __lowerCamelCase : Tuple = { """xlm-mlm-en-20...
38
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def A_ ( ) -> Dict: UpperCamelCase : Tuple = ArgumentParser( description=( "PyTorch TPU distributed training laun...
38
1
from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDIMScheduler, DDPMSche...
38
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __lowerCamelCase : Union[str, Any] = { """configuration_vision_encoder_decoder""": ["""VisionEncoderDecoderConfig""",...
38
1
import functools import logging import os import sys import threading from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional import huggingface_hub.utils as hf_...
38
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs if is_torch_available(): import t...
38
1
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class A__ ( __snake_case ): def __init__( self , A_ , A_ = None , A_ = None , A_ = False , ...
38
from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer __lowerCamelCase : Dict = logging.get_logger(__name__) __lo...
38
1
from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class A__ ( __snake_case ): _UpperCAmelCase :int = CustomTokenizer pass
38
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowerCamelCase : int = { """configuration_convbert""": ["""CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Conv...
38
1
import warnings 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 __lowerCamelCase : List[str] = logging.get_logger(__name__) __lowerCamelCase ...
38
import logging import os import threading import time try: import warnings except ImportError: __lowerCamelCase : str = None try: import msvcrt except ImportError: __lowerCamelCase : str = None try: import fcntl except ImportError: __lowerCamelCase : List[Any] ...
38
1
import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class A__ ( __snake_case , unittest.TestCase ): _UpperCAmelCase :List[str] = DownBlockaD # noqa F40...
38
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = None ...
38
1
from math import loga def A_ ( _lowerCAmelCase ) -> int: if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(_lowerCAmelCase , _lowerCAmelCase ): raise TypeError("Input value must be a 'int' type" ) return 0 if (a == 0) else int(loga(a & -a ) ...
38
from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tens...
38
1
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/resolve/main/compressio...
38
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCamelCase : Tuple = logging.get_logger(__name__) __lowerCamelCase : str = { """camembert-base""": """h...
38
1
import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNetaDConditionModel, ) from diffusers.pi...
38
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> int: return int(input_a == input_a == 0 ) def A_ ( ) -> None: print("Truth Table of NOR Gate:" ) print("| Input 1 | Input 2 | Output |" ) print(F"""| 0 | 0 | {nor_gate(0 , 0 )} |"""...
38
1
import random from .binary_exp_mod import bin_exp_mod def A_ ( _lowerCAmelCase , _lowerCAmelCase=1000 ) -> Optional[int]: if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd UpperCamelCase : Union[str, Any] = n - 1 UpperCamelCase : T...
38
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class A__ ( __snake_ca...
38
1
import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]: # Initialise PyTorch model U...
38
from math import ceil from typing import List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor from ...utils import TensorType, logging __lowerCamelCase : Dict ...
38
1
import math def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float: if initial_intensity < 0: raise ValueError("The value of intensity cannot be negative" ) # handling of negative values of initial intensity if angle < 0 or angle > 360: raise ValueError("In Malus Law, the angle ...
38
from __future__ import annotations from random import random from typing import Generic, TypeVar __lowerCamelCase : Dict = TypeVar("""KT""") __lowerCamelCase : Dict = TypeVar("""VT""") class A__ ( Generic[KT, VT] ): def __init__( self , A_ = "root" , ...
38
1
from math import asin, atan, cos, radians, sin, sqrt, tan __lowerCamelCase : Optional[int] = 6_3_7_8_1_3_7.0 __lowerCamelCase : Tuple = 6_3_5_6_7_5_2.3_1_4_2_4_5 __lowerCamelCase : Tuple = 637_8137 def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lower...
38
from PIL import Image def A_ ( _lowerCAmelCase ) -> Image: UpperCamelCase , UpperCamelCase : List[Any] = image.size UpperCamelCase : Union[str, Any] = 0 UpperCamelCase : List[str] = image.load() for i in range(_lowerCAmelCase ): for j in range...
38
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __low...
38
from math import loga def A_ ( _lowerCAmelCase ) -> int: if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(_lowerCAmelCase , _lowerCAmelCase ): raise TypeError("Input value must be a 'int' type" ) return 0 if (a == 0) else int(loga(a & -a ) ...
38
1
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, slow, torch_device fro...
38
from __future__ import annotations __lowerCamelCase : Optional[int] = """Muhammad Umer Farooq""" __lowerCamelCase : Tuple = """MIT""" __lowerCamelCase : Optional[int] = """1.0.0""" __lowerCamelCase : int = """Muhammad Umer Farooq""" __lowerCamelCase : Optional[int] ...
38
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __lowerCamelCase : List[str] = logging.get_logger(__name__) __lowerCamelCase : int = { """google/bit-50"...
38
from __future__ import annotations def A_ ( _lowerCAmelCase ) -> list[int]: UpperCamelCase : Optional[Any] = [True] * limit UpperCamelCase : Optional[Any] = False UpperCamelCase : List[str] = False UpperCamelCase : Tuple = True for i in...
38
1
import argparse import re import numpy as np import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SamConfig, SamImageProcessor, SamModel, SamProcessor, SamVisionConfig, ) __lowerCamelCase : int = { """iou_p...
38
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class A__ ( __snake_case ): def __init__( self , A_ , A_ = None , A_ = None , A_ = False , ...
38
1
import unittest from queue import Empty from threading import Thread from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available from transformers.testing_utils import CaptureStdout, require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_availa...
38
import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unordered, map_nested, ...
38
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase : List[str] = logging.get_logger(__name__) __lowerCamelCase : Any = { """SCUT-DLVCLab/lilt-roberta-en-base""": ( """https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/resolv...
38
from ..utils import DummyObject, requires_backends class A__ ( metaclass=__snake_case ): _UpperCAmelCase :Tuple = ['note_seq'] def __init__( self , *A_ , **A_ ): '''simple docstring''' requires_backends(self , ["note_seq"] ...
38
1
from random import randint from tempfile import TemporaryFile import numpy as np def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> int: UpperCamelCase : List[Any] = 0 if start < end: UpperCamelCase : List[str] = randint(_lowerCAm...
38
import math import tensorflow as tf from packaging import version def A_ ( _lowerCAmelCase ) -> Any: UpperCamelCase : List[Any] = tf.convert_to_tensor(_lowerCAmelCase ) UpperCamelCase : Any = 0.5 * (1.0 + tf.math.erf(x / tf.cast(tf.sqrt(2.0 ) , x.dtype )...
38
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_rembert imp...
38
import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_f...
38
1
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=_lowerCamelCase ) class A__ ( _lowerCamelCase ): _UpperCAmelCase :Dict = field(default='language-...
700
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def A_ ( ) -> Dict: UpperCamelCase : Tuple = ArgumentParser( description=( "PyTorch TPU distributed training laun...
38
0
import warnings from ...utils import is_sklearn_available, requires_backends if is_sklearn_available(): from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef __lowerCamelCase : List[str] = ( """This metric will be removed from the library s...
701
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __lowerCamelCase : Union[str, Any] = { """configuration_vision_encoder_decoder""": ["""VisionEncoderDecoderConfig""",...
38
0
import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class A__ ( snake_case__ ): def __init__( self , A_ , A_ , A_ ): '''simple docstring''' UpperCamelCase : Option...
702
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs if is_torch_available(): import t...
38
0
import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common im...
703
from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer __lowerCamelCase : Dict = logging.get_logger(__name__) __lo...
38
0
import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO ) __low...
704
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowerCamelCase : int = { """configuration_convbert""": ["""CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Conv...
38
0
def A_ ( _lowerCAmelCase ) -> Any: if not isinstance(_A , _A ): UpperCamelCase : List[str] = F"""Input value of [number={number}] must be an integer""" raise TypeError(_A ) if number < 0: return False UpperCamelCase : Dict = number * number while ...
705
import logging import os import threading import time try: import warnings except ImportError: __lowerCamelCase : str = None try: import msvcrt except ImportError: __lowerCamelCase : str = None try: import fcntl except ImportError: __lowerCamelCase : List[Any] ...
38
0
import inspect import tempfile from collections import OrderedDict, UserDict from collections.abc import MutableMapping from contextlib import ExitStack, contextmanager from dataclasses import fields from enum import Enum from typing import Any, ContextManager, List, Tuple import numpy as np from .import_utils ...
706
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = None ...
38
0
from maths.prime_factors import prime_factors def A_ ( _lowerCAmelCase ) -> int: if not isinstance(_lowerCAmelCase , _lowerCAmelCase ): UpperCamelCase : int = F"""Input value of [number={number}] must be an integer""" raise TypeError(_lowerCAmelCase ) if number < 1:...
707
from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tens...
38
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase : List[Any] = logging.get_logger(__name__) __lowerCamelCase : Optional[int] = { """asapp/sew-d-tiny-100k""": """https://huggingface.co/asapp/sew-d-tiny-1...
708
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCamelCase : Tuple = logging.get_logger(__name__) __lowerCamelCase : str = { """camembert-base""": """h...
38
0
import re import subprocess import sys __lowerCamelCase : List[Any] = subprocess.check_output("""git merge-base main HEAD""".split()).decode("""utf-8""") __lowerCamelCase : List[Any] = subprocess.check_output(f"""git diff --name-only {fork_point_sha}""".split()).decode("""utf-8""").split()...
709
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> int: return int(input_a == input_a == 0 ) def A_ ( ) -> None: print("Truth Table of NOR Gate:" ) print("| Input 1 | Input 2 | Output |" ) print(F"""| 0 | 0 | {nor_gate(0 , 0 )} |"""...
38
0
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING __lowerCamelCase : List[str] = logging.get_logger(__name__) class A__ ( __snake_case ): _UpperCAmelCase ...
710
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class A__ ( __snake_ca...
38
0
'''simple docstring''' from __future__ import annotations def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[int]: if len(_lowerCAmelCase ) == 0: return False UpperCamelCase : int = len(_lowerCAmelCase ) // 2 if a_list[midpoint] == item: return True ...
711
from math import ceil from typing import List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor from ...utils import TensorType, logging __lowerCamelCase : Dict ...
38
0
def A_ ( _lowerCAmelCase ) -> int: if not isinstance(__lowerCAmelCase , __lowerCAmelCase ) or number < 0: raise ValueError("Input must be a non-negative integer" ) UpperCamelCase : Dict = 0 while number: # This way we arrive at next set bit (next 1) instead of loopin...
712
from __future__ import annotations from random import random from typing import Generic, TypeVar __lowerCamelCase : Dict = TypeVar("""KT""") __lowerCamelCase : Dict = TypeVar("""VT""") class A__ ( Generic[KT, VT] ): def __init__( self , A_ = "root" , ...
38
0
import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosity_info() __lowerCamelCase : Tuple = lo...
713
from PIL import Image def A_ ( _lowerCAmelCase ) -> Image: UpperCamelCase , UpperCamelCase : List[Any] = image.size UpperCamelCase : Union[str, Any] = 0 UpperCamelCase : List[str] = image.load() for i in range(_lowerCAmelCase ): for j in range...
38
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, ...
714
from math import loga def A_ ( _lowerCAmelCase ) -> int: if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(_lowerCAmelCase , _lowerCAmelCase ): raise TypeError("Input value must be a 'int' type" ) return 0 if (a == 0) else int(loga(a & -a ) ...
38
0
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def A_ ( ) -> Dict: UpperCamelCase : Optional[int] = ArgumentParser( description=( "PyTorch TPU distributed train...
715
from __future__ import annotations __lowerCamelCase : Optional[int] = """Muhammad Umer Farooq""" __lowerCamelCase : Tuple = """MIT""" __lowerCamelCase : Optional[int] = """1.0.0""" __lowerCamelCase : int = """Muhammad Umer Farooq""" __lowerCamelCase : Optional[int] ...
38
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import t...
716
from __future__ import annotations def A_ ( _lowerCAmelCase ) -> list[int]: UpperCamelCase : Optional[Any] = [True] * limit UpperCamelCase : Optional[Any] = False UpperCamelCase : List[str] = False UpperCamelCase : Tuple = True for i in...
38
0
from __future__ import annotations from math import pi # Define the Reduced Planck Constant ℏ (H bar), speed of light C, value of # Pi and the function __lowerCamelCase : List[Any] = 1.0_5_4_5_7_1_8_1_7E-3_4 # unit of ℏ : J * s __lowerCamelCase : Optional[Any] = 3E8 # unit of c : m * s^...
717
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class A__ ( __snake_case ): def __init__( self , A_ , A_ = None , A_ = None , A_ = False , ...
38
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...
718
import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unordered, map_nested, ...
38
0
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def A_ ( ) -> Dict: UpperCamelCase : Union[str, Any] = ArgumentParser( description=( "PyTorch TPU distributed tra...
719
from ..utils import DummyObject, requires_backends class A__ ( metaclass=__snake_case ): _UpperCAmelCase :Tuple = ['note_seq'] def __init__( self , *A_ , **A_ ): '''simple docstring''' requires_backends(self , ["note_seq"] ...
38
0
import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class A__ ( _...
720
import math import tensorflow as tf from packaging import version def A_ ( _lowerCAmelCase ) -> Any: UpperCamelCase : List[Any] = tf.convert_to_tensor(_lowerCAmelCase ) UpperCamelCase : Any = 0.5 * (1.0 + tf.math.erf(x / tf.cast(tf.sqrt(2.0 ) , x.dtype )...
38
0
import pandas as pd from matplotlib import pyplot as plt from sklearn.linear_model import LinearRegression # Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split # Fitting Polynomial Regression to the dataset from sklearn.preprocessing import PolynomialFe...
721
import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_f...
38
0
from jiwer import compute_measures import datasets __lowerCamelCase : List[Any] = """\ @inproceedings{inproceedings, author = {Morris, Andrew and Maier, Viktoria and Green, Phil}, year = {2004}, month = {01}, pages = {}, title = {From WER and RIL to MER and WIL: improv...
700
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def A_ ( ) -> Dict: UpperCamelCase : Tuple = ArgumentParser( description=( "PyTorch TPU distributed training laun...
38
0
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer __lowerCamelCase : Any = logging.get_logger(__name__) __lowerCamelCase : List[str] = {"""vocab_file""": ...
701
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __lowerCamelCase : Union[str, Any] = { """configuration_vision_encoder_decoder""": ["""VisionEncoderDecoderConfig""",...
38
0
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner import Split, ...
702
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs if is_torch_available(): import t...
38
0
class A__ : def __init__( self , A_ ): '''simple docstring''' UpperCamelCase : List[str] = n UpperCamelCase : Optional[int] = [None] * self.n UpperCamelCase : int = 0 # index of the first element Up...
703
from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer __lowerCamelCase : Dict = logging.get_logger(__name__) __lo...
38
0
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logging, ) from transformers.models...
704
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowerCamelCase : int = { """configuration_convbert""": ["""CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Conv...
38
0
def A_ ( _lowerCAmelCase ) -> Dict: if not numbers: return 0 if not isinstance(_lowerCAmelCase , (list, tuple) ) or not all( isinstance(_lowerCAmelCase , _lowerCAmelCase ) for number in numbers ): raise ValueError("numbers must be an iterable of integers" ) Upper...
705
import logging import os import threading import time try: import warnings except ImportError: __lowerCamelCase : str = None try: import msvcrt except ImportError: __lowerCamelCase : str = None try: import fcntl except ImportError: __lowerCamelCase : List[Any] ...
38
0
import unittest from transformers import AutoConfig, AutoTokenizer, BertConfig, TensorType, is_flax_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, slow if is_flax_available(): import jax from transformers.models.auto.modeling_flax_auto import FlaxAutoModel ...
706
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = None ...
38
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import ...
707
from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tens...
38
0
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() __lowerCamelCase : Tuple = [ "word_embeddings_layernor...
708
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCamelCase : Tuple = logging.get_logger(__name__) __lowerCamelCase : str = { """camembert-base""": """h...
38
0
import cva import numpy as np class A__ : def __init__( self , A_ , A_ ): '''simple docstring''' if k in (0.04, 0.06): UpperCamelCase : int = k UpperCamelCase : Dict = window_size else: raise Va...
709
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> int: return int(input_a == input_a == 0 ) def A_ ( ) -> None: print("Truth Table of NOR Gate:" ) print("| Input 1 | Input 2 | Output |" ) print(F"""| 0 | 0 | {nor_gate(0 , 0 )} |"""...
38
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __lowerCamelCase : Tuple = { '''configuration_altclip''': [ '''ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''A...
710
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class A__ ( __snake_ca...
38
0
'''simple docstring''' from __future__ import annotations def A_ ( _lowerCAmelCase , _lowerCAmelCase = None , _lowerCAmelCase = None ) -> Optional[Any]: if start is None: UpperCamelCase : Union[str, Any] = 0 if end is None: UpperCamelCase : List...
711
from math import ceil from typing import List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor from ...utils import TensorType, logging __lowerCamelCase : Dict ...
38
0
import os import unittest from transformers import FunnelTokenizer, FunnelTokenizerFast from transformers.models.funnel.tokenization_funnel import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class...
712
from __future__ import annotations from random import random from typing import Generic, TypeVar __lowerCamelCase : Dict = TypeVar("""KT""") __lowerCamelCase : Dict = TypeVar("""VT""") class A__ ( Generic[KT, VT] ): def __init__( self , A_ = "root" , ...
38
0
def A_ ( _lowerCAmelCase = 100 ) -> int: UpperCamelCase : Optional[Any] = (n * (n + 1) // 2) ** 2 UpperCamelCase : List[str] = n * (n + 1) * (2 * n + 1) // 6 return sum_cubes - sum_squares if __name__ == "__main__": print(f"""{solution() = }""")
713
from PIL import Image def A_ ( _lowerCAmelCase ) -> Image: UpperCamelCase , UpperCamelCase : List[Any] = image.size UpperCamelCase : Union[str, Any] = 0 UpperCamelCase : List[str] = image.load() for i in range(_lowerCAmelCase ): for j in range...
38
0
'''simple docstring''' from collections import defaultdict def A_ ( _lowerCAmelCase ) -> str: UpperCamelCase : str = 1 UpperCamelCase : int = True for v in tree[start]: if v not in visited: ret += dfs(_lowerCAmelCase ) if ret % 2 == 0: cuts.append(_lowe...
714
from math import loga def A_ ( _lowerCAmelCase ) -> int: if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(_lowerCAmelCase , _lowerCAmelCase ): raise TypeError("Input value must be a 'int' type" ) return 0 if (a == 0) else int(loga(a & -a ) ...
38
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer __lowerCamelCase : int = logging.get_logger(__name__) __low...
715
from __future__ import annotations __lowerCamelCase : Optional[int] = """Muhammad Umer Farooq""" __lowerCamelCase : Tuple = """MIT""" __lowerCamelCase : Optional[int] = """1.0.0""" __lowerCamelCase : int = """Muhammad Umer Farooq""" __lowerCamelCase : Optional[int] ...
38
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase : List[str] = logging.get_logger(__name__) __lowerCamelCase : Any = { '''RWKV/rwkv-4-169m-pile''': '''https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json''', '''RWKV...
716
from __future__ import annotations def A_ ( _lowerCAmelCase ) -> list[int]: UpperCamelCase : Optional[Any] = [True] * limit UpperCamelCase : Optional[Any] = False UpperCamelCase : List[str] = False UpperCamelCase : Tuple = True for i in...
38
0
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable __lowerCamelCase : Dict = { """configuration_gpt_neox_japanese""": ["""GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTNeoXJapaneseConfig"""], ...
717
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class A__ ( __snake_case ): def __init__( self , A_ , A_ = None , A_ = None , A_ = False , ...
38
0
import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determinism() @slow @require_torch_gpu class ...
718
import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unordered, map_nested, ...
38
0
from math import pow def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , ) -> tuple[int, int]: if current_sum == needed_sum: # If the sum of the powers is equal to needed_sum, then we have a solution...
719
from ..utils import DummyObject, requires_backends class A__ ( metaclass=__snake_case ): _UpperCAmelCase :Tuple = ['note_seq'] def __init__( self , *A_ , **A_ ): '''simple docstring''' requires_backends(self , ["note_seq"] ...
38
0
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqLM, AutoTokeniz...
720
import math import tensorflow as tf from packaging import version def A_ ( _lowerCAmelCase ) -> Any: UpperCamelCase : List[Any] = tf.convert_to_tensor(_lowerCAmelCase ) UpperCamelCase : Any = 0.5 * (1.0 + tf.math.erf(x / tf.cast(tf.sqrt(2.0 ) , x.dtype )...
38
0
from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class A__ ( yaml.SafeLoader ): '''simple docstring''' def __UpperCamelCase( self , A_ ): '''simple docstring''' UpperCamelCase : Optiona...
721
import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_f...
38
0
__lowerCamelCase : Tuple = { """A""": """.-""", """B""": """-...""", """C""": """-.-.""", """D""": """-..""", """E""": """.""", """F""": """..-.""", """G""": """--.""", """H""": """....""", """I""": """..""", """J""": """.---""", """K""": """-.-""", """L""": """.-..""", """M""": """--""...
700
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def A_ ( ) -> Dict: UpperCamelCase : Tuple = ArgumentParser( description=( "PyTorch TPU distributed training laun...
38
0
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 # noqa: F401 # Here to...
701
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __lowerCamelCase : Union[str, Any] = { """configuration_vision_encoder_decoder""": ["""VisionEncoderDecoderConfig""",...
38
0
def A_ ( _lowerCAmelCase ) -> Union[str, Any]: if len(lowerCAmelCase_ ) <= 1: return lst UpperCamelCase : Union[str, Any] = 1 while i < len(lowerCAmelCase_ ): if lst[i - 1] <= lst[i]: i += 1 else: UpperCamelCase : List[str] = lst[i], lst[i - 1] i -...
702
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs if is_torch_available(): import t...
38
0
from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance __lowerCamelCase : str = 637_8137.0 __lowerCamelCase : List[Any] = 635_6752.31_4245 __lowerCamelCase : int = 637_8137 def A_ ( _lowerCAmelCase , _lowerCAmelCase ...
703
from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer __lowerCamelCase : Dict = logging.get_logger(__name__) __lo...
38
0
import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def A_ ( _lowerCAmelCase ) -> List[str]: UpperCamelCase : List[str] = args.pruning_method UpperCamelCase : Tuple = args.threshold Up...
704
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) __lowerCamelCase : int = { """configuration_convbert""": ["""CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Conv...
38
0
from typing import Union import fire import torch from tqdm import tqdm def A_ ( _lowerCAmelCase , _lowerCAmelCase = "cpu" , _lowerCAmelCase = None ) -> Dict: UpperCamelCase : Tuple = torch.load(_lowerCAmelCase , map_location=_lowerCAmelCase ) for k,...
705
import logging import os import threading import time try: import warnings except ImportError: __lowerCamelCase : str = None try: import msvcrt except ImportError: __lowerCamelCase : str = None try: import fcntl except ImportError: __lowerCamelCase : List[Any] ...
38
0
import flax.linen as nn import jax import jax.numpy as jnp class A__ ( nn.Module ): _UpperCAmelCase :int _UpperCAmelCase :jnp.dtype = jnp.floataa def __UpperCamelCase( self ): '''simple docstring''' UpperCamelCase : str = n...
706
import argparse from pathlib import Path from transformers import AutoConfig, AutoTokenizer, RagConfig, RagSequenceForGeneration, RagTokenForGeneration def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = None ...
38
0
import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, MusicgenProcesso...
707
from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tens...
38
0
import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor __lowerCamelCase : int = logging.get_logger(__name__) class A__ ( _lowerCAmelCase ): def __init__( self , *A_ , **A_ ): '''simple docstring''' ...
708
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCamelCase : Tuple = logging.get_logger(__name__) __lowerCamelCase : str = { """camembert-base""": """h...
38
0
def A_ ( _lowerCAmelCase = 1 , _lowerCAmelCase = 1000 ) -> List[Any]: UpperCamelCase : Optional[int] = 1 UpperCamelCase : List[Any] = 0 for divide_by_number in range(snake_case_ , digit + 1 ): UpperCamelCase : list[int] = [] Upper...
709
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> int: return int(input_a == input_a == 0 ) def A_ ( ) -> None: print("Truth Table of NOR Gate:" ) print("| Input 1 | Input 2 | Output |" ) print(F"""| 0 | 0 | {nor_gate(0 , 0 )} |"""...
38
0
'''simple docstring''' def A_ ( ) -> Optional[int]: UpperCamelCase : Optional[Any] = 0 for i in range(1 , 1001 ): total += i**i return str(__UpperCamelCase )[-10:] if __name__ == "__main__": print(solution())
710
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class A__ ( __snake_ca...
38
0
'''simple docstring''' import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig __lowerCamelCase : List[Any] = logging.get_logger(__name__) class A__ : ...
711
from math import ceil from typing import List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor from ...utils import TensorType, logging __lowerCamelCase : Dict ...
38
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCamelCase : Union[str, Any] = logging.get_logger(__name__) __lowerCamelCase : str = { "RWKV/rwkv-4-169m-pile": "https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json", "RWKV/rwk...
712
from __future__ import annotations from random import random from typing import Generic, TypeVar __lowerCamelCase : Dict = TypeVar("""KT""") __lowerCamelCase : Dict = TypeVar("""VT""") class A__ ( Generic[KT, VT] ): def __init__( self , A_ = "root" , ...
38
0
__lowerCamelCase : Optional[int] = """ # Installazione di Transformers ! pip install transformers datasets # Per installare dalla fonte invece dell\'ultima versione rilasciata, commenta il comando sopra e # rimuovi la modalità commento al comando seguente. # ! pip install git+https://github.com/hugging...
713
from PIL import Image def A_ ( _lowerCAmelCase ) -> Image: UpperCamelCase , UpperCamelCase : List[Any] = image.size UpperCamelCase : Union[str, Any] = 0 UpperCamelCase : List[str] = image.load() for i in range(_lowerCAmelCase ): for j in range...
38
0
'''simple docstring''' import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup __lowerCamelCase : List[Any] = logging.get_...
714
from math import loga def A_ ( _lowerCAmelCase ) -> int: if a < 0: raise ValueError("Input value must be a positive integer" ) elif isinstance(_lowerCAmelCase , _lowerCAmelCase ): raise TypeError("Input value must be a 'int' type" ) return 0 if (a == 0) else int(loga(a & -a ) ...
38
0
import unittest import numpy as np from transformers import BertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from transformers.mod...
715
from __future__ import annotations __lowerCamelCase : Optional[int] = """Muhammad Umer Farooq""" __lowerCamelCase : Tuple = """MIT""" __lowerCamelCase : Optional[int] = """1.0.0""" __lowerCamelCase : int = """Muhammad Umer Farooq""" __lowerCamelCase : Optional[int] ...
38
0
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class A__ ( UpperCamelCase_ ): _UpperCAmelCase :List[str] ...
716
from __future__ import annotations def A_ ( _lowerCAmelCase ) -> list[int]: UpperCamelCase : Optional[Any] = [True] * limit UpperCamelCase : Optional[Any] = False UpperCamelCase : List[str] = False UpperCamelCase : Tuple = True for i in...
38
0