code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def _a ( __UpperCamelCase : Optional[int] ): lowerCAm...
233
def __lowerCamelCase ( __a :int , __a :int ) -> Optional[Any]: """simple docstring""" if b == 0: return 1 if (b % 2) == 0: return actual_power(__a , int(b / 2 ) ) * actual_power(__a , int(b / 2 ) ) else: ...
176
0
import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class _lowe...
715
import os import time import numpy as np import onnxruntime as ort a_ = "1" a_ = "0" a_ = "1" a_ = ort.SessionOptions() a_ = ort.GraphOptimizationLevel.ORT_DISABLE_ALL print("Create inference session...") a_ = ["TensorrtExecutionProvider", "CUDAExecutionProvider"...
375
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __UpperCamelCase : int = { '''configuration_data2vec_audio''': ['''DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Data2Vec...
4
from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import Co...
304
0
"""simple docstring""" def A_ ( __UpperCamelCase : str ): lowercase : Any = 0 for ch in input_str: lowercase : str = ord(__UpperCamelCase ) lowercase : str = pow(2 , __UpperCamelCase ) # If we alrea...
709
"""simple docstring""" def A_ ( __UpperCamelCase : str , __UpperCamelCase : str ): lowercase = len(__UpperCamelCase ) lowercase = [] for i in range(len(__UpperCamelCase ) - pat_len + 1 ): lowercase = True ...
396
0
'''simple docstring''' import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_available, is_tf_available, ...
614
'''simple docstring''' import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoModelFo...
614
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 ...
713
"""simple docstring""" import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets lowerCAmelCase : List[Any] = """\ @inproceedings{popovic-2015-chrf, title = \"chr{F}: character n-gram {F}-score for automatic {MT} evaluation\", author = \"...
533
0
def _snake_case ( ): return [list(range(1000 - i , -1000 - i , -1 ) ) for i in range(1000 )] _lowerCAmelCase = generate_large_matrix() _lowerCAmelCase = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [-1, -1, -2, -3]], [[3, 2], [1, 0]], [[7, 7, 6]], ...
10
import math from typing import Dict, Iterable, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDAR...
10
1
'''simple docstring''' from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration lowerCAmelCase__ = HfArgumentParser(InitializationArguments) lowerCAmelCase__ = parser.parse_args() # Load codepar...
624
'''simple docstring''' from argparse import ArgumentParser from . import BaseTransformersCLICommand def _A ( A__ ): """simple docstring""" return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) class lowercase_ (lowerCa...
624
1
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision f...
650
"""simple docstring""" from math import ceil, sqrt def SCREAMING_SNAKE_CASE_ ( snake_case : int = 1_000_000 )-> int: _lowerCamelCase = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: _lowe...
650
1
import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...test_tokenization_c...
704
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowercase : Any = logging.get_logger(__name__) lowercase : Optional[int] = { """SenseTime/deformable-detr""": """https://huggingface.co/sensetime/deformabl...
392
0
'''simple docstring''' from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __snake_case ( __SCREAMING_SNAKE_CASE): """simple docstring""" lowercase = ['image_processor', 'tokenizer'] lo...
275
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase_ : Any = {'''configuration_vit_msn''': ['''VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ViTMSNConfig''']} try: if not is_torch...
572
0
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. 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/LICE...
702
from collections.abc import Callable import numpy as np def A ( lowercase__ : Callable , lowercase__ : float , lowercase__ : float , lowercase__ : float , lowercase__ : float ) -> np.ndarray: UpperCamelCase__ :List[str] = int...
383
0
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConfig, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaForCTC, WavaVecaForPreTraining, WavaVecaProcessor, logging, ) from transformers.model...
9
"""simple docstring""" from manim import * class lowercase_ ( __lowerCAmelCase ): '''simple docstring''' def lowerCAmelCase_ ( self : Union[str, Any] ): _A = Rectangle(height=0.5 , width=0.5 ) _A = Rectangle(height=0.46 , w...
7
0
"""simple docstring""" from __future__ import annotations def _snake_case ( snake_case__ : list[int] ): if len(snake_case__ ) == 0: return array A , A = min(snake_case__ ), max(snake_case__ ) # Compute the variables A = _max - _min + 1 A , ...
719
"""simple docstring""" from argparse import ArgumentParser from . import BaseTransformersCLICommand def _snake_case ( snake_case__ : Optional[int] ): return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) class lowerCAmelCa...
22
0
from copy import deepcopy import torch import torch.nn.functional as F from torch.optim import AdamW from torch.optim.lr_scheduler import LambdaLR from torch.utils.data import DataLoader from accelerate.accelerator import Accelerator from accelerate.state import GradientState from accelerate.test_utils ...
693
from functools import lru_cache def _A ( __snake_case :int ) -> set: """simple docstring""" __SCREAMING_SNAKE_CASE = 2 __SCREAMING_SNAKE_CASE = set() while i * i <= n: if n % i: i += 1 else: n //= i ...
693
1
'''simple docstring''' from math import ceil, sqrt def _SCREAMING_SNAKE_CASE ( __snake_case = 1_0_0_0_0_0_0 ) -> int: _UpperCAmelCase = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: _Uppe...
719
from __future__ import annotations import unittest from transformers import BlenderbotSmallConfig, BlenderbotSmallTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import Confi...
402
0
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaImgPipeline, ...
256
def _UpperCamelCase ( lowercase__ , lowercase__ ): __SCREAMING_SNAKE_CASE : str = len(lowercase__ ) __SCREAMING_SNAKE_CASE : Optional[int] = len(lowercase__ ) __SCREAMING_SNAKE_CASE : List[str] = [[False for _ in range(m + 1 )] for _ in ...
696
0
import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class UpperCamelCase_ ( A ): '''simple docstring'''...
413
import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from transform...
413
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_NA...
52
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version('>=', '4.25.0')): raise OptionalDepend...
311
0
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision...
498
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ = logging.get_logger(__name__) A_ = { '''weiweishi/roc-bert-base-zh''': '''https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json''', } class __S...
498
1
'''simple docstring''' import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokenizer from transformers.model...
107
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMix...
695
0
from dataclasses import dataclass, field from typing import Optional @dataclass class __SCREAMING_SNAKE_CASE : SCREAMING_SNAKE_CASE__ =field( default="""codeparrot/codeparrot""" , metadata={"""help""": """Model name or path of model to be trained."""} ) SCREAMING_SNAKE_CASE...
214
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging _snake_case : Any = logging.get_logger(__name__) class __SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): SCREAMING_SNAKE_CASE__ ="""encoder-decoder""" SCREAMING...
214
1
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if i...
426
"""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, EulerAncestralDiscreteSche...
426
1
def lowerCAmelCase__ ( UpperCamelCase_ : int )-> bool: if num < 0: return False A__ = num A__ = 0 while num > 0: A__ = rev_num * 1_0 + (num % 1_0) num //= 1_0 return num_copy == rev_num if __name__ == "__main__": import doctest ...
526
def lowerCAmelCase__ ( UpperCamelCase_ : str , UpperCamelCase_ : str )-> float: def get_matched_characters(UpperCamelCase_ : str , UpperCamelCase_ : str ) -> str: A__ = [] A__ = min(len(_stra ) , len(_stra ) ) // 2 ...
526
1
'''simple docstring''' def _UpperCamelCase ( __UpperCamelCase ) -> List[str]: if length <= 0 or not isinstance(lowercase_ ,lowercase_ ): raise ValueError('Length must be a positive integer.' ) return [n * (2 * n - 1) for n in range(lowercase_ )] if __name__ == "__main__": ...
42
'''simple docstring''' import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from transformers impo...
588
0
'''simple docstring''' from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from ....
398
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. 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/...
398
1
'''simple docstring''' import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __lowerCamelCase : Tuple = logging.get_logger(__name__) class UpperCAmelCase ( snake_case_ ): UpperCA...
310
'''simple docstring''' import argparse import gc import json import os import re import torch from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedTokenizerFast, RwkvConfig from transformers.modeling_utils import WEIGHTS_INDEX_NAME, shard_check...
330
0
import copy import inspect import unittest from transformers import PretrainedConfig, SwiftFormerConfig 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...
182
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case : Optional[int] = logging.get_logger(__name__) snake_case : Union[str, Any] = { 'facebook/data...
182
1
"""simple docstring""" import operator def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase = False , __UpperCAmelCase = None ) -> list: lowerCAmelCase__ : int = operator.lt if reverse else operator.gt lowerCAmelCase__ : int = sol...
299
'''simple docstring''' import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTra...
421
0
"""simple docstring""" def a__ ( lowerCAmelCase__ = 1000 ): UpperCAmelCase_ = 2**power UpperCAmelCase_ = str(_UpperCamelCase ) UpperCAmelCase_ = list(_UpperCamelCase ) UpperCAmelCase_ = 0 for i in list_n...
720
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase = { """configuration_swinv2""": ["""SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Swinv2Config"""], } try: if not is_to...
14
0
import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_processor import AttnAddedKVPro...
285
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCamelCase ( SCREAMING_SNAKE_CASE ): __UpperCamelCase =["image_processor", "tokenizer"] __UpperCamelCase ="CLIPImageProcessor" __UpperCamelCase =("CLIPTokenizer"...
439
0
'''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 ...
700
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { 'configuration_jukebox': [ 'JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP', 'JukeboxConfig', 'JukeboxPriorConfig', 'JukeboxV...
83
0
from collections.abc import Callable def __a ( A__ : Callable[[float], float] , A__ : float , A__ : float ): SCREAMING_SNAKE_CASE = a SCREAMING_SNAKE_CASE = b if function(A__ ) == 0: # one of the a or b is a root for the function ...
16
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer __A : str = logging.get_logger(__name__) _...
16
1
'''simple docstring''' import json import os import re import unicodedata from json.encoder import INFINITY from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import regex from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEnco...
720
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCamelCase : Any = { "configuration_informer": [ "INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", ...
514
0
from typing import Any class lowerCamelCase__ : def __init__( self : List[Any] , lowercase__ : Any ): _lowerCAmelCase = data _lowerCAmelCase = None def __repr__( self : List[str] ): return f'Node({self.data})' ...
192
import argparse from collections import defaultdict import yaml _lowercase: List[Any] = '''docs/source/en/_toctree.yml''' def _lowerCamelCase ( snake_case ): _lowerCAmelCase = defaultdict(snake_case ) _lowerCAmelCase = [] _lowerCAmelCase = ...
192
1
import copy import re class UpperCamelCase: snake_case_ : Tuple = """hp""" snake_case_ : List[Any] = {} snake_case_ : Any = None @classmethod def SCREAMING_SNAKE_CASE_ ( cls : Optional[int] , SCREAMING_...
701
import os from datetime import datetime as dt from github import Github A : Union[str, Any] = [ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def _lowe...
473
0
'''simple docstring''' import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) __A : int = logging.getLogger(__name__) if __name__ =...
394
'''simple docstring''' import numpy class _UpperCamelCase : '''simple docstring''' def __init__( self , _a , _a ): """simple docstring""" a__ = input_array # Random initial weights are assigned where ...
394
1
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig lowerCAmelCase : int =logging.get_logger(__name__) lowerCAmelCase : Any ={ 'Intel/dpt-large': 'https://huggingface.co/Intel/dpt-large/resolve...
693
def _UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ,SCREAMING_SNAKE_CASE__ ): '''simple docstring''' return int(input_a == input_a == 0 ) def _UpperCAmelCase ( ): '''simple docstring''' print("""Truth Table of NOR Gat...
693
1
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_CHECKING: from ... impor...
105
# Copyright 2021 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...
318
0
from dataclasses import asdict, dataclass from typing import Optional from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) # TODO Update this UpperCamelCase = { 'facebook/esm-1b': 'https://huggingface.co/facebook/esm-1b/resolve...
704
def _A ( lowerCAmelCase_ : int = 100_0000 ): """simple docstring""" lowerCAmelCase__ = [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...
125
0
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class SCREAMING_SNA...
685
'''simple docstring''' import math def __UpperCAmelCase (lowercase__ ) -> list: '''simple docstring''' a_ = [True] * n a_ = False a_ = False a_ = True for i in range(3 ,int(n**0.5 + 1 ) ,2 ): ...
685
1
'''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_mod...
506
'''simple docstring''' import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration A__: Dict = 5_0000 A__: Optional[int] = 5000 A__ , A__: Optional[int] = os.path.split(__file__) A__: ...
506
1
"""simple docstring""" import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertTok...
636
"""simple docstring""" import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor A : Optional[Any] = logging.get_logger(__name__) class _UpperCamelCase ( lowerCAmelCase__ ): '''simple docstring''' def __init__( self ...
636
1
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Tuple = logging.get_logger(__name__) _UpperCAmelCase : Any = { """microsoft/unispeech-large-1500h-cv""": (...
474
'''simple docstring''' from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable _UpperCAmelCase : str = { """configuration_gpt_neox_japanese""": ["""GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MA...
474
1
"""simple docstring""" import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class A__ ( nn.Module ): '''simple docstring''' SCREAM...
293
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow if is_torch_available(): import torch from transformers import XLMRobertaModel @require_sentencepiece @require_tokenizers @require_torch class ...
108
0
'''simple docstring''' 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 __snake_cas...
718
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mobilebert import MobileBertTokenizer A_ : Any = logging.get_logger(__nam...
419
0
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def a__ (__lowercase :int ) -> str: _A : Any = int(number**0.5 ) return number == sq * sq def a__ (__lowercase :int , __lowercase :int , __l...
206
a_ = { 0: """0""", 1: """1""", 2: """2""", 3: """3""", 4: """4""", 5: """5""", 6: """6""", 7: """7""", 8: """8""", 9: """9""", 10: """a""", 11: """b""", 12: """c""", 13: """d""", 14: """e""", 15: """f""", } def a__ ( _UpperCam...
175
0
'''simple docstring''' import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.util...
702
import argparse import pytorch_lightning as pl import torch from torch import nn from transformers import LongformerForQuestionAnswering, LongformerModel class __lowerCamelCase ( pl.LightningModule ): """simple docstring""" def __init__( self , UpperCAmelCase ) ...
601
0
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class lowercase_ ( unittest.TestCas...
7
import dataclasses import json import warnings from dataclasses import dataclass, field from time import time from typing import List from ..utils import logging lowercase : List[str] = logging.get_logger(__name__) def snake_case__ ( lowerCamelCase_=None , lowe...
542
0
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin UpperCamelCase__ = '''\nHugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot app targeted a...
705
import qiskit def UpperCAmelCase__ ( _A , _A ): """simple docstring""" a_ = qiskit.Aer.get_backend('''aer_simulator''' ) a_ = qiskit.QuantumCircuit(4 , 2 ) # encode inputs in qubits 0 and 1 if bita == 1: qc_ha.x(...
143
0
'''simple docstring''' import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __snake_...
577
'''simple docstring''' __snake_case: Tuple = "Tobias Carryer" from time import time class _UpperCAmelCase : """simple docstring""" def __init__( self , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_=int(time() ) ): # noqa: B00...
577
1
import unittest import numpy as np from datasets import load_dataset 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 ...
387
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase = logging.get_logger(__name__) UpperCamelCase = { 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at https://h...
387
1
from typing import List, Union import numpy as np from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, logging from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline lowercase_ = logging.get_logger(__name__) class _UpperCamelCase ( a__ ...
562
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines...
90
0
"""simple docstring""" from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class __magic_name__ : '''simple docstring''' __UpperCamelCase = 42 __UpperCamelCase =...
533
"""simple docstring""" from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCAmelCase : List[Any] = {"""UserAgent""": UserAgent().random} def a__ ( snake_case__ ) -> dict: ...
533
1
'''simple docstring''' import os from math import logaa def _A ( A__ = "base_exp.txt" ): """simple docstring""" __lowercase = 0 __lowercase = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(A__ ) , A__ ) ) ): __lowercase , __lowercase...
41
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename lowercase : Optional[Any] = """http://www.mocksite.com/...
336
0
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, _interl...
704
import argparse from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_controlnet_from_original_ckpt if __name__ == "__main__": __magic_name__ = argparse.ArgumentParser() parser.add_argument( '''--checkpoint_path''', default=None, type=str, required=True, help=''...
530
0
'''simple docstring''' import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets impo...
531
'''simple docstring''' import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis_float32 (there's also the fix_lavis branch) # also note: to convert Vicuna checkpoin...
531
1
'''simple docstring''' from __future__ import annotations import time lowercase__ = list[tuple[int, int]] lowercase__ = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], ...
695
'''simple docstring''' # Copyright 2021 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-...
695
1
'''simple docstring''' class SCREAMING_SNAKE_CASE__ : def __init__( self ): """simple docstring""" SCREAMING_SNAKE_CASE_ : Optional[Any] = {} def __lowerCamelCase ( self ): """...
421
'''simple docstring''' class lowerCamelCase_ : def __init__( self : str , _A : Union[str, Any] , _A : Optional[int] ): '''simple docstring''' UpperCAmelCase__ : Optional[Any] = name ...
75
0
from __future__ import annotations def _a ( __SCREAMING_SNAKE_CASE : list[list[int]] ): """simple docstring""" _lowerCAmelCase = len(_lowerCamelCase ) # We need to create solution object to save path. _lowerCAmelCase = [[0 for _ in range(_lowerCamelCase )...
704
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 _a ( __SCREAMING_SNAKE_CASE : Dict[str, torch.Tensor] ): """simple docstring""" _lowerCAmelCase = [] _lowerCAmelCase ...
585
0
import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate import Accelerator from accelerate.test...
611
class a : def __init__( self : Union[str, Any] , snake_case__ : str ): """simple docstring""" __lowerCAmelCase = arr.split("," ) def UpperCAmelCase__ ( self : str ): """simple docstring""" __lowerCAmelCase ...
611
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __UpperCAmelCase : Union[str, Any] = { "configuration_chinese_clip": [ "CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "ChineseCLIPConfig...
155
import json import os import unittest from transformers.models.roc_bert.tokenization_roc_bert import ( VOCAB_FILES_NAMES, RoCBertBasicTokenizer, RoCBertTokenizer, RoCBertWordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.testing_utils import require_...
155
1
'''simple docstring''' import unittest from diffusers import FlaxAutoencoderKL from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): import jax @require_flax class lowerCam...
390
import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging a__ = """\ """ a__ = """ Perplexity (PPL) is one of the most common metrics for evaluating language mo...
477
0
import unittest from transformers import GPTNeoXJapaneseConfig, is_torch_available from transformers.models.gpt_neox_japanese.tokenization_gpt_neox_japanese import GPTNeoXJapaneseTokenizer from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester fr...
636
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, RegNetYaagf, RegNetYaaagf ...
636
1
import qiskit def lowerCamelCase_ ( UpperCamelCase__ : int , UpperCamelCase__ : int ) -> qiskit.result.counts.Counts: """simple docstring""" __lowerCamelCase = qiskit.Aer.get_backend('aer_simulator' ) # Create a Quantum ...
469
def lowerCamelCase_ ( UpperCamelCase__ : str , UpperCamelCase__ : int ) -> list: """simple docstring""" __lowerCamelCase = word.split() def justify(UpperCamelCase__ : list , UpperCamelCase__ : int , UpperCamelCase__...
469
1
'''simple docstring''' import argparse import os import re lowercase : str = "src/diffusers" # Pattern that looks at the indentation in a line. lowercase : str = re.compile(r"^(\s*)\S") # Pattern that matches `"key":" and puts `key` in group 0. lowercase : str = ...
542
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler...
542
1
"""simple docstring""" import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transf...
65
"""simple docstring""" import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor __snake_case : List[Any] = logging.get_logger(__name__) class UpperCamelCase ( a ): """simple docstring...
571
0
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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 requi...
716
from .constants import ( MODEL_NAME, OPTIMIZER_NAME, RNG_STATE_NAME, SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, SCALER_NAME, SCHEDULER_NAME, TORCH_LAUNCH_PARAMS, WEIGHTS_INDEX_NAME, WEIGHTS_NAME, ) from .dataclasses import ( BnbQuantizationConfig, C...
198
0
'''simple docstring''' 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 ...
42
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def UpperCamelCase_( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ) -> Optional[int]: # Initialise ...
89
0
def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase ): __snake_case : List[Any] = [1] for i in range(2 , SCREAMING_SNAKE_CASE_ ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" ...
702
def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase ): return int((input_a, input_a).count(0 ) == 0 ) def lowerCAmelCase_ ( ): assert and_gate(0 , 0 ) == 0 assert and_gate(0 , 1 ) == 0 assert and_gate(1 , 0 ...
203
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase : str = logging.get_logger(__name__) UpperCamelCase : str = { 'facebook/dpr-ctx_encoder-single-nq-base': ( 'https://huggingface.co/facebook/dpr-ct...
50
'''simple docstring''' def A__ ( ): return [list(range(1000 - i , -1000 - i , -1 ) ) for i in range(1000 )] UpperCamelCase : Dict = generate_large_matrix() UpperCamelCase : Any = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [-1, -1, -...
50
1
"""simple docstring""" from __future__ import annotations from collections.abc import Callable _a : Optional[int] = list[list[float | int]] def SCREAMING_SNAKE_CASE ( _lowerCamelCase : Matrix ,_lowerCamelCase : Matrix ) -> Matrix: _lowerCAmelCase : int = len(_lowerCam...
711
"""simple docstring""" from random import shuffle import tensorflow as tf from numpy import array def SCREAMING_SNAKE_CASE ( _lowerCamelCase : Union[str, Any] ,_lowerCamelCase : Tuple ) -> Dict: _lowerCAmelCase : List[str] = int(_lowerCamelCase ) assert noofclusters < len(...
663
0
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> float: __UpperCAmelCase = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series return total def _lowerCAmelCase ( ...
126
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def _lowerCAmelCase ( _lowerCAmelCase="ro" , _lowerCAmelCase="en" , _lowerCAmelCase="wmt16" , _lowerCAmelCase=None )-> None: try: import datasets except (ModuleNotFoundError, Imp...
126
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor __SCREAMING_SNAKE_CASE :Union[str, Any] = logging.get_logger(__name__) class A_ ( lowerCAmelCase_ ): def __init__( self : in...
119
'''simple docstring''' import re from filelock import FileLock try: import nltk __SCREAMING_SNAKE_CASE :int = True except (ImportError, ModuleNotFoundError): __SCREAMING_SNAKE_CASE :Optional[int] = False if NLTK_AVAILABLE: with FileLock('''.lock''') as lock: nltk.d...
119
1
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_to...
34
'''simple docstring''' def __lowerCAmelCase ( a_ = 1 , a_ = 1000 ) -> int: '''simple docstring''' SCREAMING_SNAKE_CASE : Tuple = 1 SCREAMING_SNAKE_CASE : Optional[int] = 0 for div...
251
0
'''simple docstring''' from __future__ import annotations def _lowercase ( lowerCamelCase__ : float, lowerCamelCase__ : float, lowerCamelCase__ : float, ): if (electron_conc, hole_conc, intrinsic_conc).count(0 ) != 1: raise ValueError("You cannot supply more or less than 2 val...
691
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __snake_case : int = { "configuration_bloom": ["BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP", "BloomConfig", "BloomOnnxConfig"],...
691
1
# Copyright 2021 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 applicabl...
216
import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformers.utils import logging log...
216
1
'''simple docstring''' import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets _UpperCAmelCase : Optional[int] = datasets.logging.get_logger(__name__) _UpperCAmelCase : List[Any] =...
721
'''simple docstring''' from __future__ import annotations _UpperCAmelCase : str = 10 def UpperCamelCase ( lowercase_ : list[int] ) -> list[int]: '''simple docstring''' lowercase =1 lowercase =max(lowercase_ ) while placement <= max_digit: # declare...
145
0
import logging import os import quant_trainer import torch from torch.utils.data import DataLoader from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput __magic_name__ = logging.getLogger(__name__) if is_torch_tpu_available(check_device=False): ...
276
import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transformers from transformers import ( AutoConfig, Auto...
276
1
"""simple docstring""" import inspect import unittest from transformers import MobileViTConfig 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_configuration_common import ...
366
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_ava...
366
1
# Copyright 2021 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 ap...
183
def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ = len(lowerCamelCase_ ) lowercase__ = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )] # for each arr value, a sum of zero(0) can be formed by not...
183
1
"""simple docstring""" from __future__ import annotations from typing import Any class __A (snake_case__): '''simple docstring''' pass class __A : '''simple docstring''' def __init__( self : str , UpperCAmelCase_ : A...
2
"""simple docstring""" from __future__ import annotations from collections import deque class __A : '''simple docstring''' def __init__( self : List[Any] , UpperCAmelCase_ : list[str] ) ->List[Any]: """simple docstring""" ...
2
1
"""simple docstring""" import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig _UpperCamelCase = { 'fa...
179
"""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, ...
179
1
import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transformers from transformers import ( AutoConfig, A...
702
import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class a_ ( _snake_case ): UpperCamelCase__ : str ="" UpperCamelCase__ : str =( None # protocol pas...
561
0
import math import sys def lowerCAmelCase__(__snake_case ) -> str: '''simple docstring''' lowerCamelCase__ = '''''' try: with open(__snake_case ,'''rb''' ) as binary_file: lowerCamelCase__ = binary_file.read() for dat in data: lower...
481
_a = "\n# Installazione di Transformers\n! pip install transformers datasets\n# Per installare dalla fonte invece dell'ultima versione rilasciata, commenta il comando sopra e\n# rimuovi la modalità commento al comando seguente.\n# ! pip install git+https://github.com/huggingface/transformers.git\n" _a ...
481
1
import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformers.utils import logging ...
702
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor UpperCAmelCase : List[Any] = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" def __init__( self , *_A , **_A ): ...
77
0
'''simple docstring''' from typing import List import numpy as np def __snake_case ( lowercase : Any ): snake_case_ = {key: len(__UpperCamelCase ) for key, value in gen_kwargs.items() if isinstance(__UpperCamelCase , __UpperCamelCase )} if len(set(lists_lengths.values(...
508
"""simple docstring""" import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer a_ = lo...
76
0
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin SCREAMING_SNAKE_CASE = '\nHugging Face was founded in 2016 by French entrepreneurs Clément Delangue, Julien Chaumond, and Thomas Wolf originally as a company that developed a chatbot ap...
186
import os from collections.abc import Iterator def _lowerCamelCase ( __A : str = "." ) -> Iterator[str]: for dir_path, dir_names, filenames in os.walk(__A ): _UpperCAmelCase : List[Any] = [d for d in dir_names if d != '''scripts''' and d[0] not ...
186
1
import argparse import json import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import AutoImageProcessor, SwinConfig, SwinForImageClassification def a_ ( _A ) -> Optional[Any]: """simpl...
328
# Copyright 2023 The HuggingFace Inc. 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 # # U...
328
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __SCREAMING_SNAKE_CASE = { 'configuration_upernet': ['UperNetConfig'], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDepend...
153
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor __SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class lowerCAmelCase_ ( __A ): '''simple docstring''' def __init__( self , *__UpperCAmelCase , **_...
153
1
"""simple docstring""" class lowercase__ : # Public class to implement a graph def __init__( self , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE) -> None: _lowerCamelCase : str = row _lowerCamelCase : Dict = col ...
88
"""simple docstring""" from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_avai...
34
0
"""simple docstring""" import importlib import os import sys # This is required to make the module import works (when the python process is running from the root of the repo) sys.path.append('.') def _a ( _SCREAMING_SNAKE_CASE ) -> Any: snake_case_ = test_file.split(...
707
"""simple docstring""" import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_visio...
2
0
def UpperCAmelCase_ ( UpperCAmelCase__ = 4_0_0_0_0_0_0 ): lowercase_ = [0, 1] lowercase_ = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: break i += 1 lowercase_ = 0 for j in range(l...
412
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggin...
412
1
import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE_:str = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_:int = { """vocab_file""": """vocab.json""", """tokenizer_config_...
520
from __future__ import annotations def __UpperCamelCase ( _lowerCAmelCase , _lowerCAmelCase = None , _lowerCAmelCase = None , _lowerCAmelCase = False , ) -> tuple[int, float, str]: """simple docstring""" A : str = cipher_alphabet or [chr(_lowerCAmelCase ) fo...
520
1
'''simple docstring''' print((lambda quine: quine % quine)("print((lambda quine: quine %% quine)(%r))"))
316
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCamelCase : Dict ={"configuration_focalnet": ["FOCALNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "FocalNetConfig"]} t...
316
1
'''simple docstring''' import fire from utils import calculate_rouge, save_json def lowerCAmelCase( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase=None , **__lowerCamelCase ): __a = [x.strip() for x in open(__lowerCamelCase ).readlines()] _...
705
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 AutoImageProcess...
246
0
lowerCamelCase_ = tuple[float, float, float] lowerCamelCase_ = tuple[float, float, float] def lowerCamelCase ( a_ , a_ ) -> Union[str, Any]: lowerCAmelCase_ = end_pointa[0] - end_pointa[0] lowerCAmelCase_ = end_pointa[1] - end_pointa[1] ...
318
"""simple docstring""" import math import flax.linen as nn import jax.numpy as jnp def __UpperCAmelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase = 1 , __UpperCamelCase = 1 , __UpperCamelCase = 1.0e4 , __UpperCamelCase = False , __UpperCame...
76
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils impor...
612
"""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_mo...
612
1
from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration snake_case = HfArgumentParser(InitializationArguments) snake_case = parser.parse_args() # Load codeparrot tokenizer ...
67
"""simple docstring""" def lowercase__ ( snake_case_ :dict ): __UpperCAmelCase = set() # To detect a back edge, keep track of vertices currently in the recursion stack __UpperCAmelCase = set() return any( node not in visited and depth_first_search(snake_cas...
49
0
'''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 UpperCamelCase : Optional[int] = logging.get_logger(__name__) def SCREAMING_SNAKE_CASE__ ( snake...
716
'''simple docstring''' from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin ...
610
0