code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
'''simple docstring''' def __a ( UpperCAmelCase ) ->str: """simple docstring""" A = int(UpperCAmelCase ) if decimal in (0, 1): # Exit cases for the recursion return str(UpperCAmelCase ) A , A = divmod(UpperCAmelCase , 2 ) retu...
337
'''simple docstring''' from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) def __a ( UpperCAmelCase ) ->List[int]: """simple docstring""" if isin...
337
1
'''simple docstring''' from __future__ import annotations _lowerCamelCase : Optional[int] = [] def __a ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ) ->bool: """simple docstring""" for i in range(len(UpperCAmelCase ) ): if board[row][...
337
'''simple docstring''' from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 _lowerCamelCase : Any = { # 1536-bit 5: { ...
337
1
'''simple docstring''' from __future__ import annotations def __a ( UpperCAmelCase , UpperCAmelCase = None ) ->list[list[str]]: """simple docstring""" A = word_bank or [] # create a table A = len(UpperCAmelCase ) + 1 A = [] for _ i...
337
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase ) ->Tuple: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(UpperCAmelCase , int(b / 2 ) ) * actual_power(UpperCAmelCase , int(b / 2 ) ) else:...
337
1
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase ) ->float: """simple docstring""" if discount_rate < 0: raise ValueError("""Discount rate cannot be negative""" ) if not cash_flows: raise ValueError("""Cash flows list cannot be empty""" ) A ...
337
'''simple docstring''' from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import f...
337
1
'''simple docstring''' from ....configuration_utils import PretrainedConfig from ....utils import logging _lowerCamelCase : Optional[Any] = logging.get_logger(__name__) # TODO: upload to AWS _lowerCamelCase : int = { 'yjernite/retribert-base-uncased': ( 'https://huggin...
337
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES _lowerCamelCase : List[str] = logging.get_logger(__name__) _lowerCame...
337
1
'''simple docstring''' from __future__ import annotations def __a ( UpperCAmelCase ) ->list[int]: """simple docstring""" return [ord(UpperCAmelCase ) - 96 for elem in plain] def __a ( UpperCAmelCase ) ->str: """simple docstring""" return "".join...
337
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class __UpperCAmelCase ( unittest.TestCase ): ...
337
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _lowerCamelCase : Tuple = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_M...
337
'''simple docstring''' import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # 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 _lowerC...
337
1
'''simple docstring''' import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel _lowerCamelCase : Optional[Any] = HfApi() _lowerCamelCase : str = {} # fmt: off _lowerCamelCase : Optional[int] = torch.tensor([ -0.7_5_1_5, -1...
337
'''simple docstring''' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" return credit_card_number.startswith(("""34""", """35""", """37""", """4""", """5""", """6""") ) def __a ( UpperCAmelCase ) ->bool: """simple docstring""" A ...
337
1
'''simple docstring''' from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def __a ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase = 1 / sqrt(2 ) ) ->IIRFilter: """simple docstring""" A = tau * frequency / samplerat...
337
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class __UpperCAmelCase : '''simple docstring''' def __init__(self : Any , _lowerCAmelCase : List[Any] ): A = str(id_ ) A = None A = None A ...
337
1
'''simple docstring''' from __future__ import annotations _lowerCamelCase : List[str] = 8.988e9 # units = N * m^s * C^-2 def __a ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ) ->dict[str, float]: """simple docstring""" A ...
337
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimensio...
337
1
'''simple docstring''' from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __UpperCAmelCase ( A__ ): '''simple docstring''' __lowerCAmelCase = ['''image_processor''', '''tokenizer'''] __lowerCAmelCase = '...
337
'''simple docstring''' import math class __UpperCAmelCase : '''simple docstring''' def __init__(self : int , _lowerCAmelCase : List[Any]=0 ): # a graph with Node 0,1,...,N-1 A = n A = [ [math.inf for j in range(0 , _lowerCAmelCase )] for i in...
337
1
'''simple docstring''' import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class __UpperCAmelCase ( pl.LightningModule ): '''simple docstring''' def __init__(self : Option...
337
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensor...
337
1
'''simple docstring''' import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHEC...
337
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : Optional[Any] = { 'configuration_swinv2': ['SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Swinv2Config'], } try: if not is_torch_ava...
337
1
'''simple docstring''' def __a ( UpperCAmelCase ) ->int: """simple docstring""" if not isinstance(UpperCAmelCase , UpperCAmelCase ): A = f"""Input value of [number={number}] must be an integer""" raise TypeError(UpperCAmelCase ) if number < 1: A ...
337
'''simple docstring''' import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class __UpperCAmelCase ( unittest.TestCase ): '''simple docstring''' ...
337
1
'''simple docstring''' import math def __a ( UpperCAmelCase = 100 ) ->int: """simple docstring""" A = sum(i * i for i in range(1 , n + 1 ) ) A = int(math.pow(sum(range(1 , n + 1 ) ) , 2 ) ) return square_of...
337
'''simple docstring''' from ..utils import DummyObject, requires_backends class __UpperCAmelCase ( metaclass=A__ ): '''simple docstring''' __lowerCAmelCase = ['''torch''', '''transformers''', '''onnx'''] def __init__(self : Tuple , *_lowerCAmelCase : Option...
337
1
'''simple docstring''' import contextlib import copy import random from typing import Any, Dict, Iterable, Optional, Union import numpy as np import torch from .utils import deprecate, is_transformers_available if is_transformers_available(): import transformers def __a ( UpperCAmelCase ...
337
'''simple docstring''' import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCa...
337
1
'''simple docstring''' 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 :...
337
'''simple docstring''' import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : List[str] = { 'vocab_...
337
1
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _lowerCamelCase : int = logging.get_logger(__name__) _low...
337
'''simple docstring''' _lowerCamelCase : List[Any] = 'Input must be a string of 8 numbers plus letter' _lowerCamelCase : str = 'TRWAGMYFPDXBNJZSQVHLCKE' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" if not isinstance(UpperCAmelCase , ...
337
1
'''simple docstring''' import argparse import tensorflow as tf import torch from transformers import BertConfig, BertForMaskedLM from transformers.models.bert.modeling_bert import ( BertIntermediate, BertLayer, BertOutput, BertPooler, BertSelfAttention, BertSelfOutput, ) from transform...
337
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : Any = { 'google/umt5-small'...
337
1
'''simple docstring''' import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class __UpperCAmelCase ( A__ ): '''simple docstring''' __lowerCAmelCase = (DDIMParallelScheduler,) __lowerCAmelCase = (('''eta'...
337
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) _lower...
337
1
'''simple docstring''' from __future__ import annotations def __a ( UpperCAmelCase ) ->float: """simple docstring""" if not nums: raise ValueError("""List is empty""" ) return sum(UpperCAmelCase ) / len(UpperCAmelCase ) if __name__ == "__main__": import doc...
337
'''simple docstring''' from __future__ import annotations def __a ( UpperCAmelCase ) ->list[int]: """simple docstring""" return [ord(UpperCAmelCase ) - 96 for elem in plain] def __a ( UpperCAmelCase ) ->str: """simple docstring""" return "".join...
337
1
'''simple docstring''' # This code is adapted from OpenAI's release # https://github.com/openai/human-eval/blob/master/human_eval/execution.py import contextlib import faulthandler import io import multiprocessing import os import platform import signal import tempfile def __a ( UpperCAmelCase ...
337
'''simple docstring''' import os def __a ( ) ->List[Any]: """simple docstring""" A = os.path.join(os.path.dirname(UpperCAmelCase ) , """num.txt""" ) with open(UpperCAmelCase ) as file_hand: return str(sum(int(UpperCAmelCase ) for line in file_ha...
337
1
'''simple docstring''' from string import ascii_uppercase _lowerCamelCase : str = {str(ord(c) - 55): c for c in ascii_uppercase} def __a ( UpperCAmelCase , UpperCAmelCase ) ->str: """simple docstring""" if isinstance(UpperCAmelCase , UpperCAmelCase ...
337
'''simple docstring''' from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) def __a ( UpperCAmelCase ) ->List[int]: """simple docstring""" if isin...
337
1
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_cha...
337
'''simple docstring''' from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 _lowerCamelCase : Any = { # 1536-bit 5: { ...
337
1
'''simple docstring''' import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging _lowerCamelCase...
337
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase ) ->Tuple: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(UpperCAmelCase , int(b / 2 ) ) * actual_power(UpperCAmelCase , int(b / 2 ) ) else:...
337
1
'''simple docstring''' import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, pr...
337
'''simple docstring''' from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import f...
337
1
'''simple docstring''' import argparse import json from collections import OrderedDict from functools import partial from pathlib import Path import timm import torch from huggingface_hub import hf_hub_download from transformers import LevitConfig, LevitForImageClassificationWithTeacher, LevitImageProcessor f...
337
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES _lowerCamelCase : List[str] = logging.get_logger(__name__) _lowerCame...
337
1
'''simple docstring''' import torch from torch import nn from transformers import CLIPPreTrainedModel, CLIPVisionModel from ...models.attention import BasicTransformerBlock from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) # pylint: disable=invalid-name clas...
337
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class __UpperCAmelCase ( unittest.TestCase ): ...
337
1
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : Tuple = { 'configuration_informer': [ 'INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
337
'''simple docstring''' import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # 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 _lowerC...
337
1
'''simple docstring''' import unittest from huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, ...
337
'''simple docstring''' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" return credit_card_number.startswith(("""34""", """35""", """37""", """4""", """5""", """6""") ) def __a ( UpperCAmelCase ) ->bool: """simple docstring""" A ...
337
1
'''simple docstring''' import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLeng...
337
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class __UpperCAmelCase : '''simple docstring''' def __init__(self : Any , _lowerCAmelCase : List[Any] ): A = str(id_ ) A = None A = None A ...
337
1
'''simple docstring''' from __future__ import annotations from dataclasses import dataclass @dataclass class __UpperCAmelCase : '''simple docstring''' __lowerCAmelCase = 42 __lowerCAmelCase = None __lowerCAmelCase = None def __a ( Uppe...
337
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimensio...
337
1
'''simple docstring''' from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : Optional[int] = logging.get_logger(__name_...
337
'''simple docstring''' import math class __UpperCAmelCase : '''simple docstring''' def __init__(self : int , _lowerCAmelCase : List[Any]=0 ): # a graph with Node 0,1,...,N-1 A = n A = [ [math.inf for j in range(0 , _lowerCAmelCase )] for i in...
337
1
'''simple docstring''' def __a ( UpperCAmelCase = 10**12 ) ->int: """simple docstring""" A = 1 A = 0 A = 1 A = 1 while numerator <= 2 * min_total - 1: prev_numerator += 2 * numerator numerator += 2 * prev_numerator prev_denomina...
337
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensor...
337
1
'''simple docstring''' from typing import Dict, List, Optional, Tuple, Union import torch from ...models import AutoencoderKL, TransformeraDModel from ...schedulers import KarrasDiffusionSchedulers from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class ...
337
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : Optional[Any] = { 'configuration_swinv2': ['SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Swinv2Config'], } try: if not is_torch_ava...
337
1
'''simple docstring''' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" A = 0 for ch in input_str: A = ord(UpperCAmelCase ) A = pow(2 , UpperCAmelCase ) # If we already turned on bit for current character's unicode i...
337
'''simple docstring''' import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class __UpperCAmelCase ( unittest.TestCase ): '''simple docstring''' ...
337
1
'''simple docstring''' import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mod...
337
'''simple docstring''' from ..utils import DummyObject, requires_backends class __UpperCAmelCase ( metaclass=A__ ): '''simple docstring''' __lowerCAmelCase = ['''torch''', '''transformers''', '''onnx'''] def __init__(self : Tuple , *_lowerCAmelCase : Option...
337
1
'''simple docstring''' import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) _lowerCamelCase : List[str] = { 'sample_size': 32, 'in_channels': 3, 'out_channels': 3, 'layers_per_block':...
337
'''simple docstring''' import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCa...
337
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, is_vision_available, ) _lowerCamelCase : Optional[Any] = {'configuration_vit': ['VIT_PRETRA...
337
'''simple docstring''' import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : List[str] = { 'vocab_...
337
1
'''simple docstring''' import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import numpy as np import pandas as pd from datasets import load_dataset import transformers from transformers import ( AutoConfig, BartForSeque...
337
'''simple docstring''' _lowerCamelCase : List[Any] = 'Input must be a string of 8 numbers plus letter' _lowerCamelCase : str = 'TRWAGMYFPDXBNJZSQVHLCKE' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" if not isinstance(UpperCAmelCase , ...
337
1
'''simple docstring''' from __future__ import annotations from collections.abc import Callable def __a ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase , UpperCAmelCase = 100 , ) ->float: """simple docstring""" A = x_start A = fnc(U...
337
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : Any = { 'google/umt5-small'...
337
1
'''simple docstring''' import inspect import unittest from transformers import ConvNextConfig 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_backbone_common import Bac...
337
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) _lower...
337
1
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ) ->str: """simple docstring""" A = [False] * len(UpperCAmelCase ) A = [] queue.append(UpperCAmelCase ) A = True whil...
337
'''simple docstring''' from __future__ import annotations def __a ( UpperCAmelCase ) ->list[int]: """simple docstring""" return [ord(UpperCAmelCase ) - 96 for elem in plain] def __a ( UpperCAmelCase ) ->str: """simple docstring""" return "".join...
337
1
'''simple docstring''' import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def __a ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ) ->Union[str, Any]: """simple docstring""" A = OmegaC...
337
'''simple docstring''' import os def __a ( ) ->List[Any]: """simple docstring""" A = os.path.join(os.path.dirname(UpperCAmelCase ) , """num.txt""" ) with open(UpperCAmelCase ) as file_hand: return str(sum(int(UpperCAmelCase ) for line in file_ha...
337
1
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging _lowerCamelCase : int = ...
337
'''simple docstring''' from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) def __a ( UpperCAmelCase ) ->List[int]: """simple docstring""" if isin...
337
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase : Optional[int] = logging.get_logger(__name__) _lowerCamelCase : int = { 'facebook/dpr-ctx_encoder-single-nq-base': ( 'https://huggingface.co/faceboo...
337
'''simple docstring''' from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 _lowerCamelCase : Any = { # 1536-bit 5: { ...
337
1
'''simple docstring''' import warnings from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : Any = logging.get_logger(__name_...
337
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase ) ->Tuple: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(UpperCAmelCase , int(b / 2 ) ) * actual_power(UpperCAmelCase , int(b / 2 ) ) else:...
337
1
'''simple docstring''' import unittest from transformers import ( MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING, TextGenerationPipeline, logging, pipeline, ) from transformers.testing_utils import ( CaptureLogger, is_pipeline_test, require_accelerate, require_t...
337
'''simple docstring''' from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import f...
337
1
'''simple docstring''' import math def __a ( UpperCAmelCase ) ->bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes r...
337
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES _lowerCamelCase : List[str] = logging.get_logger(__name__) _lowerCame...
337
1
'''simple docstring''' from collections.abc import Generator from math import sin def __a ( UpperCAmelCase ) ->bytes: """simple docstring""" if len(UpperCAmelCase ) != 32: raise ValueError("""Input must be of length 32""" ) A = B"""""" for i in [3, 2, 1, ...
337
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class __UpperCAmelCase ( unittest.TestCase ): ...
337
1
'''simple docstring''' from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. _lowerCamelCase : int = 10 def __a ( UpperCAmelCase , UpperCAmelCase , ...
337
'''simple docstring''' import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # 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 _lowerC...
337
1
'''simple docstring''' from sklearn.metrics import matthews_corrcoef import datasets _lowerCamelCase : str = '\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass classifica...
337
'''simple docstring''' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" return credit_card_number.startswith(("""34""", """35""", """37""", """4""", """5""", """6""") ) def __a ( UpperCAmelCase ) ->bool: """simple docstring""" A ...
337
1
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging...
337
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class __UpperCAmelCase : '''simple docstring''' def __init__(self : Any , _lowerCAmelCase : List[Any] ): A = str(id_ ) A = None A = None A ...
337
1
'''simple docstring''' from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def __a ( UpperCAmelCase ) ->List[str]: """simple docstring""" def is_in_circle(UpperCAmelCase , UpperCAmelCase ) -> bool: A ...
337
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimensio...
337
1
'''simple docstring''' from __future__ import annotations from collections import Counter from random import random class __UpperCAmelCase : '''simple docstring''' def __init__(self : Any ): A = {} def A (self : List[Any] , _lowerCAmelCase : s...
337
'''simple docstring''' import math class __UpperCAmelCase : '''simple docstring''' def __init__(self : int , _lowerCAmelCase : List[Any]=0 ): # a graph with Node 0,1,...,N-1 A = n A = [ [math.inf for j in range(0 , _lowerCAmelCase )] for i in...
337
1
'''simple docstring''' from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig _lowerCamelCase : str = logging.get_logger(__name__) _lowerCamelCase : List[str] = 'T5Config' c...
337
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensor...
337
1
'''simple docstring''' import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate _lowerCamelCase : List[str] = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerro...
337
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : Optional[Any] = { 'configuration_swinv2': ['SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Swinv2Config'], } try: if not is_torch_ava...
337
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, StableDiffu...
337
'''simple docstring''' import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class __UpperCAmelCase ( unittest.TestCase ): '''simple docstring''' ...
337
1
'''simple docstring''' from __future__ import annotations import math def __a ( UpperCAmelCase ) ->bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, a...
337
'''simple docstring''' from ..utils import DummyObject, requires_backends class __UpperCAmelCase ( metaclass=A__ ): '''simple docstring''' __lowerCAmelCase = ['''torch''', '''transformers''', '''onnx'''] def __init__(self : Tuple , *_lowerCAmelCase : Option...
337
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCamelCase : List[Any] = { 'configuration_remb...
337
'''simple docstring''' import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCa...
337
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _lowerCamelCase : int = {'configuration_reformer': ['REFORMER_PRETRAINED_CON...
337
'''simple docstring''' import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : List[str] = { 'vocab_...
337
1
'''simple docstring''' import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration _lowerCamelCase : Any = [ # tf -> hf ('/', '.'), ('layer_', 'layers.'), ...
337
'''simple docstring''' _lowerCamelCase : List[Any] = 'Input must be a string of 8 numbers plus letter' _lowerCamelCase : str = 'TRWAGMYFPDXBNJZSQVHLCKE' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" if not isinstance(UpperCAmelCase , ...
337
1
'''simple docstring''' from __future__ import annotations import math import random from typing import Any class __UpperCAmelCase : '''simple docstring''' def __init__(self : List[Any] ): A = [] A = 0 A = 0 def A (sel...
337
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : Any = { 'google/umt5-small'...
337
1
'''simple docstring''' from torch import nn def __a ( UpperCAmelCase ) ->List[str]: """simple docstring""" if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU() else: raise ValueError(f"""Unsuppo...
337
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) _lower...
337
1
'''simple docstring''' import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from...
337
'''simple docstring''' from __future__ import annotations def __a ( UpperCAmelCase ) ->list[int]: """simple docstring""" return [ord(UpperCAmelCase ) - 96 for elem in plain] def __a ( UpperCAmelCase ) ->str: """simple docstring""" return "".join...
337
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCamelCase : Optional[Any] = { 'configuration_blenderbo...
337
'''simple docstring''' import os def __a ( ) ->List[Any]: """simple docstring""" A = os.path.join(os.path.dirname(UpperCAmelCase ) , """num.txt""" ) with open(UpperCAmelCase ) as file_hand: return str(sum(int(UpperCAmelCase ) for line in file_ha...
337
1
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase : int = logging.get_logger(__name__) _lowerCamelCase : str = { 'microsoft/unispeech-sat-base-100h-libri-ft': ( 'htt...
337
'''simple docstring''' from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) def __a ( UpperCAmelCase ) ->List[int]: """simple docstring""" if isin...
337
1
'''simple docstring''' from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __a ( UpperCAmelCase ) ->int: """simple docstring""" A = prime_factors(UpperCAmelCase ) if is_square_free(UpperCAmelCase ): return -1 if...
337
'''simple docstring''' from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 _lowerCamelCase : Any = { # 1536-bit 5: { ...
337
1
'''simple docstring''' import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _lowerCamelCase : List[Any] ...
337
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase ) ->Tuple: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(UpperCAmelCase , int(b / 2 ) ) * actual_power(UpperCAmelCase , int(b / 2 ) ) else:...
337
1
'''simple docstring''' import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available(): import onnxrunti...
337
'''simple docstring''' from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import f...
337
1
'''simple docstring''' import os def __a ( UpperCAmelCase = "input.txt" ) ->int: """simple docstring""" with open(os.path.join(os.path.dirname(UpperCAmelCase ) , UpperCAmelCase ) ) as input_file: A = [ [int(UpperCAmelCase ) for element...
337
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES _lowerCamelCase : List[str] = logging.get_logger(__name__) _lowerCame...
337
1
'''simple docstring''' import dataclasses import json import warnings from dataclasses import dataclass, field from time import time from typing import List from ..utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) def __a ( UpperCAmelCase=None , Upp...
337
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class __UpperCAmelCase ( unittest.TestCase ): ...
337
1
'''simple docstring''' import json import os from typing import Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) _lowerCamelCase : List[str] = {'vocab_file': 'vocab.json'}...
337
'''simple docstring''' import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # 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 _lowerC...
337
1
'''simple docstring''' import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # 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 _lowerC...
337
'''simple docstring''' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" return credit_card_number.startswith(("""34""", """35""", """37""", """4""", """5""", """6""") ) def __a ( UpperCAmelCase ) ->bool: """simple docstring""" A ...
337
1
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _lowerCamelCase : Dict = datasets.load_iris() _lowerCamelCase : List[str] = np.array(data['data']) _lowerCamelCase : List[...
337
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class __UpperCAmelCase : '''simple docstring''' def __init__(self : Any , _lowerCAmelCase : List[Any] ): A = str(id_ ) A = None A = None A ...
337
1
'''simple docstring''' from typing import List from .keymap import KEYMAP, get_character def __a ( UpperCAmelCase ) ->str: """simple docstring""" def decorator(UpperCAmelCase ): A = getattr(UpperCAmelCase , """handle_key""" , [] ) handle += ...
337
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimensio...
337
1
'''simple docstring''' import unittest from transformers import BertGenerationTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin _lowerCamelCase...
337
'''simple docstring''' import math class __UpperCAmelCase : '''simple docstring''' def __init__(self : int , _lowerCAmelCase : List[Any]=0 ): # a graph with Node 0,1,...,N-1 A = n A = [ [math.inf for j in range(0 , _lowerCAmelCase )] for i in...
337
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _lowerCamelCase : int = { 'configuration_ctrl': ['CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CTRLConfig'], 'tokenization_ctrl': ['CTRL...
337
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensor...
337
1
'''simple docstring''' import math def __a ( UpperCAmelCase ) ->bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes r...
337
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : Optional[Any] = { 'configuration_swinv2': ['SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Swinv2Config'], } try: if not is_torch_ava...
337
1
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py _lowerCamelCase : Tuple = '\\n@INPROCEEDINGS{Papineni02bleu:a,\n author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu},\n...
337
'''simple docstring''' import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class __UpperCAmelCase ( unittest.TestCase ): '''simple docstring''' ...
337
1
'''simple docstring''' from __future__ import annotations class __UpperCAmelCase : '''simple docstring''' def __init__(self : int , _lowerCAmelCase : list[list[int]] ): A = TypeError( """Matrices must be formed from a list of zero or more lists containing a...
337
'''simple docstring''' from ..utils import DummyObject, requires_backends class __UpperCAmelCase ( metaclass=A__ ): '''simple docstring''' __lowerCAmelCase = ['''torch''', '''transformers''', '''onnx'''] def __init__(self : Tuple , *_lowerCAmelCase : Option...
337
1
'''simple docstring''' from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class __UpperCAmelCase ( A__ ): '''simple docstring''' ...
337
'''simple docstring''' import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCa...
337
1
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase ) ->int: """simple docstring""" while a != 0: A , A = b % a, a return b def __a ( UpperCAmelCase , UpperCAmelCase ) ->int: """simple docstring""" if gcd...
337
'''simple docstring''' import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : List[str] = { 'vocab_...
337
1
'''simple docstring''' def __a ( UpperCAmelCase = 100 ) ->int: """simple docstring""" A = (n * (n + 1) // 2) ** 2 A = n * (n + 1) * (2 * n + 1) // 6 return sum_cubes - sum_squares if __name__ == "__main__": print(f"{solution() = }")
337
'''simple docstring''' _lowerCamelCase : List[Any] = 'Input must be a string of 8 numbers plus letter' _lowerCamelCase : str = 'TRWAGMYFPDXBNJZSQVHLCKE' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" if not isinstance(UpperCAmelCase , ...
337
1
'''simple docstring''' import os import re import shutil import sys import tempfile import unittest import black _lowerCamelCase : Optional[int] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_cop...
337
'''simple docstring''' from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging _lowerCamelCase : Dict = logging.get_logger(__name__) _lowerCamelCase : Any = { 'google/umt5-small'...
337
1
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _lowerCamelCase : Optional[int] = logging.get_logger(__name__) _lowerCamelCase : Optional[int] = { 'ut/deta': 'https://hugging...
337
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) _lower...
337
1
'''simple docstring''' import argparse import re import numpy as np import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SamConfig, SamImageProcessor, SamModel, SamProcessor, SamVisionConfig, ) _lowerCamelCase : List...
337
'''simple docstring''' from __future__ import annotations def __a ( UpperCAmelCase ) ->list[int]: """simple docstring""" return [ord(UpperCAmelCase ) - 96 for elem in plain] def __a ( UpperCAmelCase ) ->str: """simple docstring""" return "".join...
337
1
'''simple docstring''' 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,...
337
'''simple docstring''' import os def __a ( ) ->List[Any]: """simple docstring""" A = os.path.join(os.path.dirname(UpperCAmelCase ) , """num.txt""" ) with open(UpperCAmelCase ) as file_hand: return str(sum(int(UpperCAmelCase ) for line in file_ha...
337
1
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase ) ->Tuple: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(UpperCAmelCase , int(b / 2 ) ) * actual_power(UpperCAmelCase , int(b / 2 ) ) else:...
337
'''simple docstring''' from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _lowerCamelCase : List[Any] = logging.get_logger(__name__) def __a ( UpperCAmelCase ) ->List[int]: """simple docstring""" if isin...
337
1
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase ) ->Any: """simple docstring""" assert x is not None assert y is not None A = len(UpperCAmelCase ) A = len(UpperCAmelCase ) # declaring the array for storing the dp values A ...
337
'''simple docstring''' from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 _lowerCamelCase : Any = { # 1536-bit 5: { ...
337
1
'''simple docstring''' import math class __UpperCAmelCase : '''simple docstring''' def __init__(self : int , _lowerCAmelCase : List[Any]=0 ): # a graph with Node 0,1,...,N-1 A = n A = [ [math.inf for j in range(0 , _lowerCAmelCase )] for i in...
337
'''simple docstring''' def __a ( UpperCAmelCase , UpperCAmelCase ) ->Tuple: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(UpperCAmelCase , int(b / 2 ) ) * actual_power(UpperCAmelCase , int(b / 2 ) ) else:...
337
1
'''simple docstring''' import unittest from transformers import 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 Model...
337
'''simple docstring''' from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import f...
337
1
'''simple docstring''' import logging import os from .state import PartialState class __UpperCAmelCase ( logging.LoggerAdapter ): '''simple docstring''' @staticmethod def A (_lowerCAmelCase : Optional[int] ): A = PartialState() return not main_p...
337
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES _lowerCamelCase : List[str] = logging.get_logger(__name__) _lowerCame...
337
1
'''simple docstring''' import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup _lowerCamelCase : Optional[Any] = logging.g...
337
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class __UpperCAmelCase ( unittest.TestCase ): ...
337
1
'''simple docstring''' import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCa...
337
'''simple docstring''' import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # 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 _lowerC...
337
1
'''simple docstring''' import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modul...
337
'''simple docstring''' def __a ( UpperCAmelCase ) ->bool: """simple docstring""" return credit_card_number.startswith(("""34""", """35""", """37""", """4""", """5""", """6""") ) def __a ( UpperCAmelCase ) ->bool: """simple docstring""" A ...
337
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 datasets.dataset_dict impor...
337
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class __UpperCAmelCase : '''simple docstring''' def __init__(self : Any , _lowerCAmelCase : List[Any] ): A = str(id_ ) A = None A = None A ...
337
1
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, ...
337
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimensio...
337
1
'''simple docstring''' from typing import Dict, Iterable, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, ...
337
'''simple docstring''' import math class __UpperCAmelCase : '''simple docstring''' def __init__(self : int , _lowerCAmelCase : List[Any]=0 ): # a graph with Node 0,1,...,N-1 A = n A = [ [math.inf for j in range(0 , _lowerCAmelCase )] for i in...
337
1
'''simple docstring''' import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipeline...
337
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensor...
337
1