code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def _lowerCAmelCase ( _lowerCAmelCase = 3 )-> qiskit.result.counts.Counts: if isinstance(_lowerCAmelCase , _lowerCAmelCase ): ...
126
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def _lowerCAmelCase ( _lowerCAmelCase="ro" , _lowerCAmelCase="en" , _lowerCAmelCase="wmt16" , _lowerCAmelCase=None )-> None: try: import datasets except (ModuleNotFoundError, Imp...
126
1
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase )-> str: __UpperCAmelCase = [] __UpperCAmelCase = [] __UpperCAmelCase = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, '-': 1, } # Priority of each operator __UpperCAmelCase = len(_lower...
126
'''simple docstring''' import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_...
126
1
'''simple docstring''' import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..tabl...
126
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_confi...
126
1
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase = None , _lowerCAmelCase = None , _lowerCAmelCase = False , )-> tuple[int, float, str]: __UpperCAmelCase = cipher_alphabet or [chr(_lowerC...
126
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A: Optional[int] = { """configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""], } try: if not is_torch_avail...
126
1
'''simple docstring''' from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffus...
126
'''simple docstring''' import os from datetime import datetime as dt from github import Github _A: Any = [ """good first issue""", """feature request""", """wip""", ] def _lowerCAmelCase ( )-> Optional[int]: __UpperCAmelCase = Github(os.environ['GITHUB_TOKEN...
126
1
'''simple docstring''' import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) _A: str = logging.getL...
126
'''simple docstring''' from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): ...
126
1
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import...
126
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> bool: return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(_lowerCAmelCase ) ) def _lowerCAmelCase ( _lowerCAme...
126
1
'''simple docstring''' import os from datetime import datetime as dt from github import Github _A: Any = [ """good first issue""", """feature request""", """wip""", ] def _lowerCAmelCase ( )-> Optional[int]: __UpperCAmelCase = Github(os.environ['GITHUB_TOKEN...
126
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase = " " )-> list: __UpperCAmelCase = [] __UpperCAmelCase = 0 for index, char in enumerate(_lowerCAmelCase ): if char == separator: split_words.append(string[last_index:index] ) __Uppe...
126
1
'''simple docstring''' import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTRACTOR_MAPPING, AutoConfig, AutoFeatureExtractor, WavaVecaConfig, WavaVecaFeatureExtractor, ) from transform...
126
'''simple docstring''' import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, ...
126
1
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase = 10_00 )-> int: __UpperCAmelCase = 2**power __UpperCAmelCase = 0 while n: __UpperCAmelCase , __UpperCAmelCase = r + n % 10, n // 10 return r if __name__ == "__main__": print(solution(int(str(input())....
126
'''simple docstring''' from __future__ import annotations _A: Tuple = list[list[int]] # assigning initial values to the grid _A: Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0]...
126
1
'''simple docstring''' from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _A: List[str] = logging.get_logger(__name__) _A: ...
126
'''simple docstring''' import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor _A: Any = logging.get_logger(__name__) class UpperCAmelCase ( UpperCAmelCase_ ): def __init__( self , *__A , **__A ): ...
126
1
'''simple docstring''' # Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar _A: Optional[Any] = TypeVar("""T""") class UpperCAmelCase ( Ge...
126
'''simple docstring''' 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...
126
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A: List[str] = { """configuration_swinv2""": ["""SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Swinv2Config"""], } try: if not is_torch_av...
126
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase )-> bool: __UpperCAmelCase = len(_lowerCAmelCase ) # We need to create solution object to save path. __UpperCAmelCase = [[0 for _ in range(_lowerCAmelCase )] for _ in range(_lo...
126
1
'''simple docstring''' import jax.numpy as jnp from ...utils import logging from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel from .configuration_mta import MTaConfig _A: Optional[int] = logging.get_logger(__name__) _A: Union[str, An...
126
'''simple docstring''' 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 _A: List[str] = logging.get_...
126
1
'''simple docstring''' import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create simlink # import cl...
126
'''simple docstring''' import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency _A: Optional[Any] = { """E""": 12.70, """T""": 9.06, """A""": 8.17, """O""": 7.51, """I""": 6.97, """N""": 6.75, """S""": 6.33, """H""": 6.09, """R...
126
1
'''simple docstring''' import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset _A: Any = {1: (1, 1), 2: (2, 1), 3: (3, 1), 4: (2, 2), ...
126
'''simple docstring''' from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class UpperCAmelCase ( UpperCAmelCase_ ): _A : Optional[int] = CustomTokenizer pass
126
1
'''simple docstring''' import argparse import importlib from pathlib import Path # Test all the extensions added in the setup _A: Dict = [ """kernels/rwkv/wkv_cuda.cu""", """kernels/rwkv/wkv_op.cpp""", """kernels/deformable_detr/ms_deform_attn.h""", """kernels/deformable_d...
126
'''simple docstring''' import re from filelock import FileLock try: import nltk _A: Optional[int] = True except (ImportError, ModuleNotFoundError): _A: Dict = False if NLTK_AVAILABLE: with FileLock(""".lock""") as lock: nltk.download("""punkt"...
126
1
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase )-> bool: __UpperCAmelCase = len(_lowerCAmelCase ) # We need to create solution object to save path. __UpperCAmelCase = [[0 for _ in range(_lowerCAmelCase )] for _ in range(_lo...
126
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase = 10_00 )-> int: __UpperCAmelCase = 2**power __UpperCAmelCase = 0 while n: __UpperCAmelCase , __UpperCAmelCase = r + n % 10, n // 10 return r if __name__ == "__main__": print(solution(int(str(input())....
126
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=UpperCAmelCase_ ): _A : List[Any] = ["""onnx"""] def __init__( self , *__A , **__A ): requires_backends(self , ['onnx'] ) ...
126
'''simple docstring''' from typing import Any import numpy as np def _lowerCAmelCase ( _lowerCAmelCase )-> bool: return np.array_equal(_lowerCAmelCase , matrix.conjugate().T ) def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> Any: __UpperCAmel...
126
1
'''simple docstring''' import importlib.metadata from typing import Union from packaging.version import Version, parse from .constants import STR_OPERATION_TO_FUNC _A: List[Any] = parse(importlib.metadata.version("""torch""")) def _lowerCAmelCase ( _lowerCAmelCase , ...
126
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
126
1
'''simple docstring''' _A: List[str] = """0.18.2""" from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_available, is_k_diffusion_...
126
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class UpperCAmelCase ( UpperCAmelCase_ ...
126
1
'''simple docstring''' import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class UpperCAmelCase ( UpperCAmelCase_ ): ...
126
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _A: List[Any] = datasets.load_iris() _A: Union[str, Any] = np.array(data["""data"""]) _A: Union[str, Any] ...
126
1
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase )-> None: __UpperCAmelCase = generate_pascal_triangle(_lowerCAmelCase ) for row_idx in range(_lowerCAmelCase ): # Print left spaces for _ in range(num_rows - row_idx - 1 ): print(end=' ' ) # Print row values ...
126
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def _lowerCAmelCase ( _lowerCAmelCase="ro" , _lowerCAmelCase="en" , _lowerCAmelCase="wmt16" , _lowerCAmelCase=None )-> None: try: import datasets except (ModuleNotFoundError, Imp...
126
1
'''simple docstring''' from abc import ABC, abstractmethod from argparse import ArgumentParser class UpperCAmelCase ( UpperCAmelCase_ ): @staticmethod @abstractmethod def __lowerCamelCase ( __A ): raise NotImplementedError() @abstractmethod def ...
126
'''simple docstring''' import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_...
126
1
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> list[int]: __UpperCAmelCase = 0 __UpperCAmelCase = len(_lowerCAmelCase ) - 1 while i < j: if nums[i] + nums[j] == target: return [i, j] elif...
126
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_confi...
126
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _A: int = { """configuration_swiftformer""": [ """SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """SwiftFormer...
126
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A: Optional[int] = { """configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""], } try: if not is_torch_avail...
126
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor _A: str = logging.get_logger(__name__) class UpperCAmelCase ( UpperCAmelCase_ ): def __init__( self , *__A , **__A )...
126
'''simple docstring''' import os from datetime import datetime as dt from github import Github _A: Any = [ """good first issue""", """feature request""", """wip""", ] def _lowerCAmelCase ( )-> Optional[int]: __UpperCAmelCase = Github(os.environ['GITHUB_TOKEN...
126
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=UpperCAmelCase_ ): _A : Optional[Any] = ["""torch""", """scipy"""] def __init__( self , *__A , **__A ): requires_backends(self , ['to...
126
'''simple docstring''' from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): ...
126
1
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging _A: List[str] = logging.get_logger(__name__) class UpperCAmelCase ( UpperCAmelCase_ ): _A : List[Any] = """encoder-decoder""" _A : ...
126
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> bool: return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(_lowerCAmelCase ) ) def _lowerCAmelCase ( _lowerCAme...
126
1
'''simple docstring''' import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging _A: Tuple = logging.get_logger(__name__) class UpperCAmelCase ( UpperCAmelCase...
126
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase = " " )-> list: __UpperCAmelCase = [] __UpperCAmelCase = 0 for index, char in enumerate(_lowerCAmelCase ): if char == separator: split_words.append(string[last_index:index] ) __Uppe...
126
1
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> int: return x if y == 0 else greatest_common_divisor(_lowerCAmelCase , x % y ) def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> int: return (x * y) // greate...
126
'''simple docstring''' import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, ...
126
1
'''simple docstring''' from typing import Any import numpy as np def _lowerCAmelCase ( _lowerCAmelCase )-> bool: return np.array_equal(_lowerCAmelCase , matrix.conjugate().T ) def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> Any: __UpperCAmel...
126
'''simple docstring''' from __future__ import annotations _A: Tuple = list[list[int]] # assigning initial values to the grid _A: Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0]...
126
1
'''simple docstring''' import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def _lowerCAmelCase ( _lowerCAmelCase )-> int: def wrapper(*_lowerCAmelCase , **_lowerCAmelCase ): __UpperCAme...
126
'''simple docstring''' import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor _A: Any = logging.get_logger(__name__) class UpperCAmelCase ( UpperCAmelCase_ ): def __init__( self , *__A , **__A ): ...
126
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A: Dict = logging.get_logger(__name__) _A: int = { """weiweishi/roc-bert-base-zh""": """https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.js...
126
'''simple docstring''' 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...
126
1
'''simple docstring''' import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokenizers.processors...
126
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase )-> bool: __UpperCAmelCase = len(_lowerCAmelCase ) # We need to create solution object to save path. __UpperCAmelCase = [[0 for _ in range(_lowerCAmelCase )] for _ in range(_lo...
126
1
'''simple docstring''' import io import json import unittest from parameterized import parameterized from transformers import FSMTForConditionalGeneration, FSMTTokenizer from transformers.testing_utils import get_tests_dir, require_torch, slow, torch_device from utils import calculate_bleu _A: int ...
126
'''simple docstring''' 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 _A: List[str] = logging.get_...
126
1
'''simple docstring''' 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...
126
'''simple docstring''' import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency _A: Optional[Any] = { """E""": 12.70, """T""": 9.06, """A""": 8.17, """O""": 7.51, """I""": 6.97, """N""": 6.75, """S""": 6.33, """H""": 6.09, """R...
126
1
'''simple docstring''' from collections.abc import Callable class UpperCAmelCase : def __init__( self , __A = None ): # Stores actual heap items. __UpperCAmelCase = [] # Stores indexes of each item for supporting updates and deletion. __UpperCAmelCase ...
126
'''simple docstring''' from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class UpperCAmelCase ( UpperCAmelCase_ ): _A : Optional[int] = CustomTokenizer pass
126
1
'''simple docstring''' import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosity_info() _A: Opt...
126
'''simple docstring''' import re from filelock import FileLock try: import nltk _A: Optional[int] = True except (ImportError, ModuleNotFoundError): _A: Dict = False if NLTK_AVAILABLE: with FileLock(""".lock""") as lock: nltk.download("""punkt"...
126
1
'''simple docstring''' import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def _lowerCAmelCase ( _lowerCAmelCase )-> int: if "model" in orig_key: __UpperCAmelCase = orig_key.replace('model.' , '' ) if "norm1" in orig_key: __UpperCAmelCas...
126
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase = 10_00 )-> int: __UpperCAmelCase = 2**power __UpperCAmelCase = 0 while n: __UpperCAmelCase , __UpperCAmelCase = r + n % 10, n // 10 return r if __name__ == "__main__": print(solution(int(str(input())....
126
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A: Optional[int] = { """configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""], } try: if not is_torch_avail...
126
'''simple docstring''' from typing import Any import numpy as np def _lowerCAmelCase ( _lowerCAmelCase )-> bool: return np.array_equal(_lowerCAmelCase , matrix.conjugate().T ) def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> Any: __UpperCAmel...
126
1
'''simple docstring''' 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...
126
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
126
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule _A: Dict = {"""tokenization_wav2vec2_phoneme""": ["""Wav2Vec2PhonemeCTCTokenizer"""]} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: import s...
126
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class UpperCAmelCase ( UpperCAmelCase_ ...
126
1
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> dict[str, float]: if (voltage, current, resistance).count(0 ) != 1: raise ValueError('One and only one argument must be 0' ) if...
126
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _A: List[Any] = datasets.load_iris() _A: Union[str, Any] = np.array(data["""data"""]) _A: Union[str, Any] ...
126
1
'''simple docstring''' class UpperCAmelCase : def __init__( self , __A ): __UpperCAmelCase = val __UpperCAmelCase = None __UpperCAmelCase = None def __lowerCamelCase ( self , __A ): if self.val: if val < self.val: ...
126
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def _lowerCAmelCase ( _lowerCAmelCase="ro" , _lowerCAmelCase="en" , _lowerCAmelCase="wmt16" , _lowerCAmelCase=None )-> None: try: import datasets except (ModuleNotFoundError, Imp...
126
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A: int = logging.get_logger(__name__) _A: Dict = { """edbeeching/decision-transformer-gym-hopper-medium""": ( """https://huggingface.co/edbeeching/decis...
126
'''simple docstring''' import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_...
126
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) _A: List[str] = {"""configuration_beit""": ["""BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP"...
126
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_confi...
126
1
'''simple docstring''' import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup _A: Dict = { """User-Agent""": """Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36""" """ (KHTML, like Gecko) Chrome/70.0.3538.102 Safa...
126
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A: Optional[int] = { """configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""], } try: if not is_torch_avail...
126
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A: Dict = logging.get_logger(__name__) _A: Dict = { """facebook/xglm-564M""": """https://huggingface.co/facebook/xglm-564M/resolve/main/config.json""", # Se...
126
'''simple docstring''' import os from datetime import datetime as dt from github import Github _A: Any = [ """good first issue""", """feature request""", """wip""", ] def _lowerCAmelCase ( )-> Optional[int]: __UpperCAmelCase = Github(os.environ['GITHUB_TOKEN...
126
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import ...
126
'''simple docstring''' from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): ...
126
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _A: List[Any] = logging.get_logger(__name__) _A: Optional[int] = {"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/config.json"""} class Upp...
126
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> bool: return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(_lowerCAmelCase ) ) def _lowerCAmelCase ( _lowerCAme...
126
1
'''simple docstring''' import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging if is_torch...
126
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase = " " )-> list: __UpperCAmelCase = [] __UpperCAmelCase = 0 for index, char in enumerate(_lowerCAmelCase ): if char == separator: split_words.append(string[last_index:index] ) __Uppe...
126
1
'''simple docstring''' import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class UpperCAmelCase : _A : int = None def __lowerCamelCase ( self ): __UpperCAmelCase = self.feature_extracti...
126
'''simple docstring''' import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, ...
126
1
'''simple docstring''' import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data...
126
'''simple docstring''' from __future__ import annotations _A: Tuple = list[list[int]] # assigning initial values to the grid _A: Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0]...
126
1
'''simple docstring''' import numpy as np import torch from torch.utils.data import Dataset from utils import logger class UpperCAmelCase ( UpperCAmelCase_ ): def __init__( self , __A , __A ): __UpperCAmelCase = params __UpperCAmelCase = np.array(_...
126
'''simple docstring''' import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor _A: Any = logging.get_logger(__name__) class UpperCAmelCase ( UpperCAmelCase_ ): def __init__( self , *__A , **__A ): ...
126
1
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase )-> list: if len(_lowerCAmelCase ) == 0: return [] __UpperCAmelCase , __UpperCAmelCase = min(_lowerCAmelCase ), max(_lowerCAmelCase ) __UpperCAmelCase = int(max...
126
'''simple docstring''' 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...
126
1
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets _A: List[Any] = """\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns and ...
126
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase )-> bool: __UpperCAmelCase = len(_lowerCAmelCase ) # We need to create solution object to save path. __UpperCAmelCase = [[0 for _ in range(_lowerCAmelCase )] for _ in range(_lo...
126
1
'''simple docstring''' from scipy.stats import spearmanr import datasets _A: Dict = """ The Spearman rank-order correlation coefficient is a measure of the relationship between two datasets. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correla...
126
'''simple docstring''' 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 _A: List[str] = logging.get_...
126
1
'''simple docstring''' import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @...
126
'''simple docstring''' import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency _A: Optional[Any] = { """E""": 12.70, """T""": 9.06, """A""": 8.17, """O""": 7.51, """I""": 6.97, """N""": 6.75, """S""": 6.33, """H""": 6.09, """R...
126
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCAmelCase ( metaclass=UpperCAmelCase_ ): _A : Union[str, Any] = ["""speech"""] def __init__( self , *__A , **__A ): requires_backends(self , ['speech'] ...
126
'''simple docstring''' from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class UpperCAmelCase ( UpperCAmelCase_ ): _A : Optional[int] = CustomTokenizer pass
126
1
'''simple docstring''' from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils imp...
126
'''simple docstring''' import re from filelock import FileLock try: import nltk _A: Optional[int] = True except (ImportError, ModuleNotFoundError): _A: Dict = False if NLTK_AVAILABLE: with FileLock(""".lock""") as lock: nltk.download("""punkt"...
126
1
'''simple docstring''' import json import logging import os import sys from time import time from unittest.mock import patch from transformers.testing_utils import TestCasePlus, require_torch_tpu logging.basicConfig(level=logging.DEBUG) _A: Optional[int] = logging.getLogger() def...
126
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase = 10_00 )-> int: __UpperCAmelCase = 2**power __UpperCAmelCase = 0 while n: __UpperCAmelCase , __UpperCAmelCase = r + n % 10, n // 10 return r if __name__ == "__main__": print(solution(int(str(input())....
126
1
'''simple docstring''' import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset ...
126
'''simple docstring''' from typing import Any import numpy as np def _lowerCAmelCase ( _lowerCAmelCase )-> bool: return np.array_equal(_lowerCAmelCase , matrix.conjugate().T ) def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> Any: __UpperCAmel...
126
1
'''simple docstring''' from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline _A: Any = logging...
126
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
126
1
'''simple docstring''' import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger _A: Optional[int] = get_logger(__name__) _A: List[Any] = r""" Args: input_ids (...
126
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class UpperCAmelCase ( UpperCAmelCase_ ...
126
1
'''simple docstring''' import argparse import os import torch from transformers import FlavaConfig, FlavaForPreTraining from transformers.models.flava.convert_dalle_to_flava_codebook import convert_dalle_checkpoint def _lowerCAmelCase ( _lowerCAmelCase )-> str: # encoder.embeddings are doubl...
126
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _A: List[Any] = datasets.load_iris() _A: Union[str, Any] = np.array(data["""data"""]) _A: Union[str, Any] ...
126
1
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> float: __UpperCAmelCase = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series return total def _lowerCAmelCase ( ...
126
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def _lowerCAmelCase ( _lowerCAmelCase="ro" , _lowerCAmelCase="en" , _lowerCAmelCase="wmt16" , _lowerCAmelCase=None )-> None: try: import datasets except (ModuleNotFoundError, Imp...
126
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _A: Optional[int] = { """configuration_rembe...
126
'''simple docstring''' import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_...
126
1
'''simple docstring''' from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase ( UpperCAmelCase_ ): _A : Dict = ["""image_processor""", """tokenizer"""] _A : Union[str, Any] = """AutoImagePr...
126
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_confi...
126
1
'''simple docstring''' from ..utils import ( OptionalDependencyNotAvailable, is_flax_available, is_scipy_available, is_torch_available, is_torchsde_available, ) try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
126
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A: Optional[int] = { """configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""], } try: if not is_torch_avail...
126
1
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary # Register SEW's fairseq modules from sew_asapp import tasks # noqa: F401 from transformers import ( SEWConfig, SEWForCTC, SEWModel, WavaVecaCTCTokenizer, WavaVe...
126
'''simple docstring''' import os from datetime import datetime as dt from github import Github _A: Any = [ """good first issue""", """feature request""", """wip""", ] def _lowerCAmelCase ( )-> Optional[int]: __UpperCAmelCase = Github(os.environ['GITHUB_TOKEN...
126
1
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class UpperCAmelCase ( UpperCAmelCase_ ...
126
'''simple docstring''' from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): ...
126
1
'''simple docstring''' from __future__ import annotations from typing import Any class UpperCAmelCase : def __init__( self , __A , __A , __A = 0 ): __UpperCAmelCase , __UpperCAmelCase = row, column __UpperCAmelCase = [[default_value for ...
126
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> bool: return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(_lowerCAmelCase ) ) def _lowerCAmelCase ( _lowerCAme...
126
1
'''simple docstring''' from math import ceil, sqrt def _lowerCAmelCase ( _lowerCAmelCase = 1_00_00_00 )-> int: __UpperCAmelCase = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: __UpperCAmelCase = max(ceil(sqrt(outer_width**2 - lim...
126
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase = " " )-> list: __UpperCAmelCase = [] __UpperCAmelCase = 0 for index, char in enumerate(_lowerCAmelCase ): if char == separator: split_words.append(string[last_index:index] ) __Uppe...
126
1
'''simple docstring''' import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency _A: Optional[Any] = { """E""": 12.70, """T""": 9.06, """A""": 8.17, """O""": 7.51, """I""": 6.97, """N""": 6.75, """S""": 6.33, """H""": 6.09, """R...
126
'''simple docstring''' import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, ...
126
1
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase )-> int: if not nums: return 0 __UpperCAmelCase = nums[0] __UpperCAmelCase = 0 for num in nums[1:]: __UpperCAmelCase , __UpperCAmelCase = ( max_excluding + n...
126
'''simple docstring''' from __future__ import annotations _A: Tuple = list[list[int]] # assigning initial values to the grid _A: Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0]...
126
1
'''simple docstring''' from manim import * class UpperCAmelCase ( UpperCAmelCase_ ): def __lowerCamelCase ( self ): __UpperCAmelCase = Rectangle(height=0.5 , width=0.5 ) __UpperCAmelCase = Rectangle(height=0.2_5 , width=0.2_5 ) ...
126
'''simple docstring''' import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor _A: Any = logging.get_logger(__name__) class UpperCAmelCase ( UpperCAmelCase_ ): def __init__( self , *__A , **__A ): ...
126
1
'''simple docstring''' import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import T...
126
'''simple docstring''' 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...
126
1
'''simple docstring''' from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_com...
126
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase )-> bool: __UpperCAmelCase = len(_lowerCAmelCase ) # We need to create solution object to save path. __UpperCAmelCase = [[0 for _ in range(_lowerCAmelCase )] for _ in range(_lo...
126
1
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase = " " )-> list: __UpperCAmelCase = [] __UpperCAmelCase = 0 for index, char in enumerate(_lowerCAmelCase ): if char == separator: split_words.append(string[last_index:index] ) __Uppe...
126
'''simple docstring''' 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 _A: List[str] = logging.get_...
126
1
'''simple docstring''' from math import log from scipy.constants import Boltzmann, physical_constants _A: List[Any] = 300 # TEMPERATURE (unit = K) def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , )-> float: if donor_co...
126
'''simple docstring''' import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency _A: Optional[Any] = { """E""": 12.70, """T""": 9.06, """A""": 8.17, """O""": 7.51, """I""": 6.97, """N""": 6.75, """S""": 6.33, """H""": 6.09, """R...
126
1
'''simple docstring''' import unittest import numpy as np from diffusers import LMSDiscreteScheduler, OnnxStableDiffusionInpaintPipeline from diffusers.utils.testing_utils import ( is_onnx_available, load_image, nightly, require_onnxruntime, require_torch_gpu, ) from ..test_pipelines_on...
126
'''simple docstring''' from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class UpperCAmelCase ( UpperCAmelCase_ ): _A : Optional[int] = CustomTokenizer pass
126
1
'''simple docstring''' import numpy as np import qiskit def _lowerCAmelCase ( _lowerCAmelCase = 8 , _lowerCAmelCase = None )-> str: __UpperCAmelCase = np.random.default_rng(seed=_lowerCAmelCase ) # Roughly 25% of the qubits will contribute to the key. # So we take more t...
126
'''simple docstring''' import re from filelock import FileLock try: import nltk _A: Optional[int] = True except (ImportError, ModuleNotFoundError): _A: Dict = False if NLTK_AVAILABLE: with FileLock(""".lock""") as lock: nltk.download("""punkt"...
126
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_mod...
126
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase = 10_00 )-> int: __UpperCAmelCase = 2**power __UpperCAmelCase = 0 while n: __UpperCAmelCase , __UpperCAmelCase = r + n % 10, n // 10 return r if __name__ == "__main__": print(solution(int(str(input())....
126
1
'''simple docstring''' import logging import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import librosa import torch from datasets import DatasetDict, load_dataset from packaging import version from torch import nn from transformers import ( HfArgumen...
126
'''simple docstring''' from typing import Any import numpy as np def _lowerCAmelCase ( _lowerCAmelCase )-> bool: return np.array_equal(_lowerCAmelCase , matrix.conjugate().T ) def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> Any: __UpperCAmel...
126
1
'''simple docstring''' import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version _A: str = version.parse(importlib_metadata.version("""nltk""")) if NLTK_VERSION >= version.Version("""3.6.4"""): from nltk import ...
126
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
126
1
'''simple docstring''' import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename _A: Tuple = """http:...
126
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class UpperCAmelCase ( UpperCAmelCase_ ...
126
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _A: Tuple = { """configuration_canine""": ["""CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CanineConfig"""], """tok...
126
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _A: List[Any] = datasets.load_iris() _A: Union[str, Any] = np.array(data["""data"""]) _A: Union[str, Any] ...
126
1
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase = 10_00 )-> int: __UpperCAmelCase , __UpperCAmelCase = 1, 1 __UpperCAmelCase = [] for i in range(1 , n + 1 ): __UpperCAmelCase = prev_numerator + 2 * prev_denominator __UpperCAmelCase = ...
126
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def _lowerCAmelCase ( _lowerCAmelCase="ro" , _lowerCAmelCase="en" , _lowerCAmelCase="wmt16" , _lowerCAmelCase=None )-> None: try: import datasets except (ModuleNotFoundError, Imp...
126
1
'''simple docstring''' from ...processing_utils import ProcessorMixin class UpperCAmelCase ( UpperCAmelCase_ ): _A : Dict = ["""image_processor""", """feature_extractor"""] _A : Optional[int] = """TvltImageProcessor""" _A : Union[str, Any] ...
126
'''simple docstring''' import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_...
126
1
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase ( UpperCAmelCase_ ): _A : int = ["""image_processor""", """tokenizer"""] _A : Union[str, Any] = ...
126
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_confi...
126
1
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_doc...
126
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A: Optional[int] = { """configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""], } try: if not is_torch_avail...
126
1
'''simple docstring''' import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, ...
126
'''simple docstring''' import os from datetime import datetime as dt from github import Github _A: Any = [ """good first issue""", """feature request""", """wip""", ] def _lowerCAmelCase ( )-> Optional[int]: __UpperCAmelCase = Github(os.environ['GITHUB_TOKEN...
126
1
'''simple docstring''' import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , ...
126
'''simple docstring''' from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): ...
126
1
'''simple docstring''' import string def _lowerCAmelCase ( _lowerCAmelCase )-> str: __UpperCAmelCase = '' for i in sequence: __UpperCAmelCase = ord(_lowerCAmelCase ) if 65 <= extract <= 90: output += chr(1_55 - extract ) elif 97 <= extract <= 1_22: output += ch...
126
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> bool: return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(_lowerCAmelCase ) ) def _lowerCAmelCase ( _lowerCAme...
126
1
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> List[str]: global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: __UpperCAmelCase = mf_knapsack(i - 1 , _lo...
126
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase = " " )-> list: __UpperCAmelCase = [] __UpperCAmelCase = 0 for index, char in enumerate(_lowerCAmelCase ): if char == separator: split_words.append(string[last_index:index] ) __Uppe...
126
1
'''simple docstring''' from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accele...
126
'''simple docstring''' import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, ...
126
1
'''simple docstring''' from collections.abc import Callable import numpy as np def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> np.array: __UpperCAmelCase = int(np.ceil((x_end - xa) ...
126
'''simple docstring''' from __future__ import annotations _A: Tuple = list[list[int]] # assigning initial values to the grid _A: Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0]...
126
1
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline _A: List[str] = logging.get_logger(__name__) # pylint: disable=invalid-name class Upp...
126
'''simple docstring''' import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor _A: Any = logging.get_logger(__name__) class UpperCAmelCase ( UpperCAmelCase_ ): def __init__( self , *__A , **__A ): ...
126
1
'''simple docstring''' import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_...
126
'''simple docstring''' 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...
126
1