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 |
|---|---|---|---|---|
from typing import List, Optional, Union
import numpy as np
import torch
import torchaudio.compliance.kaldi as ta_kaldi
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ...utils import PaddingStrategy, TensorType, logging
__low... | 629 |
import json
import os
from functools import lru_cache
from typing import Dict, List, Optional, Tuple, Union
import regex as re
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...tokenization_utils_base import BatchEncoding, EncodedInput
from ...utils import PaddingStrategy, logging
__lo... | 629 | 1 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
__lowerCamelCase : Optional[Any] = logging.get_logger(__name__)
__lowerCamelCase : List[str] = {
"""micros... | 629 |
from typing import Any
def A_ ( _lowerCAmelCase ) -> list[Any]:
if not input_list:
return []
UpperCamelCase : List[str] = [input_list.count(_lowerCAmelCase ) for value in input_list]
UpperCamelCase : Dict = max(_lowerCAmelCase ) # Gets the maximum count in... | 629 | 1 |
import logging
import os
from logging import (
CRITICAL, # NOQA
DEBUG, # NOQA
ERROR, # NOQA
FATAL, # NOQA
INFO, # NOQA
NOTSET, # NOQA
WARN, # NOQA
WARNING, # NOQA
)
from typing import Optional
from tqdm import auto as tqdm_lib
__lowerCamelCase : Any = {
"""... | 629 |
from random import shuffle
import tensorflow as tf
from numpy import array
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]:
UpperCamelCase : List[Any] = int(_lowerCAmelCase )
assert noofclusters < len(_lowerCAmelCase )
# Find out the dimensionality
Upper... | 629 | 1 |
from typing import TYPE_CHECKING
from ...utils import _LazyModule
__lowerCamelCase : str = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]}
if TYPE_CHECKING:
from .tokenization_byta import ByTaTokenizer
else:
import sys
__lowerCamelCase : List[str] = _LazyModule(__name__, glo... | 629 |
import os
def A_ ( ) -> Union[str, Any]:
with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f:
UpperCamelCase : Optional[Any] = [] # noqa: E741
for _ in range(20 ):
l.append([int(_lowerCAmelCase ) for x in f.readline().split()] )
UpperCamelCase : ... | 629 | 1 |
import gc
import math
import unittest
import torch
from diffusers import UNetaDModel
from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device
from diffusers.utils.testing_utils import enable_full_determinism
from .test_modeling_common import ModelTesterMixin, UNetTesterMixin
__... | 629 |
import json
import os
import tempfile
from transformers.testing_utils import check_json_file_has_correct_format
class A__ :
_UpperCAmelCase :Union[str, Any] = None
def __UpperCamelCase( self ):
'''simple docstring'''
UpperCamelCase : int ... | 629 | 1 |
from json import JSONDecodeError # Workaround for requests.exceptions.JSONDecodeError
import requests
def A_ ( _lowerCAmelCase = "isbn/0140328726" ) -> dict:
UpperCamelCase : List[Any] = olid.strip().strip("/" ) # Remove leading/trailing whitespace & slashes
if new_olid.co... | 629 |
import warnings
from ...utils import logging
from .image_processing_beit import BeitImageProcessor
__lowerCamelCase : Optional[Any] = logging.get_logger(__name__)
class A__ ( __snake_case ):
def __init__( self , *A_ , **A_ ):
'''simple docstring'''
... | 629 | 1 |
from __future__ import annotations
def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , ) -> tuple:
if (electron_conc, hole_conc, intrinsic_conc).count(0 ) != 1:
raise ValueError("You cannot supply more or less than 2 values" )
elif electron_conc < 0:
raise ValueErr... | 629 |
from __future__ import annotations
import math
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float:
UpperCamelCase : Tuple = u
for i in range(1 , _lowerCAmelCase ):
UpperCamelCase : Any = temp * (u - i)
return temp
def A_ ( ) -> ... | 629 | 1 |
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401
from coval.conll import reader, util
from coval.eval import evaluator
import datasets
__lowerCamelCase : List[str] = datasets.logging.get_logger(__name__)
__lowerCamelCase : List[Any] = """\
@InProceedings{moos... | 629 |
# 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
__lowerCamelCase : str = TypeVar("""T""")
class A__ ( Generic[T] ):
def __init__( ... | 629 | 1 |
def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> int:
if exponent == 1:
return base
if exponent % 2 == 0:
UpperCamelCase : List[Any] = _modexpt(_lowerCAmelCase , exponent // 2 , _lowerCAmelCase ) % modulo_value
return (x * x) % modulo_valu... | 629 |
from typing import List, Optional, Union
import numpy as np
import torch
import torchaudio.compliance.kaldi as ta_kaldi
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ...utils import PaddingStrategy, TensorType, logging
__low... | 629 | 1 |
import pytest
from datasets import inspect_metric, list_metrics, load_metric
@pytest.fixture
def A_ ( _lowerCAmelCase ) -> int:
monkeypatch.setattr("datasets.utils.deprecation_utils._emitted_deprecation_warnings" , set() )
@pytest.fixture
def A_ ( _lowerCAmelCase ) -> ... | 629 |
import hashlib
import unittest
from typing import Dict
import numpy as np
from transformers import (
MODEL_FOR_MASK_GENERATION_MAPPING,
TF_MODEL_FOR_MASK_GENERATION_MAPPING,
is_vision_available,
pipeline,
)
from transformers.pipelines import MaskGenerationPipeline
from transformers.testing_utils... | 629 | 1 |
from datasets.utils.patching import _PatchedModuleObj, patch_submodule
from . import _test_patching
def A_ ( ) -> Optional[Any]:
import os as original_os
from os import path as original_path
from os import rename as original_rename
from os.path import dirname as original_dirname
from os.... | 629 |
__lowerCamelCase : Any = 9.8_0_6_6_5
def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = g ) -> float:
if fluid_density <= 0:
raise ValueError("Impossible fluid density" )
if volume < 0:
raise ValueError("Impossible Object volume" )
if gravity <= 0:
raise... | 629 | 1 |
def A_ ( _lowerCAmelCase ) -> str:
if not all(char in "01" for char in bin_string ):
raise ValueError("Non-binary value was passed to the function" )
if not bin_string:
raise ValueError("Empty string was passed to the function" )
UpperCamelCase : Any = ""
while len(_lowerC... | 629 |
import numpy as np
import qiskit
def A_ ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str:
UpperCamelCase : Tuple = np.random.default_rng(seed=_lowerCAmelCase )
# Roughly 25% of the qubits will contribute to the key.
# So we take more than we need.
UpperCamelCase... | 629 | 1 |
import os
from shutil import copyfile
from typing import List, Optional, Tuple
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging
if is_sentencepiece_available():
from .tokenization_pegasus import PegasusTokenizer
else:
__lowerCamelCa... | 629 |
from typing import TYPE_CHECKING
from ...utils import _LazyModule
__lowerCamelCase : str = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]}
if TYPE_CHECKING:
from .tokenization_byta import ByTaTokenizer
else:
import sys
__lowerCamelCase : List[str] = _LazyModule(__name__, glo... | 629 | 1 |
from typing import List, Optional, Union
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__lowerCamelCase : Union[str, Any] = logging.get_logger(__name__)
__lowerCamelCase : Union[str, Any] = {
"""huggingface/informer-tourism-monthly""": (
"""ht... | 629 |
# Usage:
# ./gen-card-facebook-wmt19.py
import os
from pathlib import Path
def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> str:
UpperCamelCase : Union[str, Any] = {
"en": "Machine learning is great, isn't it?",
"ru": "Машинное обучение - эт... | 629 | 1 |
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> int:
UpperCamelCase : Any = [0 for i in range(r + 1 )]
# nc0 = 1
UpperCamelCase : int = 1
for i in range(1 , n + 1 ):
# to compute current row from previous row.
UpperCamelCase : Any = ... | 629 |
def A_ ( _lowerCAmelCase = 1000 ) -> int:
UpperCamelCase : Optional[int] = -1
UpperCamelCase : int = 0
for a in range(1 , n // 3 ):
# Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c
UpperCamelCase : Optional[Any] = (n *... | 629 | 1 |
def A_ ( _lowerCAmelCase ) -> bool:
if not isinstance(_lowerCAmelCase , _lowerCAmelCase ):
raise ValueError("Input series is not valid, valid series - [2, 4, 6]" )
if len(_lowerCAmelCase ) == 0:
raise ValueError("Input list must be a non empty list" )
if len(_lowerCAmelCase ) == 1:
r... | 629 |
def A_ ( _lowerCAmelCase ) -> bool:
UpperCamelCase : List[Any] = 0
for ch in input_str:
UpperCamelCase : Optional[Any] = ord(_lowerCAmelCase )
UpperCamelCase : Optional[Any] = pow(2 , _lowerCAmelCase )
# If we already turned on bit for ... | 629 | 1 |
from __future__ import annotations
import unittest
from transformers import EsmConfig, is_tf_available
from transformers.testing_utils import require_tf, slow
from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, floats_tensor, ids_tensor, random_atten... | 629 |
import math
import os
import unittest
from transformers import MegatronBertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
from ...test_configuration_common import Confi... | 629 | 1 |
import unittest
import numpy as np
from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available
from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs
if is_torch_available():
import t... | 629 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
__lowerCamelCase : List[Any] = {
"""configuration_chinese_clip""": [
"""CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""",
"""ChineseCLIPConfig"""... | 629 | 1 |
import argparse
import logging
import pickle
import random
import time
import numpy as np
from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer
logging.basicConfig(
format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO
)
__... | 629 |
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[int]:
UpperCamelCase : List[Any] = [1]
for i in range(2 , _lowerCAmelCase ):
factorials.append(factorials[-1] * i )
assert 0 <= k < factorials[-1] * n, "k out of bounds"
UpperCamelCase : Tuple =... | 629 | 1 |
import logging
from transformers import PretrainedConfig
__lowerCamelCase : Any = logging.getLogger(__name__)
__lowerCamelCase : Tuple = {
"""bertabs-finetuned-cnndm""": """https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstractive-summarization/resolve/main/config.jso... | 629 |
import inspect
import math
import tempfile
import unittest
import numpy as np
from transformers import ViTMAEConfig
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available
from ...test_confi... | 629 | 1 |
from __future__ import annotations
from collections.abc import Iterator
from typing import Generic, TypeVar
__lowerCamelCase : List[str] = TypeVar("""T""")
class A__ ( Generic[T] ):
def __init__( self , A_ ):
'''simple docstring'''
UpperCamelCase ... | 629 |
def A_ ( _lowerCAmelCase ) -> bool:
return str(_lowerCAmelCase ) == str(_lowerCAmelCase )[::-1]
def A_ ( _lowerCAmelCase ) -> int:
return int(_lowerCAmelCase ) + int(str(_lowerCAmelCase )[::-1] )
def A_ ( _lowerCAmelCase = 1_0000 ) -> int:
UpperCamelCase... | 629 | 1 |
# Imports
import numpy as np
class A__ :
def __init__( self , A_=None , A_=None , A_=None , A_=None , A_=None ):
'''simple docstring'''
self.set_matricies(red=A_ , green=A_ , blue=A_ , red_edge=A_ , nir=A_ )
def _... | 629 |
__lowerCamelCase : str = 6_5521
def A_ ( _lowerCAmelCase ) -> int:
UpperCamelCase : Any = 1
UpperCamelCase : str = 0
for plain_chr in plain_text:
UpperCamelCase : List[Any] = (a + ord(_lowerCAmelCase )) % MOD_ADLER
UpperCamelCase... | 629 | 1 |
from typing import List, Optional, TypeVar
from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets
from .dataset_dict import DatasetDict, IterableDatasetDict
from .info import DatasetInfo
from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _i... | 629 |
import json
import os
from functools import lru_cache
from typing import Dict, List, Optional, Tuple, Union
import regex as re
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...tokenization_utils_base import BatchEncoding, EncodedInput
from ...utils import PaddingStrategy, logging
__lo... | 629 | 1 |
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer
__lowerCamelCase : str = {"""vocab_file""": """vocab.txt""", """tokenizer_file""": """tokenizer.json... | 629 |
from typing import Any
def A_ ( _lowerCAmelCase ) -> list[Any]:
if not input_list:
return []
UpperCamelCase : List[str] = [input_list.count(_lowerCAmelCase ) for value in input_list]
UpperCamelCase : Dict = max(_lowerCAmelCase ) # Gets the maximum count in... | 629 | 1 |
import argparse
import hashlib
import os
import urllib
import warnings
import torch
from torch import nn
from tqdm import tqdm
from transformers import WhisperConfig, WhisperForConditionalGeneration
__lowerCamelCase : List[Any] = {
"""tiny.en""": """https://openaipublic.azureedge.net/main/whispe... | 629 |
from random import shuffle
import tensorflow as tf
from numpy import array
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]:
UpperCamelCase : List[Any] = int(_lowerCAmelCase )
assert noofclusters < len(_lowerCAmelCase )
# Find out the dimensionality
Upper... | 629 | 1 |
from __future__ import annotations
from typing import Any
class A__ :
def __init__( self , A_ , A_ , A_ = 0 ):
'''simple docstring'''
UpperCamelCase , UpperCamelCase : Union[str, Any] = row, column
UpperCamelCase : L... | 629 |
import os
def A_ ( ) -> Union[str, Any]:
with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f:
UpperCamelCase : Optional[Any] = [] # noqa: E741
for _ in range(20 ):
l.append([int(_lowerCAmelCase ) for x in f.readline().split()] )
UpperCamelCase : ... | 629 | 1 |
from typing import Dict, List
from nltk.translate import gleu_score
import datasets
from datasets import MetricInfo
__lowerCamelCase : List[Any] = """\
@misc{wu2016googles,
title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},
author=... | 629 |
import json
import os
import tempfile
from transformers.testing_utils import check_json_file_has_correct_format
class A__ :
_UpperCAmelCase :Union[str, Any] = None
def __UpperCamelCase( self ):
'''simple docstring'''
UpperCamelCase : int ... | 629 | 1 |
import numpy as np
import torch
from torch.utils.data import Dataset
from utils import logger
class A__ ( __snake_case ):
def __init__( self , A_ , A_ ):
'''simple docstring'''
UpperCamelCase : Optional[int] = params
UpperCamelCase ... | 629 |
import warnings
from ...utils import logging
from .image_processing_beit import BeitImageProcessor
__lowerCamelCase : Optional[Any] = logging.get_logger(__name__)
class A__ ( __snake_case ):
def __init__( self , *A_ , **A_ ):
'''simple docstring'''
... | 629 | 1 |
from graphs.minimum_spanning_tree_kruskal import kruskal
def A_ ( ) -> str:
UpperCamelCase : Tuple = 9
UpperCamelCase : Any = [
[0, 1, 4],
[0, 7, 8],
[1, 2, 8],
[7, 8, 7],
[7, 6, 1],
[2, 8, 2],
[8, 6, 6],
[2, 3, 7],
... | 629 |
from __future__ import annotations
import math
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float:
UpperCamelCase : Tuple = u
for i in range(1 , _lowerCAmelCase ):
UpperCamelCase : Any = temp * (u - i)
return temp
def A_ ( ) -> ... | 629 | 1 |
import time
from dataclasses import dataclass
from multiprocessing import Pool
from unittest import TestCase
from unittest.mock import patch
import multiprocess
import numpy as np
import pytest
from datasets.utils.py_utils import (
NestedDataStructure,
asdict,
iflatmap_unordered,
map_nested,
... | 629 |
# 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
__lowerCamelCase : str = TypeVar("""T""")
class A__ ( Generic[T] ):
def __init__( ... | 629 | 1 |
from __future__ import annotations
from typing import TypedDict
class A__ ( __snake_case ):
_UpperCAmelCase :str
_UpperCAmelCase :int
def A_ ( _lowerCAmelCase ) -> list[str]:
if not isinstance(_lowerCAmelCase , _lowerCAmelCase ):
raise TypeError("The ... | 629 |
from typing import List, Optional, Union
import numpy as np
import torch
import torchaudio.compliance.kaldi as ta_kaldi
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ...utils import PaddingStrategy, TensorType, logging
__low... | 629 | 1 |
from ..utils import DummyObject, requires_backends
class A__ ( metaclass=__snake_case ):
_UpperCAmelCase :List[Any] = ['speech']
def __init__( self , *A_ , **A_ ):
'''simple docstring'''
requires_backends(self , ["speech"] )
cla... | 629 |
import hashlib
import unittest
from typing import Dict
import numpy as np
from transformers import (
MODEL_FOR_MASK_GENERATION_MAPPING,
TF_MODEL_FOR_MASK_GENERATION_MAPPING,
is_vision_available,
pipeline,
)
from transformers.pipelines import MaskGenerationPipeline
from transformers.testing_utils... | 629 | 1 |
import tempfile
import torch
from diffusers import (
DEISMultistepScheduler,
DPMSolverMultistepScheduler,
DPMSolverSinglestepScheduler,
UniPCMultistepScheduler,
)
from .test_schedulers import SchedulerCommonTest
class A__ ( __snake_case ):
_UpperCAmelCase :Union[str, Any... | 629 |
__lowerCamelCase : Any = 9.8_0_6_6_5
def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = g ) -> float:
if fluid_density <= 0:
raise ValueError("Impossible fluid density" )
if volume < 0:
raise ValueError("Impossible Object volume" )
if gravity <= 0:
raise... | 629 | 1 |
# 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
__lowerCamelCase : str = TypeVar("""T""")
class A__ ( Generic[T] ):
def __init__( ... | 629 |
import numpy as np
import qiskit
def A_ ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str:
UpperCamelCase : Tuple = np.random.default_rng(seed=_lowerCAmelCase )
# Roughly 25% of the qubits will contribute to the key.
# So we take more than we need.
UpperCamelCase... | 629 | 1 |
class A__ :
def __init__( self ):
'''simple docstring'''
UpperCamelCase : dict[str, TrieNode] = {} # Mapping from char to TrieNode
UpperCamelCase : Tuple = False
def __UpperCamelCase( self , A_ ):
'''simpl... | 629 |
from typing import TYPE_CHECKING
from ...utils import _LazyModule
__lowerCamelCase : str = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]}
if TYPE_CHECKING:
from .tokenization_byta import ByTaTokenizer
else:
import sys
__lowerCamelCase : List[str] = _LazyModule(__name__, glo... | 629 | 1 |
from __future__ import annotations
from typing import Dict
from ...configuration_utils import PretrainedConfig
__lowerCamelCase : Any = {
"""susnato/ernie-m-base_pytorch""": """https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json""",
"""susnato/ernie-m-large_pytorch""": ... | 629 |
# Usage:
# ./gen-card-facebook-wmt19.py
import os
from pathlib import Path
def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> str:
UpperCamelCase : Union[str, Any] = {
"en": "Machine learning is great, isn't it?",
"ru": "Машинное обучение - эт... | 629 | 1 |
import datetime
import platform
import subprocess
from typing import Optional, Tuple, Union
import numpy as np
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> np.array:
UpperCamelCase : Union[str, Any] = F"""{sampling_rate}"""
UpperCamelCase : List[Any] = ... | 629 |
def A_ ( _lowerCAmelCase = 1000 ) -> int:
UpperCamelCase : Optional[int] = -1
UpperCamelCase : int = 0
for a in range(1 , n // 3 ):
# Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c
UpperCamelCase : Optional[Any] = (n *... | 629 | 1 |
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 (
center_crop,
get... | 629 |
def A_ ( _lowerCAmelCase ) -> bool:
UpperCamelCase : List[Any] = 0
for ch in input_str:
UpperCamelCase : Optional[Any] = ord(_lowerCAmelCase )
UpperCamelCase : Optional[Any] = pow(2 , _lowerCAmelCase )
# If we already turned on bit for ... | 629 | 1 |
import gc
import unittest
from transformers import CTRLConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device
from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTes... | 629 |
import math
import os
import unittest
from transformers import MegatronBertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
from ...test_configuration_common import Confi... | 629 | 1 |
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_squeezebert import SqueezeBertTokenizer
__lowerCamelCase : Dict = logging.get_logger(__name__)
__low... | 629 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
__lowerCamelCase : List[Any] = {
"""configuration_chinese_clip""": [
"""CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""",
"""ChineseCLIPConfig"""... | 629 | 1 |
import inspect
import math
import tempfile
import unittest
import numpy as np
from transformers import ViTMAEConfig
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available
from ...test_confi... | 629 |
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[int]:
UpperCamelCase : List[Any] = [1]
for i in range(2 , _lowerCAmelCase ):
factorials.append(factorials[-1] * i )
assert 0 <= k < factorials[-1] * n, "k out of bounds"
UpperCamelCase : Tuple =... | 629 | 1 |
import os
from typing import Optional
import fsspec
from fsspec.archive import AbstractArchiveFileSystem
from fsspec.utils import DEFAULT_BLOCK_SIZE
class A__ ( __snake_case ):
_UpperCAmelCase :Dict = ''
_UpperCAmelCase :str = (
None # protocol pass... | 629 |
import inspect
import math
import tempfile
import unittest
import numpy as np
from transformers import ViTMAEConfig
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available
from ...test_confi... | 629 | 1 |
import unittest
from transformers import BertGenerationConfig, is_torch_available
from transformers.testing_utils import require_torch, slow, torch_device
from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTes... | 629 |
def A_ ( _lowerCAmelCase ) -> bool:
return str(_lowerCAmelCase ) == str(_lowerCAmelCase )[::-1]
def A_ ( _lowerCAmelCase ) -> int:
return int(_lowerCAmelCase ) + int(str(_lowerCAmelCase )[::-1] )
def A_ ( _lowerCAmelCase = 1_0000 ) -> int:
UpperCamelCase... | 629 | 1 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__lowerCamelCase : str = logging.get_logger(__name__)
__lowerCamelCase : Any = {
"""google/switch-base-8""": """https://huggingface.co/google/switch-base-8/blob/main/config.json""",
}
class A__ ( _... | 629 |
__lowerCamelCase : str = 6_5521
def A_ ( _lowerCAmelCase ) -> int:
UpperCamelCase : Any = 1
UpperCamelCase : str = 0
for plain_chr in plain_text:
UpperCamelCase : List[Any] = (a + ord(_lowerCAmelCase )) % MOD_ADLER
UpperCamelCase... | 629 | 1 |
from __future__ import annotations
from decimal import Decimal
from numpy import array
def A_ ( _lowerCAmelCase ) -> list[list[float]]:
UpperCamelCase : List[str] = Decimal
# Check if the provided matrix has 2 rows and 2 columns
# since this implementation only works for ... | 629 |
import json
import os
from functools import lru_cache
from typing import Dict, List, Optional, Tuple, Union
import regex as re
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...tokenization_utils_base import BatchEncoding, EncodedInput
from ...utils import PaddingStrategy, logging
__lo... | 629 | 1 |
from typing import Any, Dict, Optional
import torch
import torch.nn.functional as F
from torch import nn
from ..utils import maybe_allow_in_graph
from .activations import get_activation
from .attention_processor import Attention
from .embeddings import CombinedTimestepLabelEmbeddings
@maybe_allow_in_graph
cl... | 629 |
from typing import Any
def A_ ( _lowerCAmelCase ) -> list[Any]:
if not input_list:
return []
UpperCamelCase : List[str] = [input_list.count(_lowerCAmelCase ) for value in input_list]
UpperCamelCase : Dict = max(_lowerCAmelCase ) # Gets the maximum count in... | 629 | 1 |
import random
class A__ :
@staticmethod
def __UpperCamelCase( A_ ):
'''simple docstring'''
UpperCamelCase : Dict = [ord(A_ ) for i in text]
UpperCamelCase : Union[str, Any] = []
UpperCamelCase : List[str] ... | 629 |
from random import shuffle
import tensorflow as tf
from numpy import array
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]:
UpperCamelCase : List[Any] = int(_lowerCAmelCase )
assert noofclusters < len(_lowerCAmelCase )
# Find out the dimensionality
Upper... | 629 | 1 |
import argparse
import torch
from transformers import LxmertConfig, LxmertForPreTraining, load_tf_weights_in_lxmert
from transformers.utils import logging
logging.set_verbosity_info()
def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> Tuple:
# Initialise PyTorch mod... | 629 |
import os
def A_ ( ) -> Union[str, Any]:
with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f:
UpperCamelCase : Optional[Any] = [] # noqa: E741
for _ in range(20 ):
l.append([int(_lowerCAmelCase ) for x in f.readline().split()] )
UpperCamelCase : ... | 629 | 1 |
import PIL.Image
import PIL.ImageOps
from packaging import version
from PIL import Image
if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("""9.1.0"""):
__lowerCamelCase : Dict = {
"""linear""": PIL.Image.Resampling.BILINEAR,
"""bilinear""": PIL.Image.R... | 629 |
import json
import os
import tempfile
from transformers.testing_utils import check_json_file_has_correct_format
class A__ :
_UpperCAmelCase :Union[str, Any] = None
def __UpperCamelCase( self ):
'''simple docstring'''
UpperCamelCase : int ... | 629 | 1 |
import json
import os
import tempfile
from transformers.testing_utils import check_json_file_has_correct_format
class A__ :
_UpperCAmelCase :Union[str, Any] = None
def __UpperCamelCase( self ):
'''simple docstring'''
UpperCamelCase : int ... | 629 |
import warnings
from ...utils import logging
from .image_processing_beit import BeitImageProcessor
__lowerCamelCase : Optional[Any] = logging.get_logger(__name__)
class A__ ( __snake_case ):
def __init__( self , *A_ , **A_ ):
'''simple docstring'''
... | 629 | 1 |
import numpy as np
import qiskit
def A_ ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str:
UpperCamelCase : Tuple = np.random.default_rng(seed=_lowerCAmelCase )
# Roughly 25% of the qubits will contribute to the key.
# So we take more than we need.
UpperCamelCase... | 629 |
from __future__ import annotations
import math
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float:
UpperCamelCase : Tuple = u
for i in range(1 , _lowerCAmelCase ):
UpperCamelCase : Any = temp * (u - i)
return temp
def A_ ( ) -> ... | 629 | 1 |
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
__lowerCamelCase : Union[str, Any] = logging.get_logge... | 629 |
# 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
__lowerCamelCase : str = TypeVar("""T""")
class A__ ( Generic[T] ):
def __init__( ... | 629 | 1 |
from collections import Counter
import numpy as np
from sklearn import datasets
from sklearn.model_selection import train_test_split
__lowerCamelCase : Union[str, Any] = datasets.load_iris()
__lowerCamelCase : int = np.array(data["""data"""])
__lowerCamelCase : Any = np.array(data... | 629 |
from typing import List, Optional, Union
import numpy as np
import torch
import torchaudio.compliance.kaldi as ta_kaldi
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ...utils import PaddingStrategy, TensorType, logging
__low... | 629 | 1 |
import json
import sys
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> str:
with open(_lowerCAmelCase , encoding="utf-8" ) as f:
UpperCamelCase : Any = json.load(_lowerCAmelCase )
UpperCamelCase : Dict = ["<details>", "<summary>Show updated benchmar... | 629 |
import hashlib
import unittest
from typing import Dict
import numpy as np
from transformers import (
MODEL_FOR_MASK_GENERATION_MAPPING,
TF_MODEL_FOR_MASK_GENERATION_MAPPING,
is_vision_available,
pipeline,
)
from transformers.pipelines import MaskGenerationPipeline
from transformers.testing_utils... | 629 | 1 |
from ..utils import DummyObject, requires_backends
class A__ ( metaclass=__snake_case ):
_UpperCAmelCase :Optional[int] = ['sentencepiece']
def __init__( self , *A_ , **A_ ):
'''simple docstring'''
requires_backends(self , ["sentenc... | 629 |
__lowerCamelCase : Any = 9.8_0_6_6_5
def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = g ) -> float:
if fluid_density <= 0:
raise ValueError("Impossible fluid density" )
if volume < 0:
raise ValueError("Impossible Object volume" )
if gravity <= 0:
raise... | 629 | 1 |
from __future__ import annotations
from cmath import sqrt
def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> tuple[complex, complex]:
if a == 0:
raise ValueError("Coefficient 'a' must not be zero." )
UpperCamelCase : Union[str, Any] = b * b - 4 * a ... | 629 |
import numpy as np
import qiskit
def A_ ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str:
UpperCamelCase : Tuple = np.random.default_rng(seed=_lowerCAmelCase )
# Roughly 25% of the qubits will contribute to the key.
# So we take more than we need.
UpperCamelCase... | 629 | 1 |
def A_ ( _lowerCAmelCase ) -> bool:
if num < 0:
return False
UpperCamelCase : int = num
UpperCamelCase : int = 0
while num > 0:
UpperCamelCase : Dict = rev_num * 10 + (num % 10)
num //= 10
return num_copy == rev_num
if __name__ == "__... | 629 |
from typing import TYPE_CHECKING
from ...utils import _LazyModule
__lowerCamelCase : str = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]}
if TYPE_CHECKING:
from .tokenization_byta import ByTaTokenizer
else:
import sys
__lowerCamelCase : List[str] = _LazyModule(__name__, glo... | 629 | 1 |
from collections import OrderedDict
from typing import Mapping
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
__lowerCamelCase : Optional[Any] = logging.get_logger(__name__)
__lowerCamelCase : List[Any] = {
"""facebook/xl... | 629 |
# Usage:
# ./gen-card-facebook-wmt19.py
import os
from pathlib import Path
def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> str:
UpperCamelCase : Union[str, Any] = {
"en": "Machine learning is great, isn't it?",
"ru": "Машинное обучение - эт... | 629 | 1 |
from typing import Callable, List, Optional, Union
import PIL
import torch
from transformers import (
CLIPImageProcessor,
CLIPSegForImageSegmentation,
CLIPSegProcessor,
CLIPTextModel,
CLIPTokenizer,
)
from diffusers import DiffusionPipeline
from diffusers.configuration_utils import FrozenDic... | 629 |
def A_ ( _lowerCAmelCase = 1000 ) -> int:
UpperCamelCase : Optional[int] = -1
UpperCamelCase : int = 0
for a in range(1 , n // 3 ):
# Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c
UpperCamelCase : Optional[Any] = (n *... | 629 | 1 |
def A_ ( _lowerCAmelCase ) -> str:
return " ".join(
"".join(word[::-1] ) if len(_lowerCAmelCase ) > 4 else word for word in sentence.split() )
if __name__ == "__main__":
import doctest
doctest.testmod()
print(reverse_long_words("""Hey wollef sroirraw"""))
| 629 |
def A_ ( _lowerCAmelCase ) -> bool:
UpperCamelCase : List[Any] = 0
for ch in input_str:
UpperCamelCase : Optional[Any] = ord(_lowerCAmelCase )
UpperCamelCase : Optional[Any] = pow(2 , _lowerCAmelCase )
# If we already turned on bit for ... | 629 | 1 |
import flax.linen as nn
import jax
import jax.numpy as jnp
class A__ ( nn.Module ):
_UpperCAmelCase :int
_UpperCAmelCase :jnp.dtype = jnp.floataa
def __UpperCamelCase( self ):
'''simple docstring'''
UpperCamelCase : Optional[i... | 629 |
import math
import os
import unittest
from transformers import MegatronBertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
from ...test_configuration_common import Confi... | 629 | 1 |
import argparse
import re
from pathlib import Path
import requests
import torch
from PIL import Image
from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor
from transformers import (
EfficientFormerConfig,
EfficientFormerForImageClassificationWithTeacher,
EfficientForme... | 629 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
__lowerCamelCase : List[Any] = {
"""configuration_chinese_clip""": [
"""CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""",
"""ChineseCLIPConfig"""... | 629 | 1 |
import tempfile
import unittest
from make_student import create_student_by_copying_alternating_layers
from transformers import AutoConfig
from transformers.file_utils import cached_property
from transformers.testing_utils import require_torch
__lowerCamelCase : Any = """sshleifer/bart-tiny-random"""... | 629 |
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[int]:
UpperCamelCase : List[Any] = [1]
for i in range(2 , _lowerCAmelCase ):
factorials.append(factorials[-1] * i )
assert 0 <= k < factorials[-1] * n, "k out of bounds"
UpperCamelCase : Tuple =... | 629 | 1 |
import warnings
from ...utils import logging
from .image_processing_beit import BeitImageProcessor
__lowerCamelCase : Optional[Any] = logging.get_logger(__name__)
class A__ ( __snake_case ):
def __init__( self , *A_ , **A_ ):
'''simple docstring'''
... | 629 |
import inspect
import math
import tempfile
import unittest
import numpy as np
from transformers import ViTMAEConfig
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available
from ...test_confi... | 629 | 1 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tensorflow_text_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
__lowerCamelCase : int = {
"""configuration_bert""": ["... | 629 |
def A_ ( _lowerCAmelCase ) -> bool:
return str(_lowerCAmelCase ) == str(_lowerCAmelCase )[::-1]
def A_ ( _lowerCAmelCase ) -> int:
return int(_lowerCAmelCase ) + int(str(_lowerCAmelCase )[::-1] )
def A_ ( _lowerCAmelCase = 1_0000 ) -> int:
UpperCamelCase... | 629 | 1 |
from __future__ import annotations
import copy
import inspect
import json
import math
import os
import tempfile
import unittest
from importlib import import_module
import numpy as np
from transformers import ViTMAEConfig
from transformers.file_utils import cached_property, is_tf_available, is_vision_available
... | 629 |
__lowerCamelCase : str = 6_5521
def A_ ( _lowerCAmelCase ) -> int:
UpperCamelCase : Any = 1
UpperCamelCase : str = 0
for plain_chr in plain_text:
UpperCamelCase : List[Any] = (a + ord(_lowerCAmelCase )) % MOD_ADLER
UpperCamelCase... | 629 | 1 |
import math
import os
import unittest
from transformers import MegatronBertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
from ...test_configuration_common import Confi... | 629 |
import json
import os
from functools import lru_cache
from typing import Dict, List, Optional, Tuple, Union
import regex as re
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...tokenization_utils_base import BatchEncoding, EncodedInput
from ...utils import PaddingStrategy, logging
__lo... | 629 | 1 |
import hashlib
import unittest
from typing import Dict
import numpy as np
from transformers import (
MODEL_FOR_MASK_GENERATION_MAPPING,
TF_MODEL_FOR_MASK_GENERATION_MAPPING,
is_vision_available,
pipeline,
)
from transformers.pipelines import MaskGenerationPipeline
from transformers.testing_utils... | 629 |
from typing import Any
def A_ ( _lowerCAmelCase ) -> list[Any]:
if not input_list:
return []
UpperCamelCase : List[str] = [input_list.count(_lowerCAmelCase ) for value in input_list]
UpperCamelCase : Dict = max(_lowerCAmelCase ) # Gets the maximum count in... | 629 | 1 |
__lowerCamelCase : str = """Input must be a string of 8 numbers plus letter"""
__lowerCamelCase : Optional[Any] = """TRWAGMYFPDXBNJZSQVHLCKE"""
def A_ ( _lowerCAmelCase ) -> bool:
if not isinstance(_lowerCAmelCase , _lowerCAmelCase ):
UpperCamelCase : Union[s... | 629 |
from random import shuffle
import tensorflow as tf
from numpy import array
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]:
UpperCamelCase : List[Any] = int(_lowerCAmelCase )
assert noofclusters < len(_lowerCAmelCase )
# Find out the dimensionality
Upper... | 629 | 1 |
import re
import string
import numpy as np
import datasets
__lowerCamelCase : Optional[Any] = """
Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list.
"""
__lowerCamelCase : List[Any] = """
... | 629 |
import os
def A_ ( ) -> Union[str, Any]:
with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f:
UpperCamelCase : Optional[Any] = [] # noqa: E741
for _ in range(20 ):
l.append([int(_lowerCAmelCase ) for x in f.readline().split()] )
UpperCamelCase : ... | 629 | 1 |
import inspect
import os
import unittest
from dataclasses import dataclass
import torch
from accelerate import Accelerator, DistributedDataParallelKwargs, GradScalerKwargs
from accelerate.state import AcceleratorState
from accelerate.test_utils import execute_subprocess_async, require_cuda, require_multi_gpu
fr... | 629 |
import json
import os
import tempfile
from transformers.testing_utils import check_json_file_has_correct_format
class A__ :
_UpperCAmelCase :Union[str, Any] = None
def __UpperCamelCase( self ):
'''simple docstring'''
UpperCamelCase : int ... | 629 | 1 |
from dataclasses import dataclass, field
from typing import Optional
@dataclass
class A__ :
_UpperCAmelCase :Optional[str] = field(
default='codeparrot/codeparrot' , metadata={'help': 'Model name or path of model to be trained.'} )
_UpperCAmelCase :Optional[s... | 629 |
import warnings
from ...utils import logging
from .image_processing_beit import BeitImageProcessor
__lowerCamelCase : Optional[Any] = logging.get_logger(__name__)
class A__ ( __snake_case ):
def __init__( self , *A_ , **A_ ):
'''simple docstring'''
... | 629 | 1 |
# Lint as: python3
# pylint: enable=line-too-long
# pylint: disable=g-import-not-at-top,g-bad-import-order,wrong-import-position
__lowerCamelCase : int = """2.13.1"""
import platform
import pyarrow
from packaging import version
if version.parse(platform.python_version()) < version.parse("""3.7"""):... | 629 |
from __future__ import annotations
import math
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float:
UpperCamelCase : Tuple = u
for i in range(1 , _lowerCAmelCase ):
UpperCamelCase : Any = temp * (u - i)
return temp
def A_ ( ) -> ... | 629 | 1 |
import argparse
import json
from collections import OrderedDict
from pathlib import Path
import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from transformers import (
SegformerConfig,
SegformerForImageClassification,
SegformerForSemanticSegmentation,
S... | 629 |
# 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
__lowerCamelCase : str = TypeVar("""T""")
class A__ ( Generic[T] ):
def __init__( ... | 629 | 1 |
import unittest
from transformers import MobileBertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_mod... | 629 |
from typing import List, Optional, Union
import numpy as np
import torch
import torchaudio.compliance.kaldi as ta_kaldi
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ...utils import PaddingStrategy, TensorType, logging
__low... | 629 | 1 |
import math
from dataclasses import dataclass
from typing import Optional, Tuple, Union
import numpy as np
import torch
from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import BaseOutput, randn_tensor
from .scheduling_utils import SchedulerMixin
@dataclass
# Copied from diffuser... | 629 |
import hashlib
import unittest
from typing import Dict
import numpy as np
from transformers import (
MODEL_FOR_MASK_GENERATION_MAPPING,
TF_MODEL_FOR_MASK_GENERATION_MAPPING,
is_vision_available,
pipeline,
)
from transformers.pipelines import MaskGenerationPipeline
from transformers.testing_utils... | 629 | 1 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
__lowerCamelCase : List[Any] = {"""configuration_opt""": ["""OPT_PRETRAINED_CONFIG_ARCHIVE_MA... | 629 |
__lowerCamelCase : Any = 9.8_0_6_6_5
def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = g ) -> float:
if fluid_density <= 0:
raise ValueError("Impossible fluid density" )
if volume < 0:
raise ValueError("Impossible Object volume" )
if gravity <= 0:
raise... | 629 | 1 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
)
__lowerCamelCase : int = {
"""configuration_roberta""": ["""ROBERTA_PRETRAINED_CONFIG_ARC... | 629 |
import numpy as np
import qiskit
def A_ ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str:
UpperCamelCase : Tuple = np.random.default_rng(seed=_lowerCAmelCase )
# Roughly 25% of the qubits will contribute to the key.
# So we take more than we need.
UpperCamelCase... | 629 | 1 |
import inspect
import re
from hashlib import shaaaa
from typing import Dict, List
from .arrow import arrow
from .audiofolder import audiofolder
from .csv import csv
from .imagefolder import imagefolder
from .json import json
from .pandas import pandas
from .parquet import parquet
from .sql import sql # noqa F40... | 629 |
from typing import TYPE_CHECKING
from ...utils import _LazyModule
__lowerCamelCase : str = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]}
if TYPE_CHECKING:
from .tokenization_byta import ByTaTokenizer
else:
import sys
__lowerCamelCase : List[str] = _LazyModule(__name__, glo... | 629 | 1 |
import unittest
from transformers import load_tool
from .test_tools_common import ToolTesterMixin
__lowerCamelCase : List[Any] = """
Hugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot app target... | 629 |
# Usage:
# ./gen-card-facebook-wmt19.py
import os
from pathlib import Path
def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> str:
UpperCamelCase : Union[str, Any] = {
"en": "Machine learning is great, isn't it?",
"ru": "Машинное обучение - эт... | 629 | 1 |
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
if TYPE_CHECKING:
from ... import FeatureExtractionMixin, TensorType
__lowerCamelCase : Optional[in... | 629 |
def A_ ( _lowerCAmelCase = 1000 ) -> int:
UpperCamelCase : Optional[int] = -1
UpperCamelCase : int = 0
for a in range(1 , n // 3 ):
# Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c
UpperCamelCase : Optional[Any] = (n *... | 629 | 1 |
# limitations under the License.
# NOTE: This file is deprecated and will be removed in a future version.
# It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works
from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401
from .utils import deprecate
depr... | 629 |
def A_ ( _lowerCAmelCase ) -> bool:
UpperCamelCase : List[Any] = 0
for ch in input_str:
UpperCamelCase : Optional[Any] = ord(_lowerCAmelCase )
UpperCamelCase : Optional[Any] = pow(2 , _lowerCAmelCase )
# If we already turned on bit for ... | 629 | 1 |
def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> int:
if index == number_of_items:
return 0
UpperCamelCase : int = 0
UpperCamelCase : Dict = 0
UpperCamelCase : str = knapsack... | 629 |
import math
import os
import unittest
from transformers import MegatronBertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device
from ...test_configuration_common import Confi... | 629 | 1 |
import subprocess
import sys
from transformers import BertConfig, BertModel, BertTokenizer, pipeline
from transformers.testing_utils import TestCasePlus, require_torch
class A__ ( __snake_case ):
@require_torch
def __UpperCamelCase( self ):
'''simple docstring'''
... | 629 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
__lowerCamelCase : List[Any] = {
"""configuration_chinese_clip""": [
"""CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""",
"""ChineseCLIPConfig"""... | 629 | 1 |
def A_ ( _lowerCAmelCase = 1000 ) -> int:
UpperCamelCase : Optional[int] = -1
UpperCamelCase : int = 0
for a in range(1 , n // 3 ):
# Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c
UpperCamelCase : Optional[Any] = (n *... | 629 |
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[int]:
UpperCamelCase : List[Any] = [1]
for i in range(2 , _lowerCAmelCase ):
factorials.append(factorials[-1] * i )
assert 0 <= k < factorials[-1] * n, "k out of bounds"
UpperCamelCase : Tuple =... | 629 | 1 |
import unittest
import numpy as np
from transformers.testing_utils import require_flax, require_tf, require_torch
from transformers.utils import (
expand_dims,
flatten_dict,
is_flax_available,
is_tf_available,
is_torch_available,
reshape,
squeeze,
transpose,
)
if is_flax_availa... | 629 |
import inspect
import math
import tempfile
import unittest
import numpy as np
from transformers import ViTMAEConfig
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available
from ...test_confi... | 629 | 1 |
from collections import defaultdict
from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst
def A_ ( ) -> Optional[Any]:
UpperCamelCase , UpperCamelCase : List[Any] = 9, 14 # noqa: F841
UpperCamelCase : Any = [
[0, 1, 4],
... | 629 |
def A_ ( _lowerCAmelCase ) -> bool:
return str(_lowerCAmelCase ) == str(_lowerCAmelCase )[::-1]
def A_ ( _lowerCAmelCase ) -> int:
return int(_lowerCAmelCase ) + int(str(_lowerCAmelCase )[::-1] )
def A_ ( _lowerCAmelCase = 1_0000 ) -> int:
UpperCamelCase... | 629 | 1 |
from typing import TYPE_CHECKING
from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
__lowerCamelCase : List[Any] = {"""configuration_van""": ["""VAN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """VanConfig"""]}
try:
if not is_torch_available():
... | 629 |
__lowerCamelCase : str = 6_5521
def A_ ( _lowerCAmelCase ) -> int:
UpperCamelCase : Any = 1
UpperCamelCase : str = 0
for plain_chr in plain_text:
UpperCamelCase : List[Any] = (a + ord(_lowerCAmelCase )) % MOD_ADLER
UpperCamelCase... | 629 | 1 |
import argparse
from collections import OrderedDict
from pathlib import Path
import requests
import torch
from PIL import Image
from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor
from transformers.utils import logging
logging.set_verbosity_info()
__lowerCamelCase : Optional[Any]... | 629 |
import json
import os
from functools import lru_cache
from typing import Dict, List, Optional, Tuple, Union
import regex as re
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...tokenization_utils_base import BatchEncoding, EncodedInput
from ...utils import PaddingStrategy, logging
__lo... | 629 | 1 |
import argparse
import os
import torch
from diffusers import (
CMStochasticIterativeScheduler,
ConsistencyModelPipeline,
UNetaDModel,
)
__lowerCamelCase : Dict = {
"""sample_size""": 32,
"""in_channels""": 3,
"""out_channels""": 3,
"""layers_per_block""": 2,
"""num_cl... | 629 |
from typing import Any
def A_ ( _lowerCAmelCase ) -> list[Any]:
if not input_list:
return []
UpperCamelCase : List[str] = [input_list.count(_lowerCAmelCase ) for value in input_list]
UpperCamelCase : Dict = max(_lowerCAmelCase ) # Gets the maximum count in... | 629 | 1 |
import warnings
from ...utils import logging
from .image_processing_yolos import YolosImageProcessor
__lowerCamelCase : Optional[Any] = logging.get_logger(__name__)
class A__ ( __snake_case ):
def __init__( self , *A_ , **A_ ):
'''simple docstring'''
... | 629 |
from random import shuffle
import tensorflow as tf
from numpy import array
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]:
UpperCamelCase : List[Any] = int(_lowerCAmelCase )
assert noofclusters < len(_lowerCAmelCase )
# Find out the dimensionality
Upper... | 629 | 1 |
def A_ ( _lowerCAmelCase ) -> bool:
UpperCamelCase : List[Any] = 0
for ch in input_str:
UpperCamelCase : Optional[Any] = ord(_lowerCAmelCase )
UpperCamelCase : Optional[Any] = pow(2 , _lowerCAmelCase )
# If we already turned on bit for ... | 629 |
import os
def A_ ( ) -> Union[str, Any]:
with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f:
UpperCamelCase : Optional[Any] = [] # noqa: E741
for _ in range(20 ):
l.append([int(_lowerCAmelCase ) for x in f.readline().split()] )
UpperCamelCase : ... | 629 | 1 |
from dataclasses import dataclass, field
from typing import Optional
from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser
@dataclass
class A__ :
_UpperCAmelCase :str = field(
metadata={'help': 'The output dire... | 629 |
import json
import os
import tempfile
from transformers.testing_utils import check_json_file_has_correct_format
class A__ :
_UpperCAmelCase :Union[str, Any] = None
def __UpperCamelCase( self ):
'''simple docstring'''
UpperCamelCase : int ... | 629 | 1 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__lowerCamelCase : Optional[int] = logging.get_logger(__name__)
__lowerCamelCase : List[Any] = {
"""facebook/vit-mae-base""": """https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json""",
... | 629 |
import warnings
from ...utils import logging
from .image_processing_beit import BeitImageProcessor
__lowerCamelCase : Optional[Any] = logging.get_logger(__name__)
class A__ ( __snake_case ):
def __init__( self , *A_ , **A_ ):
'''simple docstring'''
... | 629 | 1 |
from math import sqrt
def A_ ( _lowerCAmelCase ) -> bool:
assert isinstance(_lowerCAmelCase , _lowerCAmelCase ) and (
number >= 0
), "'number' must been an int and positive"
UpperCamelCase : List[str] = True
# 0 and 1 are none primes.
if number <= 1:
UpperCame... | 629 |
from __future__ import annotations
import math
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float:
UpperCamelCase : Tuple = u
for i in range(1 , _lowerCAmelCase ):
UpperCamelCase : Any = temp * (u - i)
return temp
def A_ ( ) -> ... | 629 | 1 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_torch_available,
)
__lowerCamelCase : List[Any] = {
"""configuration_falcon""": ["""FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FalconConfig"""],
}
try:
if not is_torch_availab... | 629 |
# 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
__lowerCamelCase : str = TypeVar("""T""")
class A__ ( Generic[T] ):
def __init__( ... | 629 | 1 |
import logging
import math
from functools import partial
from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union
import torch
from .tensor_utils import tensor_tree_map, tree_map
def A_ ( _lowerCAmelCase ) -> List[Tuple[int, ...]]:
UpperCamelCase : Opt... | 629 |
from typing import List, Optional, Union
import numpy as np
import torch
import torchaudio.compliance.kaldi as ta_kaldi
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ...utils import PaddingStrategy, TensorType, logging
__low... | 629 | 1 |
# Copyright 2023 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
#
# Unless required by app... | 629 |
import hashlib
import unittest
from typing import Dict
import numpy as np
from transformers import (
MODEL_FOR_MASK_GENERATION_MAPPING,
TF_MODEL_FOR_MASK_GENERATION_MAPPING,
is_vision_available,
pipeline,
)
from transformers.pipelines import MaskGenerationPipeline
from transformers.testing_utils... | 629 | 1 |
import unittest
from dataclasses import dataclass
import pytest
from accelerate.commands.config.config_args import SageMakerConfig
from accelerate.utils import ComputeEnvironment
from accelerate.utils.launch import _convert_nargs_to_dict
@dataclass
class A__ ( __snake_case ):
_UpperCAmelCase ... | 629 |
__lowerCamelCase : Any = 9.8_0_6_6_5
def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = g ) -> float:
if fluid_density <= 0:
raise ValueError("Impossible fluid density" )
if volume < 0:
raise ValueError("Impossible Object volume" )
if gravity <= 0:
raise... | 629 | 1 |
import logging
import torch
from torch import nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward
from transformers.models.bert.modeling_bert import (
BERT_INPUTS_DOCSTRING,
BERT_START_DOCSTRING,
BertEncode... | 629 |
import numpy as np
import qiskit
def A_ ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str:
UpperCamelCase : Tuple = np.random.default_rng(seed=_lowerCAmelCase )
# Roughly 25% of the qubits will contribute to the key.
# So we take more than we need.
UpperCamelCase... | 629 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.