code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ = logging.get_logger(__name__) lowercase__ = { '''s-JoL/Open-Llama-V1''': '''https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json''', } class ...
508
"""simple docstring""" import numpy as np import datasets a_ = '\nCompute the Mahalanobis Distance\n\nMahalonobis distance is the distance between a point and a distribution.\nAnd not between two distinct points. It is effectively a multivariate equivalent of the Euclidean distan...
76
0
'''simple docstring''' from typing import Dict from .base import GenericTensor, Pipeline class _lowercase( _lowerCamelCase ): """simple docstring""" def snake_case ( self: int ,a: int=None ,a: Optional[int]=None ,a: Union[str, Any]=None ,**a: ...
396
"""simple docstring""" a_ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' def __UpperCAmelCase ( __UpperCamelCase ): # Make sure the supplied data is a bytes-like object if not isinstance(__UpperCamelCase , __UpperCamelCase ): ...
76
0
import math def a_ ( SCREAMING_SNAKE_CASE__ : Dict , SCREAMING_SNAKE_CASE__ : Union[str, Any] = 0 , SCREAMING_SNAKE_CASE__ : Union[str, Any] = 0 ): '''simple docstring''' _lowerCamelCase : List[Any] =end or len(__UpperCamelCase ) for...
464
"""simple docstring""" import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a_ = logging.get_logger(__name__) a_ = { 'vocab_file': 'vocab.json', ...
76
0
"""simple docstring""" import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, UNetaDConditionMod...
115
"""simple docstring""" import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor a_ = logging.get_logger(__name__) class UpperCAmelCase_ ( snake_case ): def __init__( self , *UpperCamelCase_ , ...
76
0
import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __lowercase = logging.get_logger(__name__) class _lowercase ( __lowerCamelCase ): def __init__( self : List[str] , *lowerCamelCase__ : Dict , **lowerCamelCase__ :...
203
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging a_ = logging.get_logger(__name__) a...
76
0
from collections import deque from .hash_table import HashTable class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__( self : Union[str, Any] ,*A : str ,**A : Optional[int] ): super().__init__(*UpperCamelCase_ ,**UpperCamel...
55
"""simple docstring""" 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 a_ = logging.getLogger(__name__) if...
76
0
from __future__ import annotations import math def lowerCamelCase ( a_ ) -> Optional[int]: if num <= 0: lowerCAmelCase_ = F'''{num}: Invalid input, please enter a positive integer.''' raise ValueError(__UpperCamelCase ) l...
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 collections import importlib.util import os import re from pathlib import Path _lowerCAmelCase : Optional[Any] = "src/transformers" # Matches is_xxx_available() _lowerCAmelCase : List[Any] = re.compile(r"is\_([a-z_]*)_available()") # Catches a one-li...
289
"""simple docstring""" import os import sys a_ = os.path.join(os.path.dirname(__file__), 'src') sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, Au...
76
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : Optional[Any] = logging.get_logger(__name__) UpperCAmelCase : Dict = { 'uw-madison/mra-base-512-4': 'https://huggingface.co/uw-madison/mra-base-512-4/resolve/main/...
627
"""simple docstring""" from math import pi, sqrt, tan def __UpperCAmelCase ( __UpperCamelCase ): if side_length < 0: raise ValueError('''surface_area_cube() only accepts non-negative values''' ) return 6 * side_length**2 def __UpperCAmelCase ...
76
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCamelCase_ : Optional[Any] = { '''configuration_encodec''': [ '''ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP''', ''...
185
"""simple docstring""" from __future__ import annotations def __UpperCAmelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ): # noqa: E741 while r - l > 1: __lowercase : int = (l + r) // 2 if v[m] >= k...
76
0
import os import re import sys import traceback import warnings from pathlib import Path from typing import Dict, Optional, Union from uuid import uuida from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami from huggingface_hub.file_download import REGEX_COMMIT_HASH from huggingface_h...
321
"""simple docstring""" from __future__ import annotations def __UpperCAmelCase ( __UpperCamelCase = 4 ): __lowercase : Dict = abs(__UpperCamelCase ) or 4 return [[1 + x + y * row_size for x in range(__UpperCamelCase )] for y in range(__UpperCamelCase )]...
76
0
'''simple docstring''' import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokeni...
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
'''simple docstring''' def __snake_case ( lowerCAmelCase : Dict , lowerCAmelCase : Optional[Any] ): print('\nThe shortest path matrix using Floyd Warshall algorithm\n' ) for i in range(__UpperCamelCase ): for j in range(__UpperCamelCase ): if dist[i][j] != floa...
396
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor a_ = logging.get_logger(__name__) class UpperCAmelCase_ ( snake_case ): def __init__( self , *UpperCamelCase_ , **UpperCam...
76
0
def a_ ( SCREAMING_SNAKE_CASE__ : Optional[Any] ): '''simple docstring''' if not isinstance(__UpperCamelCase , __UpperCamelCase ) or number < 0: raise ValueError('Input must be a non-negative integer' ) _lowerCamelCase : Optional[int] ...
464
"""simple docstring""" import argparse import os import torch from transformers import FlavaConfig, FlavaForPreTraining from transformers.models.flava.convert_dalle_to_flava_codebook import convert_dalle_checkpoint def __UpperCAmelCase ( __UpperCamelCase ): # encod...
76
0
"""simple docstring""" import json import os from ...utils.constants import SAGEMAKER_PARALLEL_EC2_INSTANCES, TORCH_DYNAMO_MODES from ...utils.dataclasses import ComputeEnvironment, SageMakerDistributedType from ...utils.imports import is_botoa_available from .config_args import SageMakerConfig from .config_util...
115
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, ...
76
0
def _lowerCamelCase ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): '''simple docstring''' A_ = len(__UpperCamelCase ) A_ = len(__UpperCamelCase ) A_ = [[False for _ in range(m + 1 )] for _ in range(n + 1 )] A_ ...
203
"""simple docstring""" def __UpperCAmelCase ( __UpperCamelCase , __UpperCamelCase ): if digit_amount > 0: return round(number - int(__UpperCamelCase ) , __UpperCamelCase ) return number - int(__UpperCamelCase ) if __name__ == "__main__": print(decimal_isolate(1....
76
0
from __future__ import annotations from typing import TypedDict class UpperCAmelCase ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' snake_case_ = 42 snake_case_ = 42 def UpperCAmelCase ( a_ ) -> Optional[int]: """simple docstring""...
55
"""simple docstring""" def __UpperCAmelCase ( __UpperCamelCase ): __lowercase : set[int] = set() # To detect a back edge, keep track of vertices currently in the recursion stack __lowercase : set[int] = set() return any( node not in vis...
76
0
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_modeling_co...
318
"""simple docstring""" import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRI...
76
0
"""simple docstring""" def __snake_case ( SCREAMING_SNAKE_CASE__ : Dict ) -> Dict: '''simple docstring''' _UpperCAmelCase : int = '''''' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups...
289
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( HubertConfig, HubertForCTC, HubertModel, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, ...
76
0
'''simple docstring''' import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from trans...
627
"""simple docstring""" a_ = { 'Pillow': 'Pillow<10.0.0', 'accelerate': 'accelerate>=0.20.3', 'av': 'av==9.2.0', 'beautifulsoup4': 'beautifulsoup4', 'black': 'black~=23.1', 'codecarbon': 'codecarbon==1.2.0', 'cookiecutter': 'cookiecutter==1.7.3', 'd...
76
0
'''simple docstring''' import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tens...
185
"""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/...
76
0
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class snake_case ( __snake_case ): """simple docstring""" def __init__( self , *lowerCAmelCase_ , **lowerCAmelCase...
321
"""simple docstring""" import gc import threading import time import psutil import torch class UpperCAmelCase_ : def __init__( self ) -> str: __lowercase : List[Any] = psutil.Process() __lowercase : Any = False def ...
76
0
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __snake_case ( lowercase : Optional[int] ...
508
"""simple docstring""" import numpy as np import datasets a_ = '\nCompute the Mahalanobis Distance\n\nMahalonobis distance is the distance between a point and a distribution.\nAnd not between two distinct points. It is effectively a multivariate equivalent of the Euclidean distan...
76
0
'''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, ) _UpperCamelCase : Any ...
396
"""simple docstring""" a_ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' def __UpperCAmelCase ( __UpperCamelCase ): # Make sure the supplied data is a bytes-like object if not isinstance(__UpperCamelCase , __UpperCamelCase ): ...
76
0
import math import flax.linen as nn import jax.numpy as jnp def a_ ( SCREAMING_SNAKE_CASE__ : Optional[Any] , SCREAMING_SNAKE_CASE__ : str , SCREAMING_SNAKE_CASE__ : List[str] = 1 , SCREAMING_SNAKE_CASE__ : List[Any] = 1 , SCREAMING_SNAKE_CASE__ : str = ...
464
"""simple docstring""" import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a_ = logging.get_logger(__name__) a_ = { 'vocab_file': 'vocab.json', ...
76
0
"""simple docstring""" def A_ (__a , __a ): '''simple docstring''' if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) ** 0.5 if __nam...
115
"""simple docstring""" import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor a_ = logging.get_logger(__name__) class UpperCAmelCase_ ( snake_case ): def __init__( self , *UpperCamelCase_ , ...
76
0
import warnings from ...utils import logging from .image_processing_donut import DonutImageProcessor __lowercase = logging.get_logger(__name__) class _lowercase ( __lowerCamelCase ): def __init__( self : str , *lowerCamelCase__ : int , **lowerCamelCase__ : A...
203
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging a_ = logging.get_logger(__name__) a...
76
0
import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, BertTokenizer, BertTokenizerFast, CTR...
55
"""simple docstring""" 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 a_ = logging.getLogger(__name__) if...
76
0
from ..utils import DummyObject, requires_backends class a_ ( metaclass=a_ ): '''simple docstring''' __a: Dict = ['''torch''', '''transformers''', '''onnx'''] def __init__( self , *lowercase_ , **lo...
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 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]' when switching between checkouts and running tests. _lowerCAmelCase : Any = abspath(join(dirnam...
289
"""simple docstring""" import os import sys a_ = os.path.join(os.path.dirname(__file__), 'src') sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, Au...
76
0
'''simple docstring''' import argparse from collections import defaultdict import yaml UpperCAmelCase : Union[str, Any] = 'docs/source/en/_toctree.yml' def a__ ( a__ ): """simple docstring""" __SCREAMING_SNAKE_CASE = defaultdict(__UpperCamelCase ) __SCREAMIN...
627
"""simple docstring""" from math import pi, sqrt, tan def __UpperCAmelCase ( __UpperCamelCase ): if side_length < 0: raise ValueError('''surface_area_cube() only accepts non-negative values''' ) return 6 * side_length**2 def __UpperCAmelCase ...
76
0
'''simple docstring''' from typing import List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ : Union[str, Any] = logging.get_logger(__name__) UpperCamelCase_ : Any = { '''huggingface/autoformer-tourism-monthly''...
185
"""simple docstring""" from __future__ import annotations def __UpperCAmelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ): # noqa: E741 while r - l > 1: __lowercase : int = (l + r) // 2 if v[m] >= k...
76
0
from ..utils import DummyObject, requires_backends class snake_case ( metaclass=__snake_case ): """simple docstring""" __lowerCAmelCase = ["""note_seq"""] def __init__( self , *lowerCAmelCase_ , **lowerCAmelCase_ ): requires_backends(self , ["note_seq"] ...
321
"""simple docstring""" from __future__ import annotations def __UpperCAmelCase ( __UpperCamelCase = 4 ): __lowercase : Dict = abs(__UpperCamelCase ) or 4 return [[1 + x + y * row_size for x in range(__UpperCamelCase )] for y in range(__UpperCamelCase )]...
76
0
'''simple docstring''' 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, ...
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
'''simple docstring''' def __snake_case ( lowerCAmelCase : List[str] , lowerCAmelCase : List[Any] ): return int((input_a, input_a).count(0 ) == 0 ) def __snake_case ( ): assert and_gate(0 , 0 ) == 0 assert and_gate(0 , 1 ) == 0 assert and_g...
396
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor a_ = logging.get_logger(__name__) class UpperCAmelCase_ ( snake_case ): def __init__( self , *UpperCamelCase_ , **UpperCam...
76
0
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 PreTrainedTokenizerBase from ...utils import logging f...
464
"""simple docstring""" import argparse import os import torch from transformers import FlavaConfig, FlavaForPreTraining from transformers.models.flava.convert_dalle_to_flava_codebook import convert_dalle_checkpoint def __UpperCAmelCase ( __UpperCamelCase ): # encod...
76
0
"""simple docstring""" from ..models.whisper import WhisperForConditionalGeneration, WhisperProcessor from .base import PipelineTool class __lowerCAmelCase ( _lowercase ): """simple docstring""" snake_case = "openai/whisper-base" snake_case = ( "Th...
115
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, ...
76
0
def _lowerCamelCase ( SCREAMING_SNAKE_CASE ): '''simple docstring''' return " ".join( ''''''.join(word[::-1] ) if len(__UpperCamelCase ) > 4 else word for word in sentence.split() ) if __name__ == "__main__": import doctest doctest.testmod() print(r...
203
"""simple docstring""" def __UpperCAmelCase ( __UpperCamelCase , __UpperCamelCase ): if digit_amount > 0: return round(number - int(__UpperCamelCase ) , __UpperCamelCase ) return number - int(__UpperCamelCase ) if __name__ == "__main__": print(decimal_isolate(1....
76
0
import fire from utils import calculate_rouge, save_json def UpperCAmelCase ( a_ , a_ , a_=None , **a_ ) -> Optional[int]: """simple docstring""" __A = [x.strip() for x in open(__UpperCamelCase ).readlines()] __A = [x.strip() for x i...
55
"""simple docstring""" def __UpperCAmelCase ( __UpperCamelCase ): __lowercase : set[int] = set() # To detect a back edge, keep track of vertices currently in the recursion stack __lowercase : set[int] = set() return any( node not in vis...
76
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from t...
318
"""simple docstring""" import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRI...
76
0
"""simple docstring""" import argparse import math import os from copy import deepcopy import torch from audio_diffusion.models import DiffusionAttnUnetaD from diffusion import sampling from torch import nn from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel _lowerCAmelCase : i...
289
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( HubertConfig, HubertForCTC, HubertModel, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, ...
76
0
'''simple docstring''' from dataclasses import dataclass from typing import Optional, Tuple import torch from torch import nn from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel from transformers.utils import ModelOutput @dataclass class lowerCAmelCase__ ( a ): """si...
627
"""simple docstring""" a_ = { 'Pillow': 'Pillow<10.0.0', 'accelerate': 'accelerate>=0.20.3', 'av': 'av==9.2.0', 'beautifulsoup4': 'beautifulsoup4', 'black': 'black~=23.1', 'codecarbon': 'codecarbon==1.2.0', 'cookiecutter': 'cookiecutter==1.7.3', 'd...
76
0
'''simple docstring''' from __future__ import annotations def __a ( _UpperCamelCase: List[str] = 4 ) -> Union[str, Any]: """simple docstring""" _snake_case = abs(__UpperCamelCase ) or 4 return [[1 + x + y * row_size for x in range(__UpperCamelCase...
185
"""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/...
76
0
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_torch_available(): raise OptionalDependencyNotAvai...
321
"""simple docstring""" import gc import threading import time import psutil import torch class UpperCAmelCase_ : def __init__( self ) -> str: __lowercase : List[Any] = psutil.Process() __lowercase : Any = False def ...
76
0
'''simple docstring''' import re import tempfile from pathlib import Path import pytest import yaml from datasets.utils.readme import ReadMe # @pytest.fixture # def example_yaml_structure(): lowercase__ = yaml.safe_load( '''\\nname: ""\nallow_empty: false\nallow_empty_text: true\nsubsectio...
508
"""simple docstring""" import numpy as np import datasets a_ = '\nCompute the Mahalanobis Distance\n\nMahalonobis distance is the distance between a point and a distribution.\nAnd not between two distinct points. It is effectively a multivariate equivalent of the Euclidean distan...
76
0
'''simple docstring''' import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets _UpperCamelCase : Optional[int] = datasets.logging.get_logger(__name__) _UpperCamelCase : Dict = '\\n@inproceedings{bleurt,\n title={BLEURT:...
396
"""simple docstring""" a_ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' def __UpperCAmelCase ( __UpperCamelCase ): # Make sure the supplied data is a bytes-like object if not isinstance(__UpperCamelCase , __UpperCamelCase ): ...
76
0
import math def a_ ( SCREAMING_SNAKE_CASE__ : List[Any] = 100 ): '''simple docstring''' _lowerCamelCase : List[Any] =sum(i * i for i in range(1 , n + 1 ) ) _lowerCamelCase : Any =int(math.pow(sum(range(1 , n + 1 ) ) ...
464
"""simple docstring""" import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a_ = logging.get_logger(__name__) a_ = { 'vocab_file': 'vocab.json', ...
76
0
"""simple docstring""" from math import pi, sqrt, tan def A_ (__a ): '''simple docstring''' if side_length < 0: raise ValueError("surface_area_cube() only accepts non-negative values" ) return 6 * side_length**2 def A_ (__a , __a , __a ): '''simpl...
115
"""simple docstring""" import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor a_ = logging.get_logger(__name__) class UpperCAmelCase_ ( snake_case ): def __init__( self , *UpperCamelCase_ , ...
76
0
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class _lowercase : _lowercase : int = None def UpperCamelCase ( self : int ) -> str: """simple docstring""" A_ = ...
203
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging a_ = logging.get_logger(__name__) a...
76
0
import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() SCREAMING_SNAKE_CASE :str = logging.get_logg...
55
"""simple docstring""" 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 a_ = logging.getLogger(__name__) if...
76
0
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class a_ ( a_ ): '''simple do...
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 qiskit def __snake_case ( SCREAMING_SNAKE_CASE__ : int = 2 ) -> Union[str, Any]: '''simple docstring''' _UpperCAmelCase : List[str] = qubits # Using Aer's simulator _UpperCAmelCase : Any ...
289
"""simple docstring""" import os import sys a_ = os.path.join(os.path.dirname(__file__), 'src') sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, Au...
76
0
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase : Optional[int] = { 'configuration_autoformer': [ 'AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
627
"""simple docstring""" from math import pi, sqrt, tan def __UpperCAmelCase ( __UpperCamelCase ): if side_length < 0: raise ValueError('''surface_area_cube() only accepts non-negative values''' ) return 6 * side_length**2 def __UpperCAmelCase ...
76
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ : List[Any] = logging.get_logger(__name__) UpperCamelCase_ : Dict = { '''microsoft/cvt-13''': '''https://huggingface.co/microsoft/cvt-13/resolve/main/con...
185
"""simple docstring""" from __future__ import annotations def __UpperCAmelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ): # noqa: E741 while r - l > 1: __lowercase : int = (l + r) // 2 if v[m] >= k...
76
0
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 ImageProcessingSavingTestMixin, prepare_image_input...
321
"""simple docstring""" from __future__ import annotations def __UpperCAmelCase ( __UpperCamelCase = 4 ): __lowercase : Dict = abs(__UpperCamelCase ) or 4 return [[1 + x + y * row_size for x in range(__UpperCamelCase )] for y in range(__UpperCamelCase )]...
76
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
'''simple docstring''' from __future__ import annotations import random import unittest from transformers import TransfoXLConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin...
396
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor a_ = logging.get_logger(__name__) class UpperCAmelCase_ ( snake_case ): def __init__( self , *UpperCamelCase_ , **UpperCam...
76
0
lowerCamelCase = { 'Pillow': 'Pillow<10.0.0', 'accelerate': 'accelerate>=0.20.3', 'av': 'av==9.2.0', 'beautifulsoup4': 'beautifulsoup4', 'black': 'black~=23.1', 'codecarbon': 'codecarbon==1.2.0', 'cookiecutter': 'cookiecutter==1.7.3', 'dataclasses': 'dataclasses', 'datasets'...
464
"""simple docstring""" import argparse import os import torch from transformers import FlavaConfig, FlavaForPreTraining from transformers.models.flava.convert_dalle_to_flava_codebook import convert_dalle_checkpoint def __UpperCAmelCase ( __UpperCamelCase ): # encod...
76
0
"""simple docstring""" import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Value from .base import TaskTemplate @dataclass(frozen=_lowercase ) class __lowerCAmelCase ( _lowercase ): """simple docstring""" ...
115
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, ...
76
0
from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration __lowercase = HfArgumentParser(InitializationArguments) __lowercase = parser.parse_args() # Load codeparrot tokenizer trained for Pyt...
203
"""simple docstring""" def __UpperCAmelCase ( __UpperCamelCase , __UpperCamelCase ): if digit_amount > 0: return round(number - int(__UpperCamelCase ) , __UpperCamelCase ) return number - int(__UpperCamelCase ) if __name__ == "__main__": print(decimal_isolate(1....
76
0
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def UpperCAmelCase ( ) -> List[str]: """simple docstring""" __A = HfArgumentParser(__UpperCamelCase ) __A = parser.parse_args_into_dataclasses()[0] __A ...
55
"""simple docstring""" def __UpperCAmelCase ( __UpperCamelCase ): __lowercase : set[int] = set() # To detect a back edge, keep track of vertices currently in the recursion stack __lowercase : set[int] = set() return any( node not in vis...
76
0
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( 'files' , [ ['full:README.md', 'dataset_infos.json'], ['empty:README.md', 'dataset_infos.json'],...
318
"""simple docstring""" import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRI...
76
0
"""simple docstring""" import numpy as np def __snake_case ( SCREAMING_SNAKE_CASE__ : Optional[Any] , SCREAMING_SNAKE_CASE__ : Union[str, Any] ) -> Union[str, Any]: '''simple docstring''' return np.where(vector > 0 , __UpperCamelCase , (alpha * (np.exp(__Upp...
289
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( HubertConfig, HubertForCTC, HubertModel, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, ...
76
0
'''simple docstring''' from collections.abc import Iterator, MutableMapping from dataclasses import dataclass from typing import Generic, TypeVar UpperCAmelCase : Optional[int] = TypeVar('KEY') UpperCAmelCase : List[Any] = TypeVar('VAL') @dataclass(frozen=a , slots=a ) class...
627
"""simple docstring""" a_ = { 'Pillow': 'Pillow<10.0.0', 'accelerate': 'accelerate>=0.20.3', 'av': 'av==9.2.0', 'beautifulsoup4': 'beautifulsoup4', 'black': 'black~=23.1', 'codecarbon': 'codecarbon==1.2.0', 'cookiecutter': 'cookiecutter==1.7.3', 'd...
76
0
'''simple docstring''' from __future__ import annotations def __a ( _UpperCamelCase: Any , _UpperCamelCase: Any , _UpperCamelCase: str ) -> Dict: """simple docstring""" _snake_case = list(range(len(__UpperCamelCase ) ) ) ...
185
"""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/...
76
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils import F...
321
"""simple docstring""" import gc import threading import time import psutil import torch class UpperCAmelCase_ : def __init__( self ) -> str: __lowercase : List[Any] = psutil.Process() __lowercase : Any = False def ...
76
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_ch...
508
"""simple docstring""" import numpy as np import datasets a_ = '\nCompute the Mahalanobis Distance\n\nMahalonobis distance is the distance between a point and a distribution.\nAnd not between two distinct points. It is effectively a multivariate equivalent of the Euclidean distan...
76
0
'''simple docstring''' import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, MobileNetVaImageProcessor, load_tf_w...
396
"""simple docstring""" a_ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' def __UpperCAmelCase ( __UpperCamelCase ): # Make sure the supplied data is a bytes-like object if not isinstance(__UpperCamelCase , __UpperCamelCase ): ...
76
0
import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.numpy as jnp from transfo...
464
"""simple docstring""" import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging a_ = logging.get_logger(__name__) a_ = { 'vocab_file': 'vocab.json', ...
76
0
"""simple docstring""" from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. UpperCamelCase_ : Optional[int] = 200 # Number of elements selected in every generation of evolution. The selection takes # place ...
115
"""simple docstring""" import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor a_ = logging.get_logger(__name__) class UpperCAmelCase_ ( snake_case ): def __init__( self , *UpperCamelCase_ , ...
76
0
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 __lowercase = namedtuple( """_TestCommandArgs""", [ """dataset"...
203
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging a_ = logging.get_logger(__name__) a...
76
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import SegformerImageProcessor, SwinConfig, UperNetConfig, UperNetForSemanticSegmentation def UpperCAmelCase ( a_ ) -> str: """simple docstri...
55
"""simple docstring""" 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 a_ = logging.getLogger(__name__) if...
76
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""" from __future__ import annotations from collections import Counter from random import random class UpperCAmelCase_ : def __init__( self : Union[str, Any] ): _UpperCAmelCase : Tuple = {} def snake_case_ ( se...
289
"""simple docstring""" import os import sys a_ = os.path.join(os.path.dirname(__file__), 'src') sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, Au...
76
0
'''simple docstring''' UpperCAmelCase : List[Any] = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' def a__ ( ): """simple docstring""" __SCREAMING_SNAKE_CASE = input("""Enter message: """ ) __SCREAMING_SNAKE_CASE = input("""Enter key [alphanumeric]: """ ) __SCREAMING_S...
627
"""simple docstring""" from math import pi, sqrt, tan def __UpperCAmelCase ( __UpperCamelCase ): if side_length < 0: raise ValueError('''surface_area_cube() only accepts non-negative values''' ) return 6 * side_length**2 def __UpperCAmelCase ...
76
0
'''simple docstring''' class _a : def __init__( self ,_SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE ) -> Dict: _snake_case = name _snake_case = val def __str__( self ) -> Any: return f"""{self.__class__.__na...
185
"""simple docstring""" from __future__ import annotations def __UpperCAmelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase ): # noqa: E741 while r - l > 1: __lowercase : int = (l + r) // 2 if v[m] >= k...
76
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = {} class snake_case ( __snake_case ): """simple docstring""" __lowerCAmelCase = """llama""" __lowerCAmelCase ...
321
"""simple docstring""" from __future__ import annotations def __UpperCAmelCase ( __UpperCamelCase = 4 ): __lowercase : Dict = abs(__UpperCamelCase ) or 4 return [[1 + x + y * row_size for x in range(__UpperCamelCase )] for y in range(__UpperCamelCase )]...
76
0
'''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, ...
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
'''simple docstring''' import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common ...
396
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor a_ = logging.get_logger(__name__) class UpperCAmelCase_ ( snake_case ): def __init__( self , *UpperCamelCase_ , **UpperCam...
76
0
import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available(): import tensorflow as tf from tokenizers import pre_tokeniz...
464
"""simple docstring""" import argparse import os import torch from transformers import FlavaConfig, FlavaForPreTraining from transformers.models.flava.convert_dalle_to_flava_codebook import convert_dalle_checkpoint def __UpperCAmelCase ( __UpperCamelCase ): # encod...
76
0
"""simple docstring""" def _UpperCamelCase ( UpperCamelCase , UpperCamelCase ) -> float: """simple docstring""" if digit_amount > 0: return round(number - int(UpperCamelCase ) , UpperCamelCase ) return number - int(UpperCamelCase ) i...
77
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffuser...
77
1
"""simple docstring""" import torch from diffusers import DiffusionPipeline class a__ ( __magic_name__ ): def __init__( self : Union[str, Any] , UpperCamelCase_ : List[Any] , UpperCamelCase_ : Any): """simple docstring""" super().__init__() ...
77
"""simple docstring""" import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import Ba...
77
1
"""simple docstring""" from __future__ import annotations from random import random class a__ : def __init__( self : List[str] , UpperCamelCase_ : int | None = None): """simple docstring""" __UpperCAmelCase : str = value __UpperCAm...
77
"""simple docstring""" import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging A = logging.get_logger(__name__) class a__ ( __magic_name__ ): lowercase_ = ["input_ids", "att...
77
1
"""simple docstring""" def _UpperCamelCase ( UpperCamelCase ) -> int: """simple docstring""" __UpperCAmelCase : list[list[int]] = [[0 for _ in range(UpperCamelCase )] for _ in range(m + 1 )] for i in range(m + 1 ): __UpperCAmelCase...
77
"""simple docstring""" import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ...test_mode...
77
1
"""simple docstring""" import os import sys import unittest A = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_objec...
77
"""simple docstring""" from scipy.stats import spearmanr import datasets A = """ The Spearman rank-order correlation coefficient is a measure of the relationship between two datasets. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Positive co...
77
1
"""simple docstring""" import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def _UpperCamelCase ( ) -> None: """simple docstring""" print("Making key files..." ) make_key...
77
"""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 A = logging.get_logger(__name__) A = {"""vocab_file""": """spie...
77
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A = { """configuration_clap""": [ """CLAP_PRETRAINED_MODEL_ARCHIVE_LIST""", """ClapAudioConfig""", """ClapConfig""", """C...
77
"""simple docstring""" 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 ...
77
1
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black A = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import check_copies # noqa: E402 # This is...
77
"""simple docstring""" import math def _UpperCamelCase ( UpperCamelCase , UpperCamelCase = 0 , UpperCamelCase = 0 ) -> list: """simple docstring""" __UpperCAmelCase : Union[str, Any] = end or len(UpperCamelCase ) for i in ...
77
1
"""simple docstring""" import argparse import os import re A = """src/transformers""" # Pattern that looks at the indentation in a line. A = re.compile(r"""^(\s*)\S""") # Pattern that matches `"key":" and puts `key` in group 0. A = re.compile(r"""^\s*\"([^\"]+)\":""") # Pattern t...
77
"""simple docstring""" import numpy as np from PIL import Image def _UpperCamelCase ( UpperCamelCase , UpperCamelCase , UpperCamelCase ) -> np.ndarray: """simple docstring""" __UpperCAmelCase : str = np.array(UpperCamelCase )...
77
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_common i...
77
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_pegasus import PegasusTokeni...
77
1
"""simple docstring""" from string import ascii_lowercase, ascii_uppercase def _UpperCamelCase ( UpperCamelCase ) -> str: """simple docstring""" if not sentence: return "" __UpperCAmelCase : List[str] = dict(zip(UpperCamelCase , ...
77
"""simple docstring""" import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info()...
77
1
"""simple docstring""" import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def _UpperCamelCase ( UpperCamelCase ) -> int: """simple docstring""" def wrapper(*UpperCamelCase , ...
77
"""simple docstring""" from typing import Union import fire import torch from tqdm import tqdm def _UpperCamelCase ( UpperCamelCase , UpperCamelCase = "cpu" , UpperCamelCase = None ) -> None: """simple docstring""" __UpperCAmelCase : Union[str,...
77
1
"""simple docstring""" def _UpperCamelCase ( UpperCamelCase = 6008_5147_5143 ) -> int: """simple docstring""" try: __UpperCAmelCase : Dict = int(UpperCamelCase ) except (TypeError, ValueError): raise TypeError("Parameter n must be...
77
"""simple docstring""" import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": A = pd.read_csv("""sample_data.csv""", header=None) A = ...
77
1
"""simple docstring""" import os import sys import unittest A = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import get_test_info # noqa: E402 from get_test_info import ( # noqa: E402 get_model_to_test_...
77
"""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_tokeniz...
77
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) A = { """configuration_trocr""": ["""TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP""", ""...
77
"""simple docstring""" from typing import Any class a__ : def __init__( self : List[str] , UpperCamelCase_ : Any): """simple docstring""" __UpperCAmelCase : str = data __UpperCAmelCase : Optional[Any] = None ...
77
1
"""simple docstring""" import random import unittest import numpy as np from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionImgaImgPipeline, PNDMScheduler, ) from diffusers.utils import...
77
"""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/LICENS...
77
1
"""simple docstring""" import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ...test_mode...
77
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tensorflow_text_available, is_torch_available A = { """configuration_ernie""": ["""ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ErnieConfig""", """ErnieOnnxConfig"""], } ...
77
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor A = logging.get_logger(__name__) class a__ ( __magic_name__ ): def __init__( self : Tuple , *UpperCamelCase_ : Any , **UpperCamel...
77
"""simple docstring""" import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class a__ ...
77
1
"""simple docstring""" from __future__ import annotations import time import numpy as np A = [8, 5, 9, 7] A = [ [2, 0, 1, 1], [0, 1, 2, 1], [4, 0, 0, 3], [0, 2, 1, 0], [1, 0, 3, 0], ] A = [ [3, 2, 1, 4], [0, 2, 5, 2], [5, 1, 0, 5], [1, 5, 3, 0]...
77
"""simple docstring""" def _UpperCamelCase ( UpperCamelCase , UpperCamelCase ) -> int: """simple docstring""" __UpperCAmelCase : Dict = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): __UpperCAmelC...
77
1
"""simple docstring""" import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger A = get_logger(__name__) A = r""" Args: input_ids (`jnp.ndarray` of shape `(batch_size, sequence_le...
77
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) A = { """configuration_trocr""": ["""TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP""", ""...
77
1