code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a , a ) -> set[str]: __A , __A : int = set(a ), [start] while stack: __A : List[str] = stack.pop() explored.add(a ) # Differences from BFS: ...
280
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase : Any = { '''configuration_mvp''': ['''MVP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MvpConfig''', '''MvpOnnxConfig'''], '''tokenizatio...
280
1
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() UpperCAmelCase : Union[str, Any] = logging.get_logger('''transformers.models.speecht5''') def _SCREAMING_SNAKE_CASE ( a , a...
280
def _SCREAMING_SNAKE_CASE ( a ) -> Tuple: __A , __A : Optional[Any] = [], [] while len(a ) > 1: __A , __A : Any = min(a ), max(a ) start.append(a ) end.append(a ) collection.remove(a ) collec...
280
1
import math def _SCREAMING_SNAKE_CASE ( a , a = 0 , a = 0 ) -> list: __A : List[str] = end or len(a ) for i in range(a , a ): __A : List[str] = i __A : Optional[int] = array[i] wh...
280
def _SCREAMING_SNAKE_CASE ( a , a = 0 ) -> list: __A : int = length or len(a ) __A : str = False for i in range(length - 1 ): if list_data[i] > list_data[i + 1]: __A , __A : Optional[int] = list_dat...
280
1
from collections import deque class _A: """simple docstring""" def __init__( self , _A , _A , _A ): __A : int = process_name # process name __A : Union[str, Any] = arrival_time # arrival time of the process ...
280
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a ) -> int: if not nums: return 0 __A : Optional[int] = nums[0] __A : str = 0 for num in nums[1:]: __A , __A : Tuple = ( max_...
280
1
from .data_collator import ( DataCollatorForLanguageModeling, DataCollatorForPermutationLanguageModeling, DataCollatorForSeqaSeq, DataCollatorForSOP, DataCollatorForTokenClassification, DataCollatorForWholeWordMask, DataCollatorWithPadding, DefaultDataCollator, default_data_col...
280
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase : Optional[int] = { '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], '''tokenizat...
280
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCAmelCase : Tuple = { '''configuration_conditional_detr''': [ '''CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ConditionalDe...
280
def _SCREAMING_SNAKE_CASE ( a ) -> str: if number > 0: raise ValueError('input must be a negative integer' ) __A : Optional[int] = len(bin(a )[3:] ) __A : Dict = bin(abs(a ) - (1 << binary_number_length) )[3:] __A : int = ...
280
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...
280
import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging UpperCAmelCase : Any = logging.get_logger(__name__) def _...
280
1
import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from transformers.utils import W...
280
def _SCREAMING_SNAKE_CASE ( a , a ) -> list[int]: __A : Optional[int] = int(a ) # Initialize Result __A : Optional[int] = [] # Traverse through all denomination for denomination in reversed(a ): # Find denominations ...
280
1
def _SCREAMING_SNAKE_CASE ( a , a = 0 ) -> list: __A : int = length or len(a ) __A : str = False for i in range(length - 1 ): if list_data[i] > list_data[i + 1]: __A , __A : Optional[int] = list_dat...
280
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if i...
280
1
def _SCREAMING_SNAKE_CASE ( a ) -> Tuple: __A , __A : Optional[Any] = [], [] while len(a ) > 1: __A , __A : Any = min(a ), max(a ) start.append(a ) end.append(a ) collection.remove(a ) collec...
280
import argparse import json from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( ) -> List[Any]: __A : Tuple = argparse.ArgumentParser() # Required parameters parser.add_argument( '--src_path' , type=a , default='biencoder-nq-dev.json' ...
280
1
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a ) -> int: if not nums: return 0 __A : Optional[int] = nums[0] __A : str = 0 for num in nums[1:]: __A , __A : Tuple = ( max_...
280
from heapq import heappop, heappush import numpy as np def _SCREAMING_SNAKE_CASE ( a , a , a , a , ) -> tuple[float | int, list[tuple[int, int]]]: __A , __A : int = grid.shape __A : Any = [-1, 1, 0, 0] __A...
280
1
def _SCREAMING_SNAKE_CASE ( a ) -> list: if len(a ) <= 1: return lst __A : str = 1 while i < len(a ): if lst[i - 1] <= lst[i]: i += 1 else: __A , __A : Optional[Any] = lst[i], lst[i - ...
280
from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...uti...
280
1
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a , a , a ) -> float: if days_between_payments <= 0: raise ValueError('days_between_payments must be > 0' ) if daily_interest_rate < 0: raise ValueError('daily_interest_rate must...
280
import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import version from torch import nn ...
280
1
class _A: """simple docstring""" def __init__( self , _A ): __A : Union[str, Any] = val __A : List[str] = None __A : List[Any] = None def UpperCAmelCase_ ( self , _A ): if sel...
280
import colorsys from PIL import Image # type: ignore def _SCREAMING_SNAKE_CASE ( a , a , a ) -> float: __A : List[str] = x __A : str = y for step in range(a ): # noqa: B007 __A : Union[str, Any] = a * ...
280
1
from __future__ import annotations import unittest from transformers import DebertaVaConfig, 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_tensor, random_attention_mask...
280
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a , a , a ) -> float: if days_between_payments <= 0: raise ValueError('days_between_payments must be > 0' ) if daily_interest_rate < 0: raise ValueError('daily_interest_rate must...
280
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCAmelCase : Any = {'''configuration_glpn''': ['''GLPN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GLPNConfig''']} try: if not is_vision_available(): ...
280
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCAmelCase : Any = { '''configuration_falcon''': ['''FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FalconConfig'''], } try: if not is_torch_available(...
280
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase : int = logging.get_logger(__name__) UpperC...
280
def _SCREAMING_SNAKE_CASE ( a ) -> bool: return str(a ) == str(a )[::-1] def _SCREAMING_SNAKE_CASE ( a ) -> int: return int(a ) + int(str(a )[::-1] ) def _SCREAMING_SNAKE_CASE ( a = 1_00_00 ) -> int: __A : int = [] ...
280
1
import argparse import re from flax.traverse_util import flatten_dict, unflatten_dict from tax import checkpoints from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration from transformers.modeling_flax_pytorch_utils import load_flax_weights_in_pytorch_model from transformer...
280
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class _A: """simple docstring""" def __init__( self , _A = None ): if components is None: __A : int = [] ...
280
1
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...file_utils import TensorType, is_torch_available from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx...
280
import unittest from transformers import BertGenerationTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin UpperCAmelCase : List[str] = ...
280
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : List[str] = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" UpperCamelCase : List[Any] = '''timm_backbone''' def __init__...
280
import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from transformers.testing_utils...
280
1
from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline UpperCAmelCase : int = logging.get_logger(__name__) class _A( ...
280
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
280
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : Optional[int] = logging.get_logger(__name__) UpperCAmelCase : List[Any] = { '''weiweishi/roc-bert-base-zh''': '''https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/con...
280
import math def _SCREAMING_SNAKE_CASE ( a ) -> list[int]: __A : List[str] = [] __A : Any = 2 __A : Union[str, Any] = int(math.sqrt(a ) ) # Size of every segment __A : Any = [True] * (end + 1) __A : Lis...
280
1
# Algorithm for the pigeonhole sorting def _SCREAMING_SNAKE_CASE ( a ) -> List[Any]: __A : List[Any] = min(a ) # min() finds the minimum value __A : int = max(a ) # max() finds the maximum value __A : List[str] = max_val - min...
280
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase : Any = { '''configuration_mvp''': ['''MVP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MvpConfig''', '''MvpOnnxConfig'''], '''tokenizatio...
280
1
import collections import json import os import re from typing import TYPE_CHECKING, List, Optional, Tuple import numpy as np from ...tokenization_utils_fast import PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation UpperCAme...
280
def _SCREAMING_SNAKE_CASE ( a ) -> Tuple: __A , __A : Optional[Any] = [], [] while len(a ) > 1: __A , __A : Any = min(a ), max(a ) start.append(a ) end.append(a ) collection.remove(a ) collec...
280
1
import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase : str = logging.get_logger(__name__) UpperCAmelCase : Any = ''...
280
def _SCREAMING_SNAKE_CASE ( a , a = 0 ) -> list: __A : int = length or len(a ) __A : str = False for i in range(length - 1 ): if list_data[i] > list_data[i + 1]: __A , __A : Optional[int] = list_dat...
280
1
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArguments @requi...
280
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a ) -> int: if not nums: return 0 __A : Optional[int] = nums[0] __A : str = 0 for num in nums[1:]: __A , __A : Tuple = ( max_...
280
1
def _SCREAMING_SNAKE_CASE ( a ) -> str: if number > 0: raise ValueError('input must be a negative integer' ) __A : Optional[int] = len(bin(a )[3:] ) __A : Dict = bin(abs(a ) - (1 << binary_number_length) )[3:] __A : int = ...
280
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase : Optional[int] = { '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], '''tokenizat...
280
1
import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class _A: """simple docstring""" def __init__( self , _A ): if isinstance(_A , _A ): ...
280
def _SCREAMING_SNAKE_CASE ( a ) -> str: if number > 0: raise ValueError('input must be a negative integer' ) __A : Optional[int] = len(bin(a )[3:] ) __A : Dict = bin(abs(a ) - (1 << binary_number_length) )[3:] __A : int = ...
280
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase : Optional[int] = logging.get_logger(__name__) UpperCAmelCase : List[Any] = { '''xlm-r...
280
import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging UpperCAmelCase : Any = logging.get_logger(__name__) def _...
280
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCAmelCase : str = { '''configuration_mega''': ['''MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MegaConfig''', '''MegaOnnxConfig'''], } try: if not is_...
280
def _SCREAMING_SNAKE_CASE ( a , a ) -> list[int]: __A : Optional[int] = int(a ) # Initialize Result __A : Optional[int] = [] # Traverse through all denomination for denomination in reversed(a ): # Find denominations ...
280
1
def _SCREAMING_SNAKE_CASE ( a , a ) -> int: return int((input_a, input_a).count(0 ) == 0 ) def _SCREAMING_SNAKE_CASE ( ) -> None: assert and_gate(0 , 0 ) == 0 assert and_gate(0 , 1 ) == 0 assert and_gate(1 , 0 ) =...
280
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if i...
280
1
import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) UpperCAmelCase : List[str] = { '''facebook/encodec_24khz''': '''https:/...
280
import argparse import json from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( ) -> List[Any]: __A : Tuple = argparse.ArgumentParser() # Required parameters parser.add_argument( '--src_path' , type=a , default='biencoder-nq-dev.json' ...
280
1
import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import AdamW from torch.utils.data import Dat...
280
from heapq import heappop, heappush import numpy as np def _SCREAMING_SNAKE_CASE ( a , a , a , a , ) -> tuple[float | int, list[tuple[int, int]]]: __A , __A : int = grid.shape __A : Any = [-1, 1, 0, 0] __A...
280
1
from maths.prime_check import is_prime def _SCREAMING_SNAKE_CASE ( a ) -> int: if not isinstance(a , a ): __A : Optional[Any] = F"""Input value of [number={number}] must be an integer""" raise TypeError(a ) if is_prime(a ) and is_prim...
280
from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...uti...
280
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase : Optional[Any] = { '''configuration_bloom''': ['''BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BloomConfig''', '''BloomOnnxConfig'''], ...
280
import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import version from torch import nn ...
280
1
def _SCREAMING_SNAKE_CASE ( a ) -> Optional[Any]: __A : Tuple = [0] * len(a ) __A : Tuple = [] __A : Dict = [1] * len(a ) for values in graph.values(): for i in values: indegree[i] += 1 for i in range(...
280
import colorsys from PIL import Image # type: ignore def _SCREAMING_SNAKE_CASE ( a , a , a ) -> float: __A : List[str] = x __A : str = y for step in range(a ): # noqa: B007 __A : Union[str, Any] = a * ...
280
1
import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig UpperCAmelCase : Any = { '''facebook/maskformer-swin-base-ade''': ( ...
280
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a , a , a ) -> float: if days_between_payments <= 0: raise ValueError('days_between_payments must be > 0' ) if daily_interest_rate < 0: raise ValueError('daily_interest_rate must...
280
1
import warnings from ...utils import logging from .image_processing_deformable_detr import DeformableDetrImageProcessor UpperCAmelCase : int = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" def __init__( self , *_A , *...
280
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCAmelCase : Any = { '''configuration_falcon''': ['''FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FalconConfig'''], } try: if not is_torch_available(...
280
1
import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.auto.modeling_tf_auto import T...
280
def _SCREAMING_SNAKE_CASE ( a ) -> bool: return str(a ) == str(a )[::-1] def _SCREAMING_SNAKE_CASE ( a ) -> int: return int(a ) + int(str(a )[::-1] ) def _SCREAMING_SNAKE_CASE ( a = 1_00_00 ) -> int: __A : int = [] ...
280
1
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor UpperCAmelCase : Dict = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" def __init__( self , *_A , **_A ): ...
280
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class _A: """simple docstring""" def __init__( self , _A = None ): if components is None: __A : int = [] ...
280
1
import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_common import SequenceFe...
280
import unittest from transformers import BertGenerationTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin UpperCAmelCase : List[str] = ...
280
1
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=snake_case__ ) class _A( snake_case__ ): """simple docstring""" UpperCamelCase : str ...
280
import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from transformers.testing_utils...
280
1
import tempfile import unittest from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from transformers.testing_utils import ( is_torch_available, require_optimum, require_torch, slow, ) if is_torch_available(): import torch @require_torch @require_optimum @slow class _A(...
280
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
280
1
class _A: """simple docstring""" def __init__( self , _A ): __A : Tuple = set_counts __A : Union[str, Any] = max(_A ) __A : List[str] = len(_A ) __A : Union[str, Any] = [1] * num_set...
280
import math def _SCREAMING_SNAKE_CASE ( a ) -> list[int]: __A : List[str] = [] __A : Any = 2 __A : Union[str, Any] = int(math.sqrt(a ) ) # Size of every segment __A : Any = [True] * (end + 1) __A : Lis...
280
1
from torch import nn def _SCREAMING_SNAKE_CASE ( a ) -> List[Any]: if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU() else: raise ValueError(F"""Unsuppo...
280
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase : Any = { '''configuration_mvp''': ['''MVP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MvpConfig''', '''MvpOnnxConfig'''], '''tokenizatio...
280
1
import argparse import json from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( ) -> List[Any]: __A : Tuple = argparse.ArgumentParser() # Required parameters parser.add_argument( '--src_path' , type=a , default='biencoder-nq-dev.json' ...
280
def _SCREAMING_SNAKE_CASE ( a ) -> Tuple: __A , __A : Optional[Any] = [], [] while len(a ) > 1: __A , __A : Any = min(a ), max(a ) start.append(a ) end.append(a ) collection.remove(a ) collec...
280
1
import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging UpperCAmelCase : Any = logging.get_logger(__name__) def _...
280
def _SCREAMING_SNAKE_CASE ( a , a = 0 ) -> list: __A : int = length or len(a ) __A : str = False for i in range(length - 1 ): if list_data[i] > list_data[i + 1]: __A , __A : Optional[int] = list_dat...
280
1
import colorsys from PIL import Image # type: ignore def _SCREAMING_SNAKE_CASE ( a , a , a ) -> float: __A : List[str] = x __A : str = y for step in range(a ): # noqa: B007 __A : Union[str, Any] = a * ...
280
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a ) -> int: if not nums: return 0 __A : Optional[int] = nums[0] __A : str = 0 for num in nums[1:]: __A , __A : Tuple = ( max_...
280
1
import inspect import unittest from transformers import ViTMSNConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test...
280
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase : Optional[int] = { '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], '''tokenizat...
280
1
def _SCREAMING_SNAKE_CASE ( a ) -> list: __A : List[str] = False while is_sorted is False: # Until all the indices are traversed keep looping __A : Dict = True for i in range(0 , len(a ) - 1 , 2 ): # iterating over al...
280
def _SCREAMING_SNAKE_CASE ( a ) -> str: if number > 0: raise ValueError('input must be a negative integer' ) __A : Optional[int] = len(bin(a )[3:] ) __A : Dict = bin(abs(a ) - (1 << binary_number_length) )[3:] __A : int = ...
280
1
from __future__ import annotations class _A: """simple docstring""" def __init__( self , _A , _A ): __A , __A : Optional[int] = text, pattern __A , __A : Tuple = len(_A ), len(_A ) def UpperC...
280
import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging UpperCAmelCase : Any = logging.get_logger(__name__) def _...
280
1
UpperCAmelCase : Any = { '''a''': '''AAAAA''', '''b''': '''AAAAB''', '''c''': '''AAABA''', '''d''': '''AAABB''', '''e''': '''AABAA''', '''f''': '''AABAB''', '''g''': '''AABBA''', '''h''': '''AABBB''', '''i''': '''ABAAA''', '''j''': '''BBBAA''', '''k''': '...
280
def _SCREAMING_SNAKE_CASE ( a , a ) -> list[int]: __A : Optional[int] = int(a ) # Initialize Result __A : Optional[int] = [] # Traverse through all denomination for denomination in reversed(a ): # Find denominations ...
280
1
from datetime import datetime import matplotlib.pyplot as plt import torch def _SCREAMING_SNAKE_CASE ( a ) -> Optional[int]: for param in module.parameters(): __A : int = False def _SCREAMING_SNAKE_CASE ( ) -> List[str]: __A : ...
280
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if i...
280
1
import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def _SCREAMING_SNAKE_CASE ( a ) -> List[str]: # vision encoder if "img_encoder.pos_embed" in name: __A : List[str] = ...
280
import argparse import json from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( ) -> List[Any]: __A : Tuple = argparse.ArgumentParser() # Required parameters parser.add_argument( '--src_path' , type=a , default='biencoder-nq-dev.json' ...
280
1
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...
280
from heapq import heappop, heappush import numpy as np def _SCREAMING_SNAKE_CASE ( a , a , a , a , ) -> tuple[float | int, list[tuple[int, int]]]: __A , __A : int = grid.shape __A : Any = [-1, 1, 0, 0] __A...
280
1
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class _A: """simple docstring""" def __init__( self , _A = None ): if components is None: __A : int = [] ...
280
from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...uti...
280
1
from collections import namedtuple UpperCAmelCase : int = namedtuple('''from_to''', '''from_ to''') UpperCAmelCase : List[str] = { '''cubicmeter''': from_to(1, 1), '''litre''': from_to(0.001, 10_00), '''kilolitre''': from_to(1, 1), '''gallon''': from_to(0.00454, 264...
280
import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import version from torch import nn ...
280
1
import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def _SCREAMING_SNAKE_CASE ( a , a ) -> int: assert isin...
280
import colorsys from PIL import Image # type: ignore def _SCREAMING_SNAKE_CASE ( a , a , a ) -> float: __A : List[str] = x __A : str = y for step in range(a ): # noqa: B007 __A : Union[str, Any] = a * ...
280
1
# 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 b...
280
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a , a , a ) -> float: if days_between_payments <= 0: raise ValueError('days_between_payments must be > 0' ) if daily_interest_rate < 0: raise ValueError('daily_interest_rate must...
280
1
import argparse import gc import json import os 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 Accele...
280
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCAmelCase : Any = { '''configuration_falcon''': ['''FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FalconConfig'''], } try: if not is_torch_available(...
280
1
from __future__ import annotations class _A: """simple docstring""" def __init__( self , _A ): __A : Optional[int] = data __A : Node | None = None __A : Node | None = None def _SCREAMING_SNAKE_CASE ...
280
def _SCREAMING_SNAKE_CASE ( a ) -> bool: return str(a ) == str(a )[::-1] def _SCREAMING_SNAKE_CASE ( a ) -> int: return int(a ) + int(str(a )[::-1] ) def _SCREAMING_SNAKE_CASE ( a = 1_00_00 ) -> int: __A : int = [] ...
280
1
from PIL import Image def _SCREAMING_SNAKE_CASE ( a ) -> Image: __A , __A : Union[str, Any] = image.size __A : Dict = 0 __A : Tuple = image.load() for i in range(a ): for j in range(a ): __A : ...
280
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class _A: """simple docstring""" def __init__( self , _A = None ): if components is None: __A : int = [] ...
280
1
import random def _SCREAMING_SNAKE_CASE ( a ) -> bool: __A : Dict = num - 1 __A : Dict = 0 while s % 2 == 0: __A : Any = s // 2 t += 1 for _ in range(5 ): __A : List[Any] = random.r...
280
import unittest from transformers import BertGenerationTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin UpperCAmelCase : List[str] = ...
280
1
from __future__ import annotations import math from collections.abc import Callable def _SCREAMING_SNAKE_CASE ( a , a , a , a = 1_00 , ) -> float: __A : Optional[int] = x_start __A : str = fnc(a ) __A : Op...
280
import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from transformers.testing_utils...
280
1
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, PILImageResa...
280
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
280
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase : Optional[int] = { '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], '''tokenizat...
280
import math def _SCREAMING_SNAKE_CASE ( a ) -> list[int]: __A : List[str] = [] __A : Any = 2 __A : Union[str, Any] = int(math.sqrt(a ) ) # Size of every segment __A : Any = [True] * (end + 1) __A : Lis...
280
1
from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def _SCREAMING_SNAKE_CASE ( a , a , a = 10**-10 ) -> float: __A : Tuple = a while True: __A : List[Any] = ...
280
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase : Any = { '''configuration_mvp''': ['''MVP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MvpConfig''', '''MvpOnnxConfig'''], '''tokenizatio...
280
1
import torch from diffusers import DiffusionPipeline class _A( snake_case__ ): """simple docstring""" def __init__( self , _A , _A ): super().__init__() self.register_modules(unet=_A , scheduler=_A ) def __call__( self ...
280
def _SCREAMING_SNAKE_CASE ( a ) -> Tuple: __A , __A : Optional[Any] = [], [] while len(a ) > 1: __A , __A : Any = min(a ), max(a ) start.append(a ) end.append(a ) collection.remove(a ) collec...
280
1
import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modules import _PACKAGED_DATAS...
280
def _SCREAMING_SNAKE_CASE ( a , a = 0 ) -> list: __A : int = length or len(a ) __A : str = False for i in range(length - 1 ): if list_data[i] > list_data[i + 1]: __A , __A : Optional[int] = list_dat...
280
1
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 as nn ...
280
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a ) -> int: if not nums: return 0 __A : Optional[int] = nums[0] __A : str = 0 for num in nums[1:]: __A , __A : Tuple = ( max_...
280
1
from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar UpperCAmelCase : Union[str, Any] = TypeVar('''KEY''') UpperCAmelCase : List[Any] = TypeVar('''VAL''') @dataclass(frozen=snake_case__ , slots=snake_case_...
280
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase : Optional[int] = { '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], '''tokenizat...
280
1
import re import string import numpy as np import datasets UpperCAmelCase : int = ''' Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. ''' UpperCAmelCase : List[Any] = ''' Args...
280
def _SCREAMING_SNAKE_CASE ( a ) -> str: if number > 0: raise ValueError('input must be a negative integer' ) __A : Optional[int] = len(bin(a )[3:] ) __A : Dict = bin(abs(a ) - (1 << binary_number_length) )[3:] __A : int = ...
280
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available UpperCAmelCase : Optional[int] = { '''configuration_longt5''': ['''LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''LongT5Config''', '''LongT5OnnxConfig'''], } ...
280
import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging UpperCAmelCase : Any = logging.get_logger(__name__) def _...
280
1
import logging import os import quant_trainer import torch from torch.utils.data import DataLoader from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput UpperCAmelCase : Dict = logging.getLogger(__name__) if is_torch_tpu_available(chec...
280
def _SCREAMING_SNAKE_CASE ( a , a ) -> list[int]: __A : Optional[int] = int(a ) # Initialize Result __A : Optional[int] = [] # Traverse through all denomination for denomination in reversed(a ): # Find denominations ...
280
1
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer UpperCAmelCase : Any = logging.get_logger(__name__) UpperCAmelCase : List[Any] = {'''vocab_file'...
280
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if i...
280
1
import os import pytest from attr import dataclass UpperCAmelCase : List[Any] = '''us-east-1''' # defaults region @dataclass class _A: """simple docstring""" UpperCamelCase : str UpperCamelCase : Tuple = '''arn:aws:iam::558105141721:role/sagemaker_exec...
280
import argparse import json from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( ) -> List[Any]: __A : Tuple = argparse.ArgumentParser() # Required parameters parser.add_argument( '--src_path' , type=a , default='biencoder-nq-dev.json' ...
280
1
from __future__ import annotations from numpy import array, cos, cross, floataa, radians, sin from numpy.typing import NDArray def _SCREAMING_SNAKE_CASE ( a , a , a = False ) -> list[float]: if radian_mode: return [magnitude * cos(a ), magnitude * sin(a ...
280
from heapq import heappop, heappush import numpy as np def _SCREAMING_SNAKE_CASE ( a , a , a , a , ) -> tuple[float | int, list[tuple[int, int]]]: __A , __A : int = grid.shape __A : Any = [-1, 1, 0, 0] __A...
280
1
import math from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import SchedulerMixin, SchedulerOutput class _A( snake_case__ , snake_case__ ): """simple docstring""" ...
280
from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...uti...
280
1
import importlib import os import sys # This is required to make the module import works (when the python process is running from the root of the repo) sys.path.append('''.''') def _SCREAMING_SNAKE_CASE ( a ) -> Optional[int]: __A : Dict = test_file.split(os.path.sep ...
280
import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import version from torch import nn ...
280
1
import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, slow, ) from...
280
import colorsys from PIL import Image # type: ignore def _SCREAMING_SNAKE_CASE ( a , a , a ) -> float: __A : List[str] = x __A : str = y for step in range(a ): # noqa: B007 __A : Union[str, Any] = a * ...
280
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase : Union[str, Any] = { '''configuration_canine''': ['''CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CanineConfig'''], '''tokenizatio...
280
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a , a , a ) -> float: if days_between_payments <= 0: raise ValueError('days_between_payments must be > 0' ) if daily_interest_rate < 0: raise ValueError('daily_interest_rate must...
280
1
import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate.utils import patch_envi...
280
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCAmelCase : Any = { '''configuration_falcon''': ['''FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FalconConfig'''], } try: if not is_torch_available(...
280
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : Optional[int] = logging.get_logger(__name__) UpperCAmelCase : int = { '''google/switch-base-8''': '''https://huggingface.co/google/switch-base-8/blob/main/config.json''', } c...
280
def _SCREAMING_SNAKE_CASE ( a ) -> bool: return str(a ) == str(a )[::-1] def _SCREAMING_SNAKE_CASE ( a ) -> int: return int(a ) + int(str(a )[::-1] ) def _SCREAMING_SNAKE_CASE ( a = 1_00_00 ) -> int: __A : int = [] ...
280
1
import argparse import requests import torch from PIL import Image from torchvision.transforms import Compose, Normalize, Resize, ToTensor from transformers import SwinaSRConfig, SwinaSRForImageSuperResolution, SwinaSRImageProcessor def _SCREAMING_SNAKE_CASE ( a ) -> Tuple: __A : ...
280
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class _A: """simple docstring""" def __init__( self , _A = None ): if components is None: __A : int = [] ...
280
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCAmelCase : Optional[int] = logging.get_logger(__name__) class _A( snake_case__ , snake_case_...
280
import unittest from transformers import BertGenerationTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin UpperCAmelCase : List[str] = ...
280
1
from heapq import heappop, heappush import numpy as np def _SCREAMING_SNAKE_CASE ( a , a , a , a , ) -> tuple[float | int, list[tuple[int, int]]]: __A , __A : int = grid.shape __A : Any = [-1, 1, 0, 0] __A...
280
import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from transformers.testing_utils...
280
1
from typing import TYPE_CHECKING from ...utils import _LazyModule UpperCAmelCase : Optional[int] = {'''tokenization_wav2vec2_phoneme''': ['''Wav2Vec2PhonemeCTCTokenizer''']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: import sys U...
280
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
280
1
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space_optuna, defau...
280
import math def _SCREAMING_SNAKE_CASE ( a ) -> list[int]: __A : List[str] = [] __A : Any = 2 __A : Union[str, Any] = int(math.sqrt(a ) ) # Size of every segment __A : Any = [True] * (end + 1) __A : Lis...
280
1
def _SCREAMING_SNAKE_CASE ( a , a ) -> int: __A : int = 0 while b > 0: if b & 1: res += a a += a b >>= 1 return res def _SCREAMING_SNAKE_CASE ( a , a , a ) -> List[Any]: ...
280
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase : Any = { '''configuration_mvp''': ['''MVP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MvpConfig''', '''MvpOnnxConfig'''], '''tokenizatio...
280
1
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, resize, to_channel_...
280
def _SCREAMING_SNAKE_CASE ( a ) -> Tuple: __A , __A : Optional[Any] = [], [] while len(a ) > 1: __A , __A : Any = min(a ), max(a ) start.append(a ) end.append(a ) collection.remove(a ) collec...
280
1
from typing import Dict, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import flip_channel_order, resize, to_channel_dimension_format, to_pil_image from ...image_utils import ( ChannelDimension, ImageInpu...
280
def _SCREAMING_SNAKE_CASE ( a , a = 0 ) -> list: __A : int = length or len(a ) __A : str = False for i in range(length - 1 ): if list_data[i] > list_data[i + 1]: __A , __A : Optional[int] = list_dat...
280
1
from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets UpperCAmelCase : Any = '''\ @inproceedings{wang2019glue, title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding}, author={Wang, Alex and...
280
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a ) -> int: if not nums: return 0 __A : Optional[int] = nums[0] __A : str = 0 for num in nums[1:]: __A , __A : Tuple = ( max_...
280
1
from typing import TYPE_CHECKING from ....utils import _LazyModule UpperCAmelCase : Optional[int] = {'''tokenization_tapex''': ['''TapexTokenizer''']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys UpperCAmelCase : Dict = _LazyMo...
280
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase : Optional[int] = { '''configuration_xlm''': ['''XLM_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''XLMConfig''', '''XLMOnnxConfig'''], '''tokenizat...
280
1
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class _A( snake_case__ ): """simple docstring""" def __init__( self , _A , _A = None , _A =...
280
def _SCREAMING_SNAKE_CASE ( a ) -> str: if number > 0: raise ValueError('input must be a negative integer' ) __A : Optional[int] = len(bin(a )[3:] ) __A : Dict = bin(abs(a ) - (1 << binary_number_length) )[3:] __A : int = ...
280
1
def _SCREAMING_SNAKE_CASE ( a ) -> bool: return str(a ) == str(a )[::-1] def _SCREAMING_SNAKE_CASE ( a ) -> int: return int(a ) + int(str(a )[::-1] ) def _SCREAMING_SNAKE_CASE ( a = 1_00_00 ) -> int: __A : int = [] ...
280
import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging UpperCAmelCase : Any = logging.get_logger(__name__) def _...
280
1
import collections import inspect import unittest from transformers import SwinvaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import Config...
280
def _SCREAMING_SNAKE_CASE ( a , a ) -> list[int]: __A : Optional[int] = int(a ) # Initialize Result __A : Optional[int] = [] # Traverse through all denomination for denomination in reversed(a ): # Find denominations ...
280
1
from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def _SCREAMING_SNAKE_CASE ( a ) -> Dict: return getitem, k def _SCREAMING_SNAKE_CASE ( a , a ) -> Union[str, Any]: return setitem, ...
280
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if i...
280
1
import math def _SCREAMING_SNAKE_CASE ( ) -> None: __A : Tuple = input('Enter message: ' ) __A : List[str] = int(input(F"""Enter key [2-{len(a ) - 1}]: """ ) ) __A : Any = input('Encryption/Decryption [e/d]: ' ) if mode.low...
280
import argparse import json from tqdm import tqdm def _SCREAMING_SNAKE_CASE ( ) -> List[Any]: __A : Tuple = argparse.ArgumentParser() # Required parameters parser.add_argument( '--src_path' , type=a , default='biencoder-nq-dev.json' ...
280
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 UpperCAmelCase : Tuple = logging.get_logger(__name__) UpperCAmelCase : Union[str, ...
280
from heapq import heappop, heappush import numpy as np def _SCREAMING_SNAKE_CASE ( a , a , a , a , ) -> tuple[float | int, list[tuple[int, int]]]: __A , __A : int = grid.shape __A : Any = [-1, 1, 0, 0] __A...
280
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase : int = { '''configuration_bert''':...
280
from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...uti...
280
1