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 argparse
import os
import torch
from transformers import FlavaConfig, FlavaForPreTraining
from transformers.models.flava.convert_dalle_to_flava_codebook import convert_dalle_checkpoint
def SCREAMING_SNAKE_CASE_ ( snake_case : Any )-> str:
# encoder.emb... | 650 |
'''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 | 0 |
'''simple docstring'''
def lowerCamelCase (_SCREAMING_SNAKE_CASE : Union[str, Any] ):
__a : Optional[Any] = generate_pascal_triangle(_lowerCAmelCase )
for row_idx in range(_lowerCAmelCase ):
# Print left spaces
for _ in range(num_rows - row_idx - 1 ):
... | 476 |
'''simple docstring'''
from transformers import BertTokenizerFast
from .custom_tokenization import CustomTokenizer
class UpperCAmelCase ( UpperCAmelCase_ ):
_A : Optional[int] = CustomTokenizer
pass
| 126 | 0 |
'''simple docstring'''
from scipy.stats import spearmanr
import datasets
__lowerCAmelCase = """
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 correlation.
Pos... | 358 |
'''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 | 0 |
import json
import os
from pathlib import Path
import pytest
from datasets.download.download_config import DownloadConfig
from datasets.download.download_manager import DownloadManager
from datasets.utils.file_utils import hash_url_to_filename
__A : Tuple = """http://www.mocksite.com/fil... | 16 |
'''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 | 0 |
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 transformers.testing_utils import DUMMY_... | 439 |
'''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 | 0 |
from PIL import Image
def lowerCamelCase_ ( lowerCAmelCase__ : List[Any] , lowerCAmelCase__ : int ) -> Image:
'''simple docstring'''
A = (259 * (level + 255)) / (255 * (259 - level))
def contrast(lowerCAmelCase__ : Any ) -> int:
... | 106 |
'''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 | 0 |
"""simple docstring"""
def __A ( a_ : List[str] = 10_00 )-> int:
'''simple docstring'''
SCREAMING_SNAKE_CASE : List[str] = 2**power
SCREAMING_SNAKE_CASE : int = 0
while n:
SCREAMING_SNAKE_CASE, SCREAMING_SNAKE_CASE : Union[str, Any] = ... | 698 |
'''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 | 0 |
'''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 (
HfArgumentPa... | 120 |
'''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 | 0 |
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 accel... | 206 |
'''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 | 0 |
from typing import TYPE_CHECKING
# rely on isort to merge the imports
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
_UpperCAmelCase = {
"""configuration_informer""": [
"""INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""",
"""InformerConfig""",
]... | 699 |
'''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 | 0 |
def UpperCAmelCase__ ( __magic_name__ : str ):
'''simple docstring'''
lowerCAmelCase : List[Any] = [0] * len(_lowerCAmelCase )
lowerCAmelCase : List[Any] = []
lowerCAmelCase : Union[str, Any] = []
lowerCAmelCase : int ... | 348 |
'''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 | 0 |
"""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 sys
... | 650 |
'''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 | 0 |
'''simple docstring'''
__lowercase : 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_... | 476 |
'''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 | 0 |
'''simple docstring'''
from __future__ import annotations
def __lowerCamelCase ( lowerCAmelCase_ ) -> list:
if len(_lowerCAmelCase ) == 0:
return []
_a , _a : Optional[int] = min(_lowerCAmelCase ), max(_lowerCAmelCase )
_a : Tuple = int(max_value - min_value ... | 358 |
'''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 | 0 |
import string
def __a ( A__ : Union[str, Any] ):
SCREAMING_SNAKE_CASE = ""
for i in sequence:
SCREAMING_SNAKE_CASE = ord(_lowerCAmelCase )
if 65 <= extract <= 90:
output += chr(155 - extract )
elif 97 <... | 16 |
'''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 | 0 |
import numpy as np
import torch
from torch.utils.data import Dataset
from utils import logger
class UpperCamelCase ( UpperCAmelCase_ ):
def __init__( self : int , snake_case__ : Union[str, Any] , snake_case__ : Tuple ):
"""simple docstring"""
SCREAMIN... | 439 |
'''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 | 0 |
import multiprocessing
import os
from typing import BinaryIO, Optional, Union
import fsspec
from .. import Dataset, Features, NamedSplit, config
from ..formatting import query_table
from ..packaged_modules.json.json import Json
from ..utils import logging
from ..utils.typing import NestedDataStructureLike, PathLi... | 106 |
'''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 | 0 |
"""simple docstring"""
import numpy as np
from sklearn.datasets import fetch_california_housing
from sklearn.metrics import mean_absolute_error, mean_squared_error
from sklearn.model_selection import train_test_split
from xgboost import XGBRegressor
def __A ( a_ : int )-> tuple:
'''simple ... | 698 |
'''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 | 0 |
'''simple docstring'''
from abc import ABC, abstractmethod
from argparse import ArgumentParser
class a ( UpperCAmelCase_ ):
'''simple docstring'''
@staticmethod
@abstractmethod
def __UpperCamelCase ( lowerCamelCase_ ) -> Tuple:
raise NotImplementedError()
@a... | 120 |
'''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 | 0 |
from typing import Any
import numpy as np
def a__ (__lowercase :List[str] ) -> bool:
return np.array_equal(_lowerCAmelCase , matrix.conjugate().T )
def a__ (__lowercase :List[str] , __lowercase :Union[str, Any] ) -> Any:
_A : Any = ... | 206 |
'''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 | 0 |
import numpy as np
from nltk.translate import meteor_score
import datasets
from datasets.config import importlib_metadata, version
_UpperCAmelCase = version.parse(importlib_metadata.version("nltk"))
if NLTK_VERSION >= version.Version("3.6.4"):
from nltk import word_tokenize
_UpperCAmelCase ... | 699 |
'''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 | 0 |
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from ...tokenization_utils_base import BatchEncoding
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import PaddingStrategy, logging
from .tokenization_realm import RealmTokenizer
__SCREAMING_SNAKE_... | 348 |
'''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 | 0 |
"""simple docstring"""
from transformers import BertTokenizerFast
from .custom_tokenization import CustomTokenizer
class __a ( UpperCAmelCase_ ):
SCREAMING_SNAKE_CASE__ : Optional[int] = CustomTokenizer
pass
| 650 |
'''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 | 0 |
'''simple docstring'''
from ..utils import DummyObject, requires_backends
class __UpperCamelCase ( metaclass=UpperCAmelCase_ ):
A_ = ["""onnx"""]
def __init__( self , *__a , **__a ):
'''simple docstring'''
requires_backends(self , ... | 476 |
'''simple docstring'''
from transformers import BertTokenizerFast
from .custom_tokenization import CustomTokenizer
class UpperCAmelCase ( UpperCAmelCase_ ):
_A : Optional[int] = CustomTokenizer
pass
| 126 | 0 |
'''simple docstring'''
import pytest
from datasets.parallel import ParallelBackendConfig, parallel_backend
from datasets.utils.py_utils import map_nested
from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows
def __lowerCamelCase ( lowerCAmelCase_ ) -> Dict: # picklable fo... | 358 |
'''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 | 0 |
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 transformer... | 16 |
'''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 | 0 |
from math import factorial
def __lowerCAmelCase ( _UpperCamelCase : List[Any] = 20 ) -> int:
'''simple docstring'''
SCREAMING_SNAKE_CASE = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1,
# 2, 3,...
SCREAMING_SNAKE_CASE = n // 2
re... | 439 |
'''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 | 0 |
import collections
from typing import List, Optional, Union
from ...tokenization_utils_base import BatchEncoding
from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging
from ..bert.tokenization_bert import BertTokenizer
__snake_case :Tuple =logging.get_logger(__name__)
__... | 106 |
'''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 | 0 |
"""simple docstring"""
import argparse
import os
from pathlib import Path
import torch
from bark.generation import _load_model as _bark_load_model
from huggingface_hub import hf_hub_download
from transformers import EncodecConfig, EncodecModel, set_seed
from transformers.models.bark.configuration_bark import (... | 698 |
'''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 | 0 |
'''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, pre... | 120 |
'''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 | 0 |
import warnings
from diffusers import StableDiffusionImgaImgPipeline # noqa F401
warnings.warn(
'The `image_to_image.py` script is outdated. Please use directly `from diffusers import'
' StableDiffusionImg2ImgPipeline` instead.'
)
| 206 |
'''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 | 0 |
import os
from datetime import datetime as dt
from github import Github
_UpperCAmelCase = [
"""good first issue""",
"""feature request""",
"""wip""",
]
def __UpperCamelCase () -> Optional[int]:
A = Github(os.environ['GITHUB_TOKEN'] )
A = g.get_repo... | 699 |
'''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 | 0 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
__SCREAMING_SNAKE_CASE : Optional[int] = {
"""configuration_rembert""": ["""REMBERT... | 348 |
'''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 | 0 |
"""simple docstring"""
def SCREAMING_SNAKE_CASE_ ( snake_case : Tuple , snake_case : Optional[Any] )-> int:
while second != 0:
_lowerCamelCase = first & second
first ^= second
_lowerCamelCase = c << 1
retu... | 650 |
'''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 | 0 |
'''simple docstring'''
from __future__ import annotations
def lowerCamelCase (_SCREAMING_SNAKE_CASE : List[str] ):
if not nums:
return 0
__a : Any = nums[0]
__a : str = 0
for num in nums[1:]:
__a , __a : O... | 476 |
'''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 | 0 |
'''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)
__lowerCAmelCase = logging.getLogger()
def __lowerCamelCase ( l... | 358 |
'''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 | 0 |
import unittest
from transformers import SPIECE_UNDERLINE, XLNetTokenizer, XLNetTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow
from ...test_tokenization_common import TokenizerTesterMixin
__A : Tuple = get_tests_dir('fixtu... | 16 |
'''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 | 0 |
import random
from typing import Any
def __lowerCAmelCase ( _UpperCamelCase : Dict ) -> list[Any]:
'''simple docstring'''
for _ in range(len(_lowerCAmelCase ) ):
SCREAMING_SNAKE_CASE = random.randint(0 , len(_lowerCAmelCase ) - 1 )
SCREAMING_SNAKE... | 439 |
'''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 | 0 |
from typing import List, Optional, Union
import numpy as np
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ...utils import PaddingStrategy, TensorType, logging
__snake_case :Union[str, Any] =logging.get_logger(__na... | 106 |
'''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 | 0 |
"""simple docstring"""
import json
import os
import subprocess
import unittest
from ast import literal_eval
import pytest
from parameterized import parameterized_class
from . import is_sagemaker_available
if is_sagemaker_available():
from sagemaker import Session, TrainingJobAnalytics
from sagemake... | 698 |
'''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 | 0 |
'''simple docstring'''
from collections.abc import Callable
class a :
'''simple docstring'''
def __init__( self , lowerCamelCase_ = None ) -> Optional[int]:
# Stores actual heap items.
_a : Dict = []
# Stores indexes of each item for supporting upd... | 120 |
'''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 | 0 |
import heapq as hq
import math
from collections.abc import Iterator
class UpperCAmelCase__ :
def __init__( self ,A__ ):
_A : List[str] = str(id_ )
_A : Tuple = None
_A : Union[str, Any] = None
_A : ... | 206 |
'''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 | 0 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_torch_available,
is_vision_available,
)
_UpperCAmelCase = {
"""configuration_blip""": [
"""BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""",
"""BlipCo... | 699 |
'''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 | 0 |
def UpperCAmelCase__ ( __magic_name__ : Optional[Any] , __magic_name__ : List[str] ):
'''simple docstring'''
lowerCAmelCase : List[Any] = [1]
for i in range(2 , _lowerCAmelCase ):
factorials.append(factorials[-1] * i )
assert 0 <= k < factorial... | 348 |
'''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 | 0 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available
A_ : Dict ={"""configuration_speech_encoder_decoder""": ["""SpeechEncoderDecoderConfig"""]}
try:
if not is_torch_available():
... | 650 |
'''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 | 0 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tf_available,
is_torch_available,
is_vision_available,
)
__lowercase : str = {"""configuration_vit""": ["""VIT_PRETRAINED_CONFIG... | 476 |
'''simple docstring'''
from transformers import BertTokenizerFast
from .custom_tokenization import CustomTokenizer
class UpperCAmelCase ( UpperCAmelCase_ ):
_A : Optional[int] = CustomTokenizer
pass
| 126 | 0 |
'''simple docstring'''
import inspect
import unittest
from huggingface_hub import hf_hub_download
from transformers import ASTConfig
from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_torchaudio_avail... | 358 |
'''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 | 0 |
import os
def __a ( ):
SCREAMING_SNAKE_CASE = os.path.join(os.path.dirname(_lowerCAmelCase ) , "num.txt" )
with open(_lowerCAmelCase ) as file_hand:
return str(sum(int(_lowerCAmelCase ) for line in file_hand ) )[:10]
if _... | 16 |
'''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 | 0 |
import numpy as np
from matplotlib import pyplot as plt
from sklearn.datasets import load_iris
from sklearn.metrics import ConfusionMatrixDisplay
from sklearn.model_selection import train_test_split
from xgboost import XGBClassifier
def __lowerCAmelCase ( _UpperCamelCase : Optional[Any] ) ->... | 439 |
'''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 | 0 |
import tempfile
import torch
from diffusers import (
DEISMultistepScheduler,
DPMSolverMultistepScheduler,
DPMSolverSinglestepScheduler,
UniPCMultistepScheduler,
)
from .test_schedulers import SchedulerCommonTest
class lowerCAmelCase__ ( UpperCAmelCase_ ):
A_ : Optio... | 106 |
'''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 | 0 |
"""simple docstring"""
import warnings
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding
class lowercase__( UpperCAmelCase_ ):
'''simple docstring'''
UpperCamelCase = ["""image_processor""", """tokenizer"""]
UpperCamelCase = """ChineseCLIP... | 698 |
'''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 | 0 |
'''simple docstring'''
from __future__ import annotations
from math import pi
from typing import Protocol
import matplotlib.pyplot as plt
import numpy as np
class a ( UpperCAmelCase_ ):
'''simple docstring'''
def __UpperCamelCase ( self , lowerCamelCase_ ) -> T... | 120 |
'''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 | 0 |
from __future__ import annotations
import random
import unittest
from transformers import TransfoXLConfig, is_tf_available
from transformers.testing_utils import require_tf, slow
from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, id... | 206 |
'''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 | 0 |
from __future__ import annotations
def __UpperCamelCase (lowerCAmelCase : Tuple, lowerCAmelCase : Optional[int], lowerCAmelCase : Optional[int] ) -> dict[str, float]:
if (voltage, current, resistance).count(0 ) != 1:
raise ValueError('One and only one argumen... | 699 |
'''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 | 0 |
import json
import os
from functools import lru_cache
from typing import List, Optional, Tuple
import regex as re
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging
__SCREAMING_SNAKE_CASE : str = logging.get_logger(__name__)
__SCREAMING_SNAKE_CASE : Di... | 348 |
'''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 | 0 |
"""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_a... | 650 |
'''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 | 0 |
'''simple docstring'''
import random
import torch
from huggingface_hub import HfApi
from diffusers import UNetaDModel
__lowercase : Union[str, Any] = HfApi()
__lowercase : Any = {}
# fmt: off
__lowercase : int = torch.tensor([
-0.75_15, -1.68_83, 0.24_20, 0.03_00, 0... | 476 |
'''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 | 0 |
'''simple docstring'''
import os
# Precomputes a list of the 100 first triangular numbers
__lowerCAmelCase = [int(0.5 * n * (n + 1)) for n in range(1, 101)]
def __lowerCamelCase ( ) -> str:
_a : int = os.path.dirname(os.path.realpath(_lowerCAmelCase ) )
_a : List[Any] = ... | 358 |
'''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 | 0 |
import importlib
import torch
import yaml
from omegaconf import OmegaConf
from taming.models.vqgan import VQModel
def __a ( A__ : int , A__ : Optional[int]=False ):
SCREAMING_SNAKE_CASE = OmegaConf.load(_lowerCAmelCase )
if display:
print... | 16 |
'''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 | 0 |
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 TokenizerTesterMixin
a_ : ... | 439 |
'''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 | 0 |
from ..utils import DummyObject, requires_backends
class lowerCAmelCase__ ( metaclass=UpperCAmelCase_ ):
A_ : Union[str, Any] = ["""speech"""]
def __init__( self : List[Any] , *__UpperCamelCase : List[str] , **__UpperCamelCase : Dict ... | 106 |
'''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 | 0 |
"""simple docstring"""
import json
import os
import unittest
from transformers import DebertaTokenizer, DebertaTokenizerFast
from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES
from transformers.testing_utils import slow
from ...test_tokenization_common import TokenizerTesterMixin
... | 698 |
'''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 | 0 |
'''simple docstring'''
from __future__ import annotations
from pprint import pformat
from typing import Generic, TypeVar
UpperCAmelCase_ : Optional[Any] = TypeVar("T")
class a ( Generic[T] ):
'''simple docstring'''
def __init__( self , lowerCamelCase_ = True ... | 120 |
'''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 | 0 |
from manim import *
class UpperCAmelCase__ ( UpperCAmelCase_ ):
def A__ ( self ):
_A : str = Rectangle(height=0.5 ,width=0.5 )
_A : Optional[Any] = Rectangle(height=0.25 ,width=0.25 )
_A : ... | 206 |
'''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 | 0 |
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 TFModelTesterMixin, ids_tensor,... | 699 |
'''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 | 0 |
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)
__SCREAMING_SNAKE_CASE : str = logging.getLogger()
def U... | 348 |
'''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 | 0 |
"""simple docstring"""
def SCREAMING_SNAKE_CASE_ ( snake_case : Any , snake_case : Optional[Any] )-> bool:
_lowerCamelCase = len(_lowerCAmelCase ) + 1
_lowerCamelCase = len(_lowerCAmelCase ) + 1
# dp is a 2d matrix where dp[i][j]... | 650 |
'''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 | 0 |
'''simple docstring'''
import re
from ..utils import cached_file
# docstyle-ignore
__lowercase : int = """
Human: <<task>>
Assistant: """
__lowercase : List[Any] = """huggingface-tools/default-prompts"""
__lowercase : Optional[int] = {"""chat""": """chat_prompt_templat... | 476 |
'''simple docstring'''
from transformers import BertTokenizerFast
from .custom_tokenization import CustomTokenizer
class UpperCAmelCase ( UpperCAmelCase_ ):
_A : Optional[int] = CustomTokenizer
pass
| 126 | 0 |
'''simple docstring'''
def __lowerCamelCase ( lowerCAmelCase_ , lowerCAmelCase_ ) -> str:
if a < 0 or b < 0:
raise ValueError('the value of both inputs must be positive' )
_a : str = str(bin(_lowerCAmelCase ) )[2:] # remove the leading "0b"
_a : List[Any] = str(... | 358 |
'''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 | 0 |
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding
class _SCREAMING_SNAKE_CASE ( UpperCAmelCase_ ):
'''simple docstring'''
lowerCamelCase__ = ["""image_processor""", """tokenizer"""]
lowerCamelCase__ = ... | 16 |
'''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 | 0 |
import unittest
import numpy as np
from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available
from ...test_image_processing_common import ImageProcessingSavingTestMixin
if is_torch_available():
import torch
if is_vision_avail... | 439 |
'''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 | 0 |
def lowerCamelCase_ ( lowerCAmelCase__ : Tuple ) -> str:
'''simple docstring'''
A = []
A = []
A = {
'^': 3,
'*': 2,
'/': 2,
'%': 2,
'+': 1,
'-': 1,
... | 106 |
'''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 | 0 |
"""simple docstring"""
from collections.abc import Sequence
from queue import Queue
class lowercase__:
'''simple docstring'''
def __init__( self :Union[str, Any] , lowerCamelCase_ :Union[str, Any] , lowerCamelCase_ :Dict , lowerCamelCase_ :List[Any] , lowerCamelCase_ ... | 698 |
'''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 | 0 |
'''simple docstring'''
import argparse
import torch
from torch import nn
from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration
def UpperCAmelCase_ ( A ):
'''simple docstring'''
_a : Any = [
'encoder.version',
'decoder.version',
... | 120 |
'''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 | 0 |
from .glue import GlueDataset, GlueDataTrainingArguments
from .language_modeling import (
LineByLineTextDataset,
LineByLineWithRefDataset,
LineByLineWithSOPTextDataset,
TextDataset,
TextDatasetForNextSentencePrediction,
)
from .squad import SquadDataset, SquadDataTrainingArgume... | 206 |
'''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 | 0 |
import unittest
from transformers import EsmConfig, is_torch_available
from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pip... | 699 |
'''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 | 0 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tf_available,
is_torch_available,
)
__SCREAMING_SNAKE_CASE : Union[str, Any] = {"""configuration_unispeech""": ["""UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP""", ""... | 348 |
'''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 | 0 |
"""simple docstring"""
import qiskit
def SCREAMING_SNAKE_CASE_ ( snake_case : Tuple , snake_case : int )-> qiskit.result.counts.Counts:
_lowerCamelCase = qiskit.Aer.get_backend('aer_simulator' )
_lowerCamelCase = qiskit.QuantumCircuit(4... | 650 |
'''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 | 0 |
'''simple docstring'''
import math
import numpy as np
import qiskit
from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute
def lowerCamelCase (_SCREAMING_SNAKE_CASE : Union[str, Any] = 3 ):
if isinstance(_lowerCAmelCase , _lowerCAmelCase ):
raise TypeE... | 476 |
'''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 | 0 |
'''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
__lowerCAmelCase = logging.get_logger(__name_... | 358 |
'''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 | 0 |
'''simple docstring'''
def snake_case_ ( _lowerCAmelCase : int = 10 , _lowerCAmelCase : int = 1000 , _lowerCAmelCase : bool = True ) -> int:
assert (
isinstance(_lowerCAmelCase , _lowerCAmelCase )
and isinstance(_lowerCAmelCase , _lowerC... | 127 |
'''simple docstring'''
def snake_case_ ( _lowerCAmelCase : Any , _lowerCAmelCase : Optional[Any] , _lowerCAmelCase : Any , _lowerCAmelCase : Union[str, Any] ) -> Dict:
# Return True if there is node that has not iterated.
UpperCAmelCase : List[Any... | 127 | 1 |
'''simple docstring'''
from typing import Optional, Tuple, Union
import flax
import flax.linen as nn
import jax
import jax.numpy as jnp
from flax.core.frozen_dict import FrozenDict
from ..configuration_utils import ConfigMixin, flax_register_to_config
from ..utils import BaseOutput
from... | 127 |
'''simple docstring'''
from dataclasses import asdict, dataclass
from typing import Optional
from ...configuration_utils import PretrainedConfig
from ...utils import logging
UpperCamelCase__: int = logging.get_logger(__name__)
# TODO Update this
UpperCamelCase__: Any ... | 127 | 1 |
'''simple docstring'''
import math
from numpy import inf
from scipy.integrate import quad
def snake_case_ ( _lowerCAmelCase : float ) -> float:
if num <= 0:
raise ValueError('''math domain error''' )
return quad(_lowerCAmelCase , 0 , _lo... | 127 |
'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging
UpperCamelCase__: List[Any] = logging.get_logger(__name__)
UpperCamelCase__: str = {
"unc-nlp/lxmert-base-uncased": "https://huggingface.co/unc-nlp/lxmer... | 127 | 1 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
UpperCamelCase__: str = {
"configuration_squeezebert": [
"SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_M... | 127 |
'''simple docstring'''
import math
from numpy import inf
from scipy.integrate import quad
def snake_case_ ( _lowerCAmelCase : float ) -> float:
if num <= 0:
raise ValueError('''math domain error''' )
return quad(_lowerCAmelCase , 0 , _lo... | 127 | 1 |
'''simple docstring'''
def snake_case_ ( _lowerCAmelCase : Dict ) -> str:
UpperCAmelCase : Optional[int] = 1
UpperCAmelCase : Tuple = 2
while i * i <= n:
UpperCAmelCase : Optional[int] = 0... | 127 |
'''simple docstring'''
import json
import os
import unittest
from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast
from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers, require_torch
from transforme... | 127 | 1 |
'''simple docstring'''
def snake_case_ ( _lowerCAmelCase : int = 200 ) -> int:
UpperCAmelCase : Tuple = [1, 2, 5, 10, 20, 50, 100, 200]
UpperCAmelCase : List[Any] = [0] * (pence + 1)
UpperCAmelCase : Union[str, Any] ... | 127 |
'''simple docstring'''
from typing import Optional
import numpy as np
import torch
from torch import nn
from transformers import GPTaConfig, GPTaLMHeadModel
from transformers.modeling_utils import ModuleUtilsMixin
from ...configuration_utils import ConfigMixin, register_to_config
from ..... | 127 | 1 |
'''simple docstring'''
from __future__ import annotations
def snake_case_ ( _lowerCAmelCase : list[int] ) -> bool:
return len(set(_lowerCAmelCase ) ) == len(_lowerCAmelCase )
if __name__ == "__main__":
import doctest
doctest.testmod()
... | 127 |
'''simple docstring'''
import math
from typing import Dict, Iterable, List, Optional, Tuple, Union
import numpy as np
from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format... | 127 | 1 |
'''simple docstring'''
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 Mask... | 127 |
'''simple docstring'''
def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : str ) -> int:
if len(_lowerCAmelCase ) != len(_lowerCAmelCase ):
raise ValueError('''String lengths must match!''' )
UpperCAmelCase : List[str] ... | 127 | 1 |
'''simple docstring'''
import os
from tempfile import TemporaryDirectory
from unittest import TestCase
import pytest
from absl.testing import parameterized
from datasets import config
from datasets.arrow_reader import HF_GCP_BASE_URL
from datasets.builder import DatasetBuilder
from data... | 127 |
'''simple docstring'''
from __future__ import annotations
def snake_case_ ( _lowerCAmelCase : list[int] ) -> int:
if not nums:
return 0
UpperCAmelCase : Tuple = nums[0]
UpperCAmelCase : List[str] = 0
... | 127 | 1 |
'''simple docstring'''
from __future__ import annotations
from statistics import mean
def snake_case_ ( _lowerCAmelCase : list[int] , _lowerCAmelCase : list[int] , _lowerCAmelCase : int ) -> list[int]:
UpperCAmelCase : Optional[int] = [0] ... | 127 |
'''simple docstring'''
import re
def snake_case_ ( _lowerCAmelCase : str ) -> str:
if len(re.findall('''[ATCG]''' , _lowerCAmelCase ) ) != len(_lowerCAmelCase ):
raise ValueError('''Invalid Strand''' )
return dna.translate(dna.make... | 127 | 1 |
'''simple docstring'''
import json
import os
import unittest
from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast
from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES
from transformers.testing_utils import require_tokenizers, require_torch
from transforme... | 127 |
'''simple docstring'''
import unittest
import numpy as np
from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available
from ...test_image_processing_common import ImageProcessingSavingTestMixin
if is_torch... | 127 | 1 |
'''simple docstring'''
import functools
from typing import Any
def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : list[str] ) -> bool:
# Validation
if not isinstance(_lowerCAmelCase , _lowerCAmelCase ) or len(_lowerCAmelCase ) == 0:
... | 127 |
'''simple docstring'''
def snake_case_ ( _lowerCAmelCase : str ) -> int:
if not head:
return True
# split the list to two parts
UpperCAmelCase , UpperCAmelCase : str = head.next, head
while fast and fast.next:
... | 127 | 1 |
'''simple docstring'''
from __future__ import annotations
def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : list[str] | None = None ) -> list[list[str]]:
UpperCAmelCase : Any = word_bank or []
# create a table
UpperCAmelC... | 127 |
'''simple docstring'''
def snake_case_ ( _lowerCAmelCase : int , _lowerCAmelCase : Dict , _lowerCAmelCase : List[str] , _lowerCAmelCase : str , _lowerCAmelCase : Optional[int] , _lowerCAmelCase : List[Any] ) -> Union[str, Any]:
if index == r:
... | 127 | 1 |
'''simple docstring'''
import argparse
import json
import os
from tensorflow.core.protobuf.saved_model_pba import SavedModel
# All paths are set with the intent you should run this script from the root of the repo with the command
# python utils/check_copies.py
UpperCamelCase__: Option... | 127 |
'''simple docstring'''
import os
from bleurt import score # From: git+https://github.com/google-research/bleurt.git
import datasets
UpperCamelCase__: Any = datasets.logging.get_logger(__name__)
UpperCamelCase__: Union[str, Any] = "\\n@inproceedings{bleur... | 127 | 1 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available
UpperCamelCase__: int = {}
try:
if not is_sentencepiece_available():
raise OptionalDependencyNotAvailab... | 127 |
'''simple docstring'''
import unittest
from diffusers.pipelines.pipeline_utils import is_safetensors_compatible
class SCREAMING_SNAKE_CASE( unittest.TestCase ):
"""simple docstring"""
def A ( self : Tuple ) -> Optional[Any]:... | 127 | 1 |
'''simple docstring'''
from ...utils import (
OptionalDependencyNotAvailable,
is_flax_available,
is_torch_available,
is_transformers_available,
)
try:
if not (is_transformers_available() and is_torch_available()):
raise OptionalDependencyNotAvailable()
... | 127 |
'''simple docstring'''
import json
import os
from functools import lru_cache
from typing import List, Optional, Tuple
import regex as re
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging
UpperCamelCase__: str = logging.get_lo... | 127 | 1 |
'''simple docstring'''
import colorsys
from PIL import Image # type: ignore
def snake_case_ ( _lowerCAmelCase : float , _lowerCAmelCase : float , _lowerCAmelCase : int ) -> float:
UpperCAmelCase : Tuple = x
UpperCAmelCase : ... | 127 |
'''simple docstring'''
import argparse
import hashlib # hashlib is only used inside the Test class
import struct
class SCREAMING_SNAKE_CASE:
"""simple docstring"""
def __init__( self : List[str] , __snake_case : Any ) -> Lis... | 127 | 1 |
'''simple docstring'''
def snake_case_ ( _lowerCAmelCase : int ) -> int:
if not isinstance(_lowerCAmelCase , _lowerCAmelCase ):
raise ValueError('''multiplicative_persistence() only accepts integral values''' )
if num < 0:
raise ... | 127 |
'''simple docstring'''
def snake_case_ ( _lowerCAmelCase : int ) -> list:
UpperCAmelCase : Union[str, Any] = int(_lowerCAmelCase )
if n_element < 1:
UpperCAmelCase : int = ValueError('''a should be a positive num... | 127 | 1 |
'''simple docstring'''
import os
import warnings
from typing import List, Optional
from ...tokenization_utils_base import BatchEncoding
from ...utils import logging
from .configuration_rag import RagConfig
UpperCamelCase__: Dict = logging.get_logger(__name__)
class ... | 127 |
'''simple docstring'''
import numpy as np
from scipy.spatial.distance import cdist
from sklearn.metrics import fa_score
import datasets
UpperCamelCase__: str = "\\n @inproceedings{kakwani2020indicnlpsuite,\n title={{IndicNLPSuite: Monolingual Corpora, Evaluation Benchm... | 127 | 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... | 127 |
'''simple docstring'''
from __future__ import annotations
UpperCamelCase__: Tuple = 1.60_21E-19 # units = C
def snake_case_ ( _lowerCAmelCase : float , _lowerCAmelCase : float , _lowerCAmelCase : float , ) -> tuple[str, float]:
if (conductivity,... | 127 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.