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""" import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def _lowerCamelCase( a ...
261
"""simple docstring""" from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def _lowerCamelCase( a ): return getitem, k def _lowerCamelCase( a , a ): return setitem, k, v def _lowerCamelCase(...
261
1
"""simple docstring""" import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def lowercase__( __SCREAMING_SNAKE_CASE : Dict ): lowercase_ : str = args.pruning_method lowe...
364
"""simple docstring""" from ...utils import is_torch_available, is_transformers_available if is_transformers_available() and is_torch_available(): from .pipeline_vq_diffusion import LearnedClassifierFreeSamplingEmbeddings, VQDiffusionPipeline
321
0
"""simple docstring""" from collections import defaultdict def UpperCamelCase ( _lowerCAmelCase : str, _lowerCAmelCase : str ) -> bool: _UpperCAmelCase : Optional[Any] = first_str.lower().strip() _UpperCAmelCase : Any = second_str.lower().strip() ...
246
"""simple docstring""" import random class _UpperCAmelCase : @staticmethod def __snake_case ( _A ) -> tuple[list[int], list[int]]: '''simple docstring''' _UpperCAmelCase : List[Any] = [ord(_A ) for i in t...
246
1
"""simple docstring""" def __SCREAMING_SNAKE_CASE ( A_ , A_ ): if a < 0 or b < 0: raise ValueError('''the value of both inputs must be positive''' ) lowerCAmelCase__ : int = str(bin(lowerCamelCase__ ) )[2:] # remove the leading "0b" lowerCAmelCase__ : Optio...
353
"""simple docstring""" def __SCREAMING_SNAKE_CASE ( A_ ): lowerCAmelCase__ : int = 0 for ch in input_str: lowerCAmelCase__ : Any = ord(A_ ) lowerCAmelCase__ : Any = pow(2 , A_ ) # If we already turned on bit for current character...
74
0
"""simple docstring""" from abc import ABC, abstractmethod from typing import Optional, Union from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit from ..utils.typing import NestedDataStructureLike, PathLike class _SCREAMING_SNAKE_CASE ( A...
84
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin if is_spe...
75
0
'''simple docstring''' import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require...
9
'''simple docstring''' import unittest from typing import Dict, List, Optional, Union 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 ImageProces...
9
1
'''simple docstring''' def _A ( snake_case , snake_case ) -> Dict: assert x is not None assert y is not None _lowercase : Dict = len(snake_case ) _lowercase : List[str] = len(snake_case ) # declaring the array for storing the dp values _lo...
250
'''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, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resi...
250
1
"""simple docstring""" from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forw...
318
"""simple docstring""" # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev...
318
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCamelCase : str = { 'configuration_timesformer': ['TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TimesformerConfig'], } try: if not is_torch_available(): ...
182
'''simple docstring''' import math def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> float: if initial_intensity < 0: raise ValueError("""The value of intensity cannot be negative""" ) # handling of negative values of initia...
321
0
'''simple docstring''' from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) # TODO Update this lowercase__ = { "facebook/esm-1b": "https://hugg...
371
'''simple docstring''' def _UpperCamelCase ( SCREAMING_SNAKE_CASE__ ) -> list: '''simple docstring''' snake_case : Any = len(SCREAMING_SNAKE_CASE__ ) for i in range(1 , SCREAMING_SNAKE_CASE__ ): snake_case : Optional[int] = collection[i] snak...
83
0
"""simple docstring""" lowercase_ = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] lowercase_ = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] lowercase_ = { 0: "Sunday", 1: "Monday", 2: "Tuesday", 3: "Wednesday", 4: "Thursday", 5: "Friday", 6: "Saturday", } d...
45
"""simple docstring""" import unittest from transformers import XLMConfig, 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...
74
0
from collections import deque def UpperCamelCase__( UpperCamelCase__ : Optional[Any] )->str: A__ = len(UpperCamelCase__ ) A__ = deque() A__ = [False for _ in range(UpperCamelCase__ )] A__ = [-1 for _ in range(Upper...
39
from __future__ import annotations import time import numpy as np a__: Optional[Any] = [8, 5, 9, 7] a__: Dict = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] a__: List[Any] = [ [3, 2, 1, 4], [0, 2, 5, 2], ...
39
1
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ) fro...
9
from importlib import import_module from .logging import get_logger __lowerCAmelCase : str =get_logger(__name__) class _lowercase : '''simple docstring''' def __init__( self :List[Any] , lowerCAmelCase__ :List[Any] , lowerCAmelCase__ :str=None ) -> int: ...
9
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...
367
"""simple docstring""" from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar A = TypeVar('''T''') class __lowercase ( Generic[T] ): '''simple docstring''' __low...
188
0
'''simple docstring''' import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __lowercase ( _lowercase...
318
'''simple docstring''' import numpy class __lowercase : def __init__(self , A , A ): lowerCamelCase_ : Optional[int] = input_array # Random initial weights are assigned where first argument is the # number of nodes in previous layer and second argument is t...
318
1
import argparse import collections import json import os import re import string import sys import numpy as np __UpperCAmelCase = re.compile(R"\b(a|an|the)\b", re.UNICODE) __UpperCAmelCase = None def A__ ( ): SCREAMING_SNAKE_CASE_ = argparse.ArgumentParser('''Official evaluation...
257
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCase = { "microsoft/unispeech-sat-base-100h-libri-ft": ( "https://huggingface.co/microsoft/unispeech-sat-base-100h-...
257
1
'''simple docstring''' from ....utils import logging lowerCAmelCase_ : Union[str, Any] = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE (lowerCamelCase_ ): """simple docstring""" def __init__( self : Tuple , __a : int , ...
63
'''simple docstring''' from dataclasses import dataclass, field from typing import Optional from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser @dataclass class lowercase__ : lowercase__ = field( metadata={"""help""": """...
83
0
'''simple docstring''' import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, Euler...
179
'''simple docstring''' from .configuration_bert_masked import MaskedBertConfig from .modeling_bert_masked import ( MaskedBertForMultipleChoice, MaskedBertForQuestionAnswering, MaskedBertForSequenceClassification, MaskedBertForTokenClassification, MaskedBertModel, ) from .modul...
179
1
import math from typing import Callable, List, Optional, Union import numpy as np import PIL import torch from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion.pipel...
39
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __lowerCamelCase ( snake_case__): ...
39
1
'''simple docstring''' import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_commo...
46
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available _a : Union[str, Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailabl...
46
1
'''simple docstring''' import random from .binary_exp_mod import bin_exp_mod def lowercase ( __magic_name__ , __magic_name__=1000 ): '''simple docstring''' if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd U...
311
import argparse import hashlib # hashlib is only used inside the Test class import struct class __magic_name__ : '''simple docstring''' def __init__( self, lowercase_ ) -> List[str]: """simple docstring""" a__ =data a__ =[0X67452301, 0Xefcda...
188
0
'''simple docstring''' from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except O...
369
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A : List[str] = { "configuration_bigbird_pegasus": [ "BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP", "BigBirdPeg...
89
0
from typing import Dict import numpy as np import torch from . import residue_constants as rc from .tensor_utils import tensor_tree_map, tree_map def __lowercase ( a__ ) -> Dict[str, torch.Tensor]: __SCREAMING_SNAKE_CASE = [] __SCREAMING_SNAKE_CASE = [] _...
257
from datetime import datetime import requests from bsa import BeautifulSoup if __name__ == "__main__": lowerCAmelCase__ : List[Any] =input('''Enter image url: ''').strip() print(F'''Downloading image from {url} ...''') lowerCAmelCase__ : int =BeautifulSoup(requests.get(u...
257
1
from math import log from scipy.constants import Boltzmann, physical_constants SCREAMING_SNAKE_CASE :Any = 300 # TEMPERATURE (unit = K) def lowerCAmelCase( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , )-> float: """simple docstring""" ...
60
import inspect import unittest from transformers import DPTConfig from transformers.file_utils import is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_...
60
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) a_ = { """configuration_funnel""": ["""FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FunnelConfi...
179
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a_ = logging.get_logger(__name__) a_ = { """bert-base-uncased""": """https://huggingface.co/bert-base...
179
1
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import List import timm import torch import torch.nn as nn from huggingface_hub import hf_hub_download from torch import Tensor from transformers import AutoImageProcessor, ResNet...
84
# 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 applic...
84
1
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = { "SenseTime/deformable-detr": "https://huggingface.co/sense...
46
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE__ = "▁" SCREAMING_SNAKE_CASE__ = {"vocab_file":...
46
1
"""simple docstring""" import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow lowerCAmelCase__ = logging.getLogger() @unittest.skip("Tempo...
244
"""simple docstring""" import math import random from typing import Any from .hill_climbing import SearchProblem def a__ ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = True , _SCREAMING_SNAKE_CASE = math.inf , _SCREAMING_SNAKE_CASE = -math.inf , _SCREAMING_SNAKE_CASE = math.inf...
244
1
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __snake_case : Optional[Any] = { 'configuration_mctct': ['MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MCTCTConfig'], 'feature_ex...
269
'''simple docstring''' from __future__ import annotations from collections.abc import Sequence from typing import Literal def __lowerCamelCase ( lowerCAmelCase_ , lowerCAmelCase_ ) -> str | Literal[False]: _a : Optional[int] = list(lowerCAmelCase_ ) _a ...
89
0
from __future__ import annotations from collections.abc import Generator def __snake_case ( ): __a = {} __a = 2 while True: __a = factor_map.pop(_UpperCAmelCase , _UpperCAmelCase ) if factor: __a = factor + pr...
131
import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.stable_diffusion_safe...
131
1
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .to...
60
"""simple docstring""" import inspect from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel, VQModel from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class snake_case_...
60
1
"""simple docstring""" import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def UpperCAmelCase ( UpperCamelCase__ , UpperCamelCase__ , ...
352
"""simple docstring""" import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class UpperCamelCase__( unittest.TestCase ): def snake_case__ ( self ) -> Optional[int]: ...
154
0
"""simple docstring""" def _snake_case ( lowercase__ : str , lowercase__ : str ) -> int: '''simple docstring''' if len(lowercase__ ) != len(lowercase__ ): raise ValueError("""String lengths must match!""" ) lowerCAmelCase_ :Optional[i...
84
"""simple docstring""" def _snake_case ( lowercase__ : List[Any] , lowercase__ : int , lowercase__ : Optional[int] , lowercase__ : Any ) -> int: '''simple docstring''' lowerCAmelCase_ :int = [False] * len(lowercase__ ) ...
84
1
import math def _SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE ): return math.sqrt(SCREAMING_SNAKE_CASE ) * math.sqrt(SCREAMING_SNAKE_CASE ) == num def _SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE ): A_ : Union[str, Any] = 0 A_ : Dict = n while left <= right: A_ ...
65
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 ModelTesterMixin, ids_tensor from...
65
1
import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAPPING, AutoConfig, AutoModelWithLMHead, Au...
244
import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class __A( __lowerCamelCase ): """simple docstring""" SCREAMING_SNAKE_CASE__ = (CMStochasticIterativeScheduler,) SCREAMING_SNAKE_CASE__ = 10 def UpperCAmel...
244
1
'''simple docstring''' import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTes...
363
'''simple docstring''' from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import ConfigTester from ...test_mode...
8
0
def lowerCamelCase_ ( _a , _a , _a , _a , _a , ): """simple docstring""" lowerCAmelCase__ : Any = [redshift, radiation_density, matter_density, dark_energy] if any(p < 0 for p in parameters ): raise ValueError('''All input parameters ...
131
import unittest from transformers import DonutProcessor lowerCamelCase = '''naver-clova-ix/donut-base''' class _a ( unittest.TestCase): def UpperCAmelCase__( self : str )-> int: lowerCAmelCase__ : Any = DonutProcessor.fro...
131
1
def UpperCAmelCase_ (_lowerCAmelCase : Tuple = 60_08_51_47_51_43 ): try: __UpperCamelCase : int = int(SCREAMING_SNAKE_CASE_ ) except (TypeError, ValueError): raise TypeError("Parameter n must be int or castable to int." ) if n <= 0: raise Valu...
366
import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ....
171
0
from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTeste...
87
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __A : int = {'configuration_unispeech': ['UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP', 'UniSpeechConfig']} try: if not is_tor...
154
0
import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor SCREAMING_SNAKE_CASE :Any = logging.get_logger(__name__) class __magic_name__ ( snake_case ): def __init__( self , *_lowercase , ...
354
import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerat...
60
0
def lowerCAmelCase_ ( __A, __A ) -> tuple[float, float]: '''simple docstring''' if not len(__A ) == len(__A ) == 3: raise ValueError("Please enter a valid equation." ) if equationa[0] == equationa[1] == equationa[0] == equationa[...
65
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = { 'vocab_file': 'vocab.json', 'tokenizer_config...
65
1
'''simple docstring''' from __future__ import annotations def _lowerCamelCase ( lowercase : list[int] , lowercase : int ) -> int: if len(lowercase ) < k or k < 0: raise ValueError("Invalid Input" ) _a = _a ...
361
'''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 lowerCAmel...
346
0
import numpy as np def A ( _lowerCamelCase ): '''simple docstring''' return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
36
import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def __SCREAMING_SNAKE_CASE (*SCREAMING_SNAKE_CASE__ ): if not isinstance(SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ): snake_case_ = list(SCREAMI...
8
0
from pathlib import PurePosixPath from typing import Optional import fsspec from fsspec import AbstractFileSystem from huggingface_hub.hf_api import DatasetInfo from ..utils.file_utils import get_authentication_headers_for_url from ..utils.hub import hf_hub_url class UpperCAmelCase ( A_...
10
import requests from bsa import BeautifulSoup def UpperCamelCase ( __lowerCamelCase : str = "AAPL" ): snake_case : List[Any] = f"""https://in.finance.yahoo.com/quote/{symbol}?s={symbol}""" snake_case : Tuple = BeautifulSoup(requests.get(__lower...
10
1
"""simple docstring""" import heapq as hq import math from collections.abc import Iterator class _UpperCamelCase : '''simple docstring''' def __init__( self , __a ): __lowerCAmelCase = str(id_ ) __lowerCAmelCase = None __lowerCAmelCas...
57
"""simple docstring""" import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict _A = namedtuple( """_TestCommandArgs""", [ """...
171
0
_snake_case = 8.3_1_4_4_5_9_8 def _A ( snake_case , snake_case ) -> float: if temperature < 0: raise Exception("Temperature cannot be less than 0 K" ) if molar_mass <= 0: raise Exception("Molar mass cannot be less than or equal to 0 kg/mol" ) else...
355
'''simple docstring''' import json import logging import os import re import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import datasets import numpy as np import torch import torchaudio from packaging import version from torch import nn import transformers from ...
199
0
"""simple docstring""" import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ...
96
"""simple docstring""" import unittest from transformers import PegasusConfig, PegasusTokenizer, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor if is_f...
60
0
from collections import deque class __a : def __init__( self , lowerCAmelCase__ , lowerCAmelCase__ , lowerCAmelCase__ ) -> None: '''simple docstring''' lowercase__: List[str] = process_name # process name lowercas...
288
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 = logging.get_logger(__name__) __lowerCAmelCase = '...
288
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_...
104
'''simple docstring''' from timeit import timeit UpperCAmelCase_ = { 'MALAYALAM': True, 'String': False, 'rotor': True, 'level': True, 'A': True, 'BB': True, 'ABC': False, 'amanaplanacanalpanama': True, # "a man a plan a canal panama" } # Ensure our test data is valid ...
346
0
import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def A_ ( ) -> List[Any]: with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT...
352
import enum import shutil import sys lowercase , lowercase : List[Any] = shutil.get_terminal_size() lowercase : Union[str, Any] = {"""UP""": """A""", """DOWN""": """B""", """RIGHT""": """C""", """LEFT""": """D"""} class A__ ( enum.Enum ): """simple ...
225
0
from pathlib import PurePosixPath from typing import Optional import fsspec from fsspec import AbstractFileSystem from huggingface_hub.hf_api import DatasetInfo from ..utils.file_utils import get_authentication_headers_for_url from ..utils.hub import hf_hub_url class _SCREAMING_SNAKE_CASE ( __SCREAMI...
10
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 ...
10
1
from __future__ import annotations import math def __lowerCamelCase (UpperCAmelCase__ : int , UpperCAmelCase__ : int , UpperCAmelCase__ : bool , UpperCAmelCase__ : list[int] , UpperCAmelCase__ : float ): if depth < 0: ...
363
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_funnel import FunnelTokenizer _lowerCamelCase : Union[str, Any] = logging.get_logger(__nam...
206
0
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig __A = logging.get_logger(__name__) class _snake_case : def __init__( self ...
135
import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow lowerCamelCase = logging.getLogger() @unittest.skip('Temporarily disable the doc tests.' ...
199
0
import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStructProcessor, PixaStructTextConfig, ...
343
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class lowercase (...
343
1
"""simple docstring""" import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast UpperCAmelCase__ = datasets.utils.logging.get_logger(__name__) @dataclas...
288
"""simple docstring""" import logging from transformers.configuration_utils import PretrainedConfig UpperCAmelCase__ = logging.getLogger(__name__) class lowerCAmelCase__ ( A_ ): __a = """masked_bert""" def __init__( self : Union[str...
288
1
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class UpperCAmelCase ( _...
353
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor SCREAMING_SNAKE_CASE :Any = logging.get_logger(__name__) class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__( self : int ,*A : D...
124
0
import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class _SCREAMING_SNAKE_CASE ( snake_case_ ): lowerCAmelCase__ = 'MCTCTFeatureExtractor' lowerCAmelCase__ = 'AutoTokenizer' def __init__( self , lowercase , l...
19
class lowerCamelCase_ : '''simple docstring''' def __init__( self : List[Any] ): SCREAMING_SNAKE_CASE_ = {} def lowerCAmelCase_ ( self : List[str] ): print(self.vertex ) for i in self.vertex: print(_lowerCAm...
225
0
import os from collections.abc import Iterator def __lowerCamelCase ( a_ : str = "." ) -> Union[str, Any]: for dir_path, dir_names, filenames in os.walk(SCREAMING_SNAKE_CASE__ ): __SCREAMING_SNAKE_CASE :Any = [d for ...
367
"""simple docstring""" import math import unittest def __lowerCamelCase ( a_ : int ) -> bool: assert isinstance(a_ , a_ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: ...
239
0
"""simple docstring""" 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""", date...
224
'''simple docstring''' import argparse import struct import unittest class _lowerCAmelCase : def __init__(self , lowercase ): A_ : List[str] = data # Initialize hash values A_ : Tuple = [ 0X6A09_E667, 0XBB67_AE85, 0X3C6E_F3...
206
0
'''simple docstring''' def A_( A : int = 10 , A : int = 22): UpperCamelCase = range(1 , A) UpperCamelCase = range(1 , A) return sum( 1 for power in powers for base in bases if len(str(base**power)) == power) if ...
251
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : Optional[int] = logging.get_logger(__name__) lowerCAmelCase : Union[str, Any] = {'openai-gpt': 'https://huggingface.co/openai-gpt/resolve/main/config.json'} class...
251
1
import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def __A ( )-> str: """simple docstring""" with offline(OfflineSimu...
39
"""simple docstring""" import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgumentPa...
347
0
'''simple docstring''' from __future__ import annotations import math import numpy as np from numpy.linalg import norm def __lowerCamelCase ( __snake_case : np.ndarray, __snake_case : np.ndarray ) -> float: """simple docstring""" return math.sqrt(sum(pow(a - b,...
136
'''simple docstring''' from maths.is_square_free import is_square_free from maths.prime_factors import prime_factors def __lowerCamelCase ( __snake_case : int ) -> int: """simple docstring""" A__ : List[Any] =prime_factors(__snake_case ) if is_squar...
136
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_at...
67
from jiwer import compute_measures import datasets lowerCamelCase : str = '\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From WER and RIL to MER and WIL: improved ev...
124
0
import math from datetime import datetime, timedelta def lowerCAmelCase_ ( UpperCamelCase_ ) -> Union[str, Any]: UpperCamelCase_ = year % 19 UpperCamelCase_ = year % 4 UpperCamelCase_ = year % 7 UpperCamelCase_ = mat...
359
from datetime import datetime import matplotlib.pyplot as plt import torch def lowerCAmelCase_ ( UpperCamelCase_ ) -> int: for param in module.parameters(): UpperCamelCase_ = False def lowerCAmelCase_ ( ) -> Dict: UpperCamelCa...
328
0
'''simple docstring''' def __snake_case ( ): lowerCamelCase_ = [] lowerCamelCase_ = 1 while len(UpperCAmelCase_ ) < 1E6: constant.append(str(UpperCAmelCase_ ) ) i += 1 lowerCamelCase_ = "".join(UpperCAmelCase_ ) return ( int(constant[0] ) * int(...
55
'''simple docstring''' import operator as op def lowerCamelCase ( UpperCAmelCase__ : Optional[Any] ) -> int: lowercase_ : Optional[Any] = [] lowercase_ : str = lambda UpperCAmelCase__ , UpperCAmelCase__ : int(x / y ) ...
239
0
"""simple docstring""" from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...
324
"""simple docstring""" import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmu...
324
1
'''simple docstring''' import tensorflow as tf from ...tf_utils import shape_list class _a ( tf.keras.layers.Layer ): '''simple docstring''' def __init__( self, A, A, A, A, A=1, A=False, **A ): ...
251
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCamelCase_ = { "configuration_xlm": ["XLM_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMConfig", "XLMOnnxConfig"], "toke...
251
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __lowerCamelCase : List[str] = logging.get_logger(__name__) __lowerCamelCase : List[Any] = { """faceboo...
369
import sys __lowerCamelCase : List[str] = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """...
286
0
"""simple docstring""" import torch def _SCREAMING_SNAKE_CASE () -> Optional[int]: '''simple docstring''' if torch.cuda.is_available(): lowercase_ = torch.cuda.device_count() else: lowercase_ = 0 print(F'''Successfully ran on {num_gpus} ...
136
"""simple docstring""" import os from typing import Dict, List, Tuple, TypeVar, Union UpperCAmelCase : Union[str, Any] = TypeVar("T") UpperCAmelCase : Dict = Union[List[T], Tuple[T, ...]] UpperCAmelCase : int = Union[T, List[T], Dict[str, T]] UpperCAmelCase : ...
136
1
def __lowercase ( lowerCamelCase : Any = 1000 ): UpperCamelCase_ : Dict = 2**power UpperCamelCase_ : List[str] = str(lowerCamelCase_ ) UpperCamelCase_ : Optional[Any] = list(lowerCamelCase_ ) UpperCamelCase_ : Optional[int] = 0 for i in list_num: sum_o...
367
from __future__ import annotations import numpy as np def __lowercase ( lowerCamelCase : list[float] ): return np.maximum(0 , lowerCamelCase ) if __name__ == "__main__": print(np.array(relu([-1, 0, 5]))) # --> [0, 0, 5]
50
0
'''simple docstring''' __lowerCAmelCase = '''ABCDEFGHIJKLMNOPQRSTUVWXYZ''' def __lowerCamelCase ( ) -> None: _a : List[Any] = input('Enter message: ' ) _a : Optional[int] = input('Enter key [alphanumeric]: ' ) _a : Union...
89
from __future__ import annotations import math def A_ ( snake_case : int ) -> 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: # Neg...
328
0
import torch from torch import nn class A ( nn.Module ): """simple docstring""" def __init__( self : List[str],lowercase_ : int,lowercase_ : Tuple,lowercase_ : List[str],lowercase_ : int,lowercase_ : int=1,lowercase_ : List[Any]=False )-> L...
352
from jiwer import compute_measures import datasets lowercase_ = "\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From WER and RIL to MER and WIL: improved evaluation measures for con...
282
0
'''simple docstring''' import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers...
324
'''simple docstring''' import math def a__ ( lowercase : list, lowercase : int = 0, lowercase : int = 0 ) -> list: """simple docstring""" _UpperCamelCase = end or len(lowercase ) for i in range(lowercase, lowercas...
324
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _A = { '''configuration_graphormer''': ['''GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GraphormerConfig'''], } try: if not is_torch_available...
355
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, _in...
167
0
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...sched...
335
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ : str = logging.get_logger(__name__) lowerCamelCase_ : Any =...
286
0
from __future__ import annotations import inspect import unittest import numpy as np from transformers import ResNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common...
350
def A ( __UpperCAmelCase = 100_0000 ) -> int: '''simple docstring''' UpperCAmelCase_ = [i - 1 for i in range(limit + 1 )] for i in range(2 , limit + 1 ): if phi[i] == i - 1: for j in range(2 * i , limit + 1 ...
344
0
def _UpperCAmelCase ( snake_case ): """simple docstring""" _lowerCAmelCase = """""" for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def _UpperCAmelCase ( snake_case ): ...
82
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex from .utils import require_elasticsearch, re...
50
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A : Optional[int] = logging.get_logger(__name__) A : Optional[int] = { '''andreasmadsen/efficient_mlm_m0...
363
from typing import TYPE_CHECKING from ...utils import _LazyModule A : Optional[Any] = {'''processing_wav2vec2_with_lm''': ['''Wav2Vec2ProcessorWithLM''']} if TYPE_CHECKING: from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM else: import sys A : List[s...
276
0
"""simple docstring""" # Imports import numpy as np class A_ : '''simple docstring''' def __init__( self , lowercase_=None , lowercase_=None , lowercase_=None , lowercase_=None , lowercase_=None ): """simple docstring""" self.set_matricies(red=lowercase_ ,...
61
_lowerCamelCase : int = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _lowerCamelCase : str = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _lowerCamelCase : List[str] = { 0: '''Sunday''', 1: '''Monday''', 2: '''Tuesday''', 3: '''Wednesday''', 4: '''Thursday''', ...
282
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available SCREAMING_SNAKE_CASE :Any = { 'configuration_rag': ['RagConfig'], 'retrieval_rag': ['RagRetriever'], 'tokenization_rag': ['RagTokenizer'], } try: ...
370
from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split SCREAMING_SNAKE_CASE :Tuple = datasets.load_iris() SCREAMING_SNAKE_CASE :Dict = np.array(data['data']) SCREAMING_SNAKE_CASE :Optional[int] ...
124
0
'''simple docstring''' import os import numpy import onnx def snake_case_ ( _lowerCAmelCase : str , _lowerCAmelCase : Optional[Any] ) -> int: UpperCAmelCase : Tuple = a.name UpperCAmelCase : Optional[Any] = b.n...
23
"""simple docstring""" from __future__ import annotations from typing import Generic, TypeVar _lowerCamelCase : Any = TypeVar('T') class lowercase ( Generic[T]): def __init__( self : Tuple , _lowerCamelCase : T ): ...
167
0
'''simple docstring''' import unittest from transformers import SPIECE_UNDERLINE, XLNetTokenizer, XLNetTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin snake_case_ : List[str] ...
236
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, loggin...
236
1
"""simple docstring""" import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @require_...
66
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, is_vision_available, ) UpperCamelCase__ : int = {...
344
0
import math import qiskit def __UpperCamelCase ( lowercase__ : int = 1 , lowercase__ : int = 1 , lowercase__ : int = 1 ) -> qiskit.result.counts.Counts: '''simple docstring''' if ( isinstance(lowercase__ , lowercase__ ) ...
28
import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def __UpperCamelCase ( lowercase__ : Optio...
28
1
'''simple docstring''' import unittest from datasets import load_dataset from transformers import BloomTokenizerFast from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class SCREAMING_SNAKE_CASE ( _a ,...
28
'''simple docstring''' from datetime import datetime import requests from bsa import BeautifulSoup if __name__ == "__main__": A__: Union[str, Any] = input('''Enter image url: ''').strip() print(F"Downloading image from {url} ...") A__: Tuple = Be...
276
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ ) -> int: return number | (1 << position) def _SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ ) -> int: return number & ~(1 << position) def _SCREAMING_SNA...
230
"""simple docstring""" SCREAMING_SNAKE_CASE = [ 999, 800, 799, 600, 599, 500, 400, 399, 377, 355, 333, 311, 288, 266, 244, 222, 200, 199, 177, 155, 133, 111, 88, 66, 44, 22, 0, ] SCREAMING_SNAKE_CASE ...
230
1
"""simple docstring""" import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common...
197
def SCREAMING_SNAKE_CASE__ ( ) -> list[list[int]]: return [list(range(1000 - i ,-1000 - i ,-1 ) ) for i in range(1000 )] lowerCamelCase : List[Any] = generate_large_matrix() lowerCamelCase : Optional[int] = ( [[4, 3, 2, -1],...
124
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_deformable_detr import DeformableDetrImageProcessor lowerCamelCase__ = logging.get_logger(__name__) class A__ ( lowerCamelCase__): def __init__( self , *_SCREAMING_SNAKE_CASE , **_SCREAMI...
362
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { """facebook/nllb-moe-54B""": """https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json""", } clas...
182
0
import unittest from transformers import DonutProcessor _UpperCAmelCase : Optional[int] = "naver-clova-ix/donut-base" class __lowerCAmelCase ( unittest.TestCase): def SCREAMING_SNAKE_CASE ( self: int ): lowercase :List[str] = DonutProcessor.fro...
236
import os from math import logaa def UpperCAmelCase__ ( lowerCamelCase = "base_exp.txt" ): lowercase :float = 0 lowercase :str = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(lowerCamelCase ), lowerCamelCase ) ) ): lowercase , low...
236
1
"""simple docstring""" from __future__ import annotations from sys import maxsize from typing import Generic, TypeVar lowercase_ = TypeVar("T") def lowercase ( lowerCAmelCase__ : int ) -> int: return (position - 1) // 2 def lowercase ( lowerCAmel...
366
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { "RWKV/rwkv-4-169m-pile": "https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json", "RWKV...
11
0
'''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[Any] = { "ut/deta": "http...
28
'''simple docstring''' import argparse from collections import OrderedDict from pathlib import Path import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision.transforms import functional as F from transformers import DetrImageProcessor, TableTransformerConfi...
28
1
"""simple docstring""" import argparse import json import logging import os import sys from unittest.mock import patch from transformers.testing_utils import TestCasePlus, get_gpu_count, slow lowerCamelCase_ = [ os.path.join(os.path.dirname(__file__), dirname) for dirname in [ '''te...
353
"""simple docstring""" from typing import Dict, List, Optional, Tuple, 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, ...
253
0
def _lowerCAmelCase ( __lowerCAmelCase = 10**12 ) -> int: """simple docstring""" snake_case__ : List[str] = 1 snake_case__ : Optional[Any] = 0 snake_case__ : Union[str, Any] = 1 snake_case__ : Union[str, Any] = ...
230
A__ = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] A__ = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] A__ = { 0: '''Sunday''', 1: '''Monday''', 2: '''Tuesday''', 3: '''Wednesday''', 4: '''Thursday''', 5: '''Friday''', 6: '''Saturday''', } def _...
230
1
"""simple docstring""" from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar A_ = TypeVar('''KEY''') A_ = TypeVar('''VAL''') @dataclass(frozen=UpperCamelCase , slots=UpperCamelCase ) class __S...
296
"""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 A_ = logging.get_logge...
296
1
"""simple docstring""" import argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() _lowercase = logging.get_logger(__name_...
74
import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def A ( _lowercase ): if "model" in orig_key: SCREAMING_SNAKE_CASE : int = orig_key.replace('''model.''' , '''''' ) if "norm1" in orig_key: SCREAMING...
182
0
"""simple docstring""" import math import unittest from transformers import BioGptConfig, 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_...
357
"""simple docstring""" def snake_case__ ( __lowerCamelCase : int , __lowerCamelCase : int ): """simple docstring""" return int((input_a, input_a).count(0 ) != 0 ) def snake_case__ ( ): """simple docstring""" assert nand_gate(0 , 0 ...
272
0
"""simple docstring""" import tempfile import unittest from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from transformers.testing_utils import ( is_torch_available, require_optimum, require_torch, slow, ) if is_torch_available(): import torch @require_torch @require_optimum @slow ...
132
import inspect from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch import torch.utils.checkpoint from ...models import UNetaDModel, VQModel from ...schedulers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteSc...
11
0
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case__ = logging.get_logger(__name__) snake_case__ = { 'naver-clova-ix/donut-base': 'https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json', # See all...
352
import argparse import requests import torch from PIL import Image from torchvision.transforms import Compose, Normalize, Resize, ToTensor from transformers import SwinaSRConfig, SwinaSRForImageSuperResolution, SwinaSRImageProcessor def _a ( lowerCamelCase: List[str] ) -> ...
250
0
def A_ ( a ): """simple docstring""" return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('Program to check whether a number is a Perfect number or not...') lowerCAmelCase : Dict = ...
253
from jiwer import compute_measures import datasets lowerCAmelCase : Tuple = '\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From WER and RIL to MER and WIL: improved evaluation...
253
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, Efficien...
356
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowercase = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_xlm""": ["""XLMT...
35
0