code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : List[Any] = logging.get_logger(__name__) _lowercase : Union[str, Any] = { """Salesforce/blip-vqa-base""": """https...
50
'''simple docstring''' # Copyright 2022 The HuggingFace Team and The OpenBMB 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/lic...
50
1
'''simple docstring''' import inspect import unittest from transformers import ViTMSNConfig 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 Co...
50
'''simple docstring''' import heapq def lowerCamelCase__ ( A : dict ): '''simple docstring''' UpperCAmelCase = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the queue will be filled like a Prior...
50
1
'''simple docstring''' from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature from ....
50
'''simple docstring''' import argparse import os import re import packaging.version _lowercase : Optional[int] = """examples/""" _lowercase : str = { """examples""": (re.compile(r"""^check_min_version\(\"[^\"]+\"\)\s*$""", re.MULTILINE), """check_min_version(\"VERSION\")\n"""), ...
50
1
'''simple docstring''' def lowerCamelCase__ ( A : str ): '''simple docstring''' assert column_title.isupper() UpperCAmelCase = 0 UpperCAmelCase = len(A ) - 1 UpperCAmelCase = 0 while index >= 0: UpperCAmelCase ...
50
'''simple docstring''' import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteria,...
50
1
'''simple docstring''' from sklearn.metrics import fa_score import datasets _lowercase : Dict = """ The F1 score is the harmonic mean of the precision and recall. It can be computed with the equation: F1 = 2 * (precision * recall) / (precision + recall) """ _lowercase : Any = """ ...
50
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCamelCase__( metaclass=lowerCAmelCase ): __magic_name__ : List[str] = ["note_seq"] def __init__( self : Any , *lowerCAmelCase : List[str] , **lowerCAmelCase : int...
50
1
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
50
'''simple docstring''' import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def lowerCamelCase__ ( A : List[Any] , A : int , A ...
50
1
'''simple docstring''' def lowerCamelCase__ ( A : int = 10_00 ): '''simple docstring''' return sum(e for e in range(3 , A ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(F"""{solution() = }""")
50
'''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 UpperCamelCase__( unittest.TestCase ): ...
50
1
'''simple docstring''' from math import sqrt def lowerCamelCase__ ( A : int = 1_00_00_00 ): '''simple docstring''' UpperCAmelCase = 0 UpperCAmelCase = 0 UpperCAmelCase = 42 while num_cuboids <= limit: max_cuboid_size...
50
'''simple docstring''' from argparse import ArgumentParser from . import BaseTransformersCLICommand def lowerCamelCase__ ( A : List[Any] ): '''simple docstring''' return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) ...
50
1
'''simple docstring''' from PIL import Image def lowerCamelCase__ ( A : Image , A : float ): '''simple docstring''' def brightness(A : int ) -> float: return 1_28 + level + (c - 1_28) if not -255.0 <= level <= 255.0: raise Va...
50
'''simple docstring''' def lowerCamelCase__ ( A : str ): '''simple docstring''' assert column_title.isupper() UpperCAmelCase = 0 UpperCAmelCase = len(A ) - 1 UpperCAmelCase = 0 while index >= 0: UpperCAmelCase ...
50
1
'''simple docstring''' import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class UpperCamelCase__( lowerCAmelCase ): __m...
50
'''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_modeling...
50
1
'''simple docstring''' def lowerCamelCase__ ( A : int , A : List[Any] ): '''simple docstring''' UpperCAmelCase = (boundary[1] - boundary[0]) / steps UpperCAmelCase = boundary[0] UpperCAmelCase = boundary[1] UpperCAmelC...
50
'''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, BatchEncoding, PreTrainedTokenizer from ...utils import logging _lowercase : str = logging.get_logger(__name_...
50
1
'''simple docstring''' def lowerCamelCase__ ( A : int ): '''simple docstring''' if divisor % 5 == 0 or divisor % 2 == 0: return 0 UpperCAmelCase = 1 UpperCAmelCase = 1 while repunit: UpperCAmelCase = (10 * r...
50
'''simple docstring''' # 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 # # ...
50
1
'''simple docstring''' import inspect import re from hashlib import shaaaa from typing import Dict, List from .arrow import arrow from .audiofolder import audiofolder from .csv import csv from .imagefolder import imagefolder from .json import json from .pandas import pandas from .parquet import parquet from .sql...
50
'''simple docstring''' import functools def lowerCamelCase__ ( A : list[int] , A : list[int] ): '''simple docstring''' if not isinstance(A , A ) or not all(isinstance(A , A ) for day in days ): raise ValueError('''The parameter days shou...
50
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowercase : Any = logging.get_logger(__name__) _lowercase : ...
50
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _lowercase : Any = { """configuration_gpt_bigcode""": ["""GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTBigCodeConfig"""], } try...
50
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCamelCase__( metaclass=lowerCAmelCase ): __magic_name__ : List[str] = ["note_seq"] def __init__( self : Any , *lowerCAmelCase : List[str] , **lowerCAmelCase : int...
50
'''simple docstring''' import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def lowerCamelCase__ ( A : Optional[Any] , A : Tuple=1 ): '''simple docstring''' if n_shave_prefix_segments >= 0: r...
50
1
'''simple docstring''' from __future__ import annotations def lowerCamelCase__ ( A : str , A : list[str] | None = None ): '''simple docstring''' UpperCAmelCase = word_bank or [] # create a table UpperCAmelCase = len(A ) + 1 ...
50
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Any = logging.get_logger(__name__) _lowercase : Dict = { """facebook/dpr-ctx_encoder-single-nq-base""": ( """https://huggingface.co/facebook/dpr-ctx_encod...
50
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Tuple = logging.get_logger(__name__) _lowercase : Optional[Any] = { """uw-madison/mra-base-512-4""": """https://huggingface.co/uw-madison/mra-base-512-4/resolve/m...
50
'''simple docstring''' import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, DistilBertConfig, DistilBe...
50
1
'''simple docstring''' from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, t...
50
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCamelCase__( lowerCAmelCase ): __magic_name__ : Tuple = ["image_processor", "tokenizer"] __magic_name__ : Any = "ViT...
50
1
'''simple docstring''' import argparse import json from typing import List from ltp import LTP from transformers.models.bert.tokenization_bert import BertTokenizer def lowerCamelCase__ ( A : List[str] ): '''simple docstring''' if ( (cp >= 0x4e00 and cp <= 0x9fff) ...
50
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowercase : Any = { """configuration_maskformer""": ["""MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MaskFormerConfig"""], ...
50
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...
50
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from acceler...
50
1
'''simple docstring''' import itertools import json import os import unittest from transformers import AddedToken, RobertaTokenizer, RobertaTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_to...
50
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
50
1
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ConvNextConfig, SegformerImageProcessor, UperNetConfig, UperNetForSemanticSegmentation def lowerCamelCase__ ( A : str ): ...
50
'''simple docstring''' import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Union[str, Any] = logging.get_logger(__name__) _lowercase : List[str] = { """facebook/encodec_24khz""...
50
1
'''simple docstring''' import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments ...
50
'''simple docstring''' # Copyright 2022 The HuggingFace Team and The OpenBMB 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/lic...
50
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _lowercase : int = logging.get_logger(__name__) _lowercase : Union[str, Any] = ...
50
'''simple docstring''' import heapq def lowerCamelCase__ ( A : dict ): '''simple docstring''' UpperCAmelCase = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the queue will be filled like a Prior...
50
1
'''simple docstring''' from bisect import bisect from itertools import accumulate def lowerCamelCase__ ( A : List[str] , A : str , A : Any , A : List[Any] ): '''simple docstring''' UpperCAmelCase = sorted(zip(A , A ) , ...
50
'''simple docstring''' import argparse import os import re import packaging.version _lowercase : Optional[int] = """examples/""" _lowercase : str = { """examples""": (re.compile(r"""^check_min_version\(\"[^\"]+\"\)\s*$""", re.MULTILINE), """check_min_version(\"VERSION\")\n"""), ...
50
1
'''simple docstring''' class UpperCamelCase__: def __init__( self : List[str] , lowerCAmelCase : int )-> None: """simple docstring""" UpperCAmelCase = size UpperCAmelCase = [0] * size UpperCAmelCase = [0] * si...
50
'''simple docstring''' import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteria,...
50
1
'''simple docstring''' def lowerCamelCase__ ( A : int , A : int , A : int ): '''simple docstring''' UpperCAmelCase = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series return total ...
50
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCamelCase__( metaclass=lowerCAmelCase ): __magic_name__ : List[str] = ["note_seq"] def __init__( self : Any , *lowerCAmelCase : List[str] , **lowerCAmelCase : int...
50
1
'''simple docstring''' import math _lowercase : Optional[int] = 10 _lowercase : Optional[int] = 7 _lowercase : str = BALLS_PER_COLOUR * NUM_COLOURS def lowerCamelCase__ ( A : int = 20 ): '''simple docstring''' UpperCAmelCase =...
50
'''simple docstring''' import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def lowerCamelCase__ ( A : List[Any] , A : int , A ...
50
1
'''simple docstring''' def lowerCamelCase__ ( A : int ): '''simple docstring''' UpperCAmelCase = n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(27)) print(perfect_cube(4))
50
'''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 UpperCamelCase__( unittest.TestCase ): ...
50
1
'''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...
50
'''simple docstring''' from argparse import ArgumentParser from . import BaseTransformersCLICommand def lowerCamelCase__ ( A : List[Any] ): '''simple docstring''' return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) ...
50
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor _lowercase : str = logging.get_logger(__name__) class UpperCamelCase__( lowerCAmelCase ): def __init__( self : int , *lowerCAmelCase : A...
50
'''simple docstring''' def lowerCamelCase__ ( A : str ): '''simple docstring''' assert column_title.isupper() UpperCAmelCase = 0 UpperCAmelCase = len(A ) - 1 UpperCAmelCase = 0 while index >= 0: UpperCAmelCase ...
50
1
'''simple docstring''' import argparse import importlib from pathlib import Path # Test all the extensions added in the setup _lowercase : Dict = [ """kernels/rwkv/wkv_cuda.cu""", """kernels/rwkv/wkv_op.cpp""", """kernels/deformable_detr/ms_deform_attn.h""", """kernels/deformable_d...
50
'''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_modeling...
50
1
'''simple docstring''' import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.auto.modeling...
50
'''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, BatchEncoding, PreTrainedTokenizer from ...utils import logging _lowercase : str = logging.get_logger(__name_...
50
1
'''simple docstring''' import unittest from queue import Empty from threading import Thread from transformers import AutoTokenizer, TextIteratorStreamer, TextStreamer, is_torch_available from transformers.testing_utils import CaptureStdout, require_torch, torch_device from ..test_modeling_common import ids_tens...
50
'''simple docstring''' # 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 # # ...
50
1
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging _lowercase : str = logging.get_logger(__name_...
50
'''simple docstring''' import functools def lowerCamelCase__ ( A : list[int] , A : list[int] ): '''simple docstring''' if not isinstance(A , A ) or not all(isinstance(A , A ) for day in days ): raise ValueError('''The parameter days shou...
50
1
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase : str = { """configuration_mctct""": ["""MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MCTCTConfig"""], """feature_extraction_mctct""": [""...
50
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _lowercase : Any = { """configuration_gpt_bigcode""": ["""GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTBigCodeConfig"""], } try...
50
1
'''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_distilbert import DistilBertTokenizer _lowercase : int = logging.get_logge...
50
'''simple docstring''' import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def lowerCamelCase__ ( A : Optional[Any] , A : Tuple=1 ): '''simple docstring''' if n_shave_prefix_segments >= 0: r...
50
1
'''simple docstring''' import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class UpperCamelCase__( lowerCAmelCase ): __magic_name__ : Tuple = (DDIMParallelScheduler,) __magic_name__ : Optional[int] = (("eta", 0....
50
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Any = logging.get_logger(__name__) _lowercase : Dict = { """facebook/dpr-ctx_encoder-single-nq-base""": ( """https://huggingface.co/facebook/dpr-ctx_encod...
50
1
'''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 Acce...
50
'''simple docstring''' import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, DistilBertConfig, DistilBe...
50
1
'''simple docstring''' def lowerCamelCase__ ( A : list , A : list , A : int , A : int , A : int ): '''simple docstring''' if index == number_of_items: return 0 UpperCAmelCase = 0 UpperCAmelCase...
50
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCamelCase__( lowerCAmelCase ): __magic_name__ : Tuple = ["image_processor", "tokenizer"] __magic_name__ : Any = "ViT...
50
1
'''simple docstring''' import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokeniza...
50
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowercase : Any = { """configuration_maskformer""": ["""MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MaskFormerConfig"""], ...
50
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowercase : Dict = { """configuration_deberta""": ["""DEBERTA_PRETRAINED_CONFIG_ARCH...
50
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from acceler...
50
1
'''simple docstring''' from .data_collator import ( DataCollatorForLanguageModeling, DataCollatorForPermutationLanguageModeling, DataCollatorForSeqaSeq, DataCollatorForSOP, DataCollatorForTokenClassification, DataCollatorForWholeWordMask, DataCollatorWithPadding, DefaultDataCollato...
50
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
50
1
'''simple docstring''' from argparse import ArgumentParser from . import BaseTransformersCLICommand def lowerCamelCase__ ( A : List[Any] ): '''simple docstring''' return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) ...
50
'''simple docstring''' import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Union[str, Any] = logging.get_logger(__name__) _lowercase : List[str] = { """facebook/encodec_24khz""...
50
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Optional[Any] = logging.get_logger(__name__) _lowercase : List[Any] = { """microsoft/cvt-13""": """https://huggingface.co/microsoft/cvt-13/resolve/main/config.jso...
50
'''simple docstring''' # Copyright 2022 The HuggingFace Team and The OpenBMB 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/lic...
50
1
'''simple docstring''' import os from pathlib import Path def lowerCamelCase__ ( ): '''simple docstring''' from torch.utils.cpp_extension import load UpperCAmelCase = Path(A ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' UpperCAmelCase...
50
'''simple docstring''' import heapq def lowerCamelCase__ ( A : dict ): '''simple docstring''' UpperCAmelCase = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the queue will be filled like a Prior...
50
1
'''simple docstring''' from __future__ import annotations _lowercase : Union[str, Any] = 10 def lowerCamelCase__ ( A : list[int] ): '''simple docstring''' UpperCAmelCase = 1 UpperCAmelCase = max(A ) while placement <= max_digit: ...
50
'''simple docstring''' import argparse import os import re import packaging.version _lowercase : Optional[int] = """examples/""" _lowercase : str = { """examples""": (re.compile(r"""^check_min_version\(\"[^\"]+\"\)\s*$""", re.MULTILINE), """check_min_version(\"VERSION\")\n"""), ...
50
1
'''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_convbert import ConvBertTokenizer _lowercase : List[str] = logging.get_log...
50
'''simple docstring''' import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteria,...
50
1
'''simple docstring''' from typing import Union import fire import torch from tqdm import tqdm def lowerCamelCase__ ( A : str , A : str = "cpu" , A : Union[str, None] = None ): '''simple docstring''' UpperCAmelCase = torch.load(A , ma...
50
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCamelCase__( metaclass=lowerCAmelCase ): __magic_name__ : List[str] = ["note_seq"] def __init__( self : Any , *lowerCAmelCase : List[str] , **lowerCAmelCase : int...
50
1
'''simple docstring''' import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_...
50
'''simple docstring''' import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def lowerCamelCase__ ( A : List[Any] , A : int , A ...
50
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowercase : Any = { """configuration_maskformer""": ["""MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MaskFormerConfig"""], ...
50
'''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 UpperCamelCase__( unittest.TestCase ): ...
50
1
'''simple docstring''' import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin ...
50
'''simple docstring''' from argparse import ArgumentParser from . import BaseTransformersCLICommand def lowerCamelCase__ ( A : List[Any] ): '''simple docstring''' return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) ...
50
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowercase : List[str] = logging.get_logger(__name__) _lowercase ...
50
'''simple docstring''' def lowerCamelCase__ ( A : str ): '''simple docstring''' assert column_title.isupper() UpperCAmelCase = 0 UpperCAmelCase = len(A ) - 1 UpperCAmelCase = 0 while index >= 0: UpperCAmelCase ...
50
1
'''simple docstring''' import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common i...
50
'''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_modeling...
50
1
'''simple docstring''' import os _lowercase : List[str] = {"""I""": 1, """V""": 5, """X""": 10, """L""": 50, """C""": 100, """D""": 500, """M""": 1000} def lowerCamelCase__ ( A : str ): '''simple docstring''' UpperCAmelCase = 0 UpperCAmelCase ...
50
'''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, BatchEncoding, PreTrainedTokenizer from ...utils import logging _lowercase : str = logging.get_logger(__name_...
50
1
'''simple docstring''' def lowerCamelCase__ ( A : list[int] , A : int ): '''simple docstring''' UpperCAmelCase = len(A ) UpperCAmelCase = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )] # for each arr value, a sum of ze...
50
'''simple docstring''' # 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 # # ...
50
1
'''simple docstring''' # Copyright 2022 The HuggingFace Team and The OpenBMB 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/lic...
50
'''simple docstring''' import functools def lowerCamelCase__ ( A : list[int] , A : list[int] ): '''simple docstring''' if not isinstance(A , A ) or not all(isinstance(A , A ) for day in days ): raise ValueError('''The parameter days shou...
50
1
'''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 PreTrainedTokenizer...
50
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _lowercase : Any = { """configuration_gpt_bigcode""": ["""GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTBigCodeConfig"""], } try...
50
1
'''simple docstring''' # 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 # # ...
50
'''simple docstring''' import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def lowerCamelCase__ ( A : Optional[Any] , A : Tuple=1 ): '''simple docstring''' if n_shave_prefix_segments >= 0: r...
50
1
'''simple docstring''' class UpperCamelCase__: def __init__( self : Optional[Any] , lowerCAmelCase : Dict , lowerCAmelCase : Optional[Any] )-> Optional[int]: """simple docstring""" UpperCAmelCase = name UpperCAmelCase =...
50
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Any = logging.get_logger(__name__) _lowercase : Dict = { """facebook/dpr-ctx_encoder-single-nq-base""": ( """https://huggingface.co/facebook/dpr-ctx_encod...
50
1
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from acceler...
50
'''simple docstring''' import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, DistilBertConfig, DistilBe...
50
1
'''simple docstring''' import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class UpperCamelCase__( lowerCAmelCase ): __magic_name__ : str = (UnCLIPScheduler,) def a__( self : Optional[int] , **lowerCAmelCase : ...
50
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCamelCase__( lowerCAmelCase ): __magic_name__ : Tuple = ["image_processor", "tokenizer"] __magic_name__ : Any = "ViT...
50
1
'''simple docstring''' import inspect import unittest from transformers import BitConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTe...
50
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowercase : Any = { """configuration_maskformer""": ["""MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MaskFormerConfig"""], ...
50
1
'''simple docstring''' import os def lowerCamelCase__ ( A : str = "input.txt" ): '''simple docstring''' with open(os.path.join(os.path.dirname(A ) , A ) ) as input_file: UpperCAmelCase = [ [int(A ) for element in line.split(''','...
50
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from acceler...
50
1
'''simple docstring''' 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 sa...
50
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
50
1
'''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-2.0 # #...
50
'''simple docstring''' import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Union[str, Any] = logging.get_logger(__name__) _lowercase : List[str] = { """facebook/encodec_24khz""...
50
1
'''simple docstring''' import numpy as np import qiskit def lowerCamelCase__ ( A : int = 8 , A : int | None = None ): '''simple docstring''' UpperCAmelCase = np.random.default_rng(seed=A ) # Roughly 25% of the qubits will contribute to the key. ...
50
'''simple docstring''' # Copyright 2022 The HuggingFace Team and The OpenBMB 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/lic...
50
1
'''simple docstring''' def lowerCamelCase__ ( ): '''simple docstring''' return [list(range(10_00 - i , -10_00 - i , -1 ) ) for i in range(10_00 )] _lowercase : Optional[Any] = generate_large_matrix() _lowercase : Any = ( [[4, 3, 2, -1], [...
50
'''simple docstring''' import heapq def lowerCamelCase__ ( A : dict ): '''simple docstring''' UpperCAmelCase = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the queue will be filled like a Prior...
50
1
'''simple docstring''' _lowercase : Tuple = {"""a""": ["""c""", """b"""], """b""": ["""d""", """e"""], """c""": [], """d""": [], """e""": []} _lowercase : Any = ["""a""", """b""", """c""", """d""", """e"""] def lowerCamelCase__ ( A : Any , A : List[Any] , ...
50
'''simple docstring''' import argparse import os import re import packaging.version _lowercase : Optional[int] = """examples/""" _lowercase : str = { """examples""": (re.compile(r"""^check_min_version\(\"[^\"]+\"\)\s*$""", re.MULTILINE), """check_min_version(\"VERSION\")\n"""), ...
50
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowercase : Tuple = { """configuration_altclip""": [ """ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """AltCLIPCo...
50
'''simple docstring''' import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteria,...
50
1
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determinism() @slow @re...
50
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCamelCase__( metaclass=lowerCAmelCase ): __magic_name__ : List[str] = ["note_seq"] def __init__( self : Any , *lowerCAmelCase : List[str] , **lowerCAmelCase : int...
50
1
'''simple docstring''' import json import sys def lowerCamelCase__ ( A : Optional[Any] , A : Dict ): '''simple docstring''' with open(A , encoding='''utf-8''' ) as f: UpperCAmelCase = json.load(A ) UpperCAmelCase = ['...
50
'''simple docstring''' import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def lowerCamelCase__ ( A : List[Any] , A : int , A ...
50
1
'''simple docstring''' import collections import inspect import unittest from transformers import SwinvaConfig 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_configurati...
50
'''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 UpperCamelCase__( unittest.TestCase ): ...
50
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase : int = { """configuration_pegasus_x""": ["""PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PegasusXConfig"""], } try: if not is_torch_avai...
50
'''simple docstring''' from argparse import ArgumentParser from . import BaseTransformersCLICommand def lowerCamelCase__ ( A : List[Any] ): '''simple docstring''' return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) ...
50
1
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_ax...
50
'''simple docstring''' def lowerCamelCase__ ( A : str ): '''simple docstring''' assert column_title.isupper() UpperCAmelCase = 0 UpperCAmelCase = len(A ) - 1 UpperCAmelCase = 0 while index >= 0: UpperCAmelCase ...
50
1
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets _lowercase : List[Any] = """\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns and ...
50
'''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_modeling...
50
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import LEDConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor from ...
50
'''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, BatchEncoding, PreTrainedTokenizer from ...utils import logging _lowercase : str = logging.get_logger(__name_...
50
1
'''simple docstring''' import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet impo...
50
'''simple docstring''' # 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 # # ...
50
1
'''simple docstring''' from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES _lowercase : Any = logging.get_logger(__name__) _lowercase : Dict...
50
'''simple docstring''' import functools def lowerCamelCase__ ( A : list[int] , A : list[int] ): '''simple docstring''' if not isinstance(A , A ) or not all(isinstance(A , A ) for day in days ): raise ValueError('''The parameter days shou...
50
1
'''simple docstring''' import argparse from collections import OrderedDict from pathlib import Path import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision.transforms import functional as F from transformers import DetrImageProcessor, TableTransformerConfig, TableTransfor...
50
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _lowercase : Any = { """configuration_gpt_bigcode""": ["""GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTBigCodeConfig"""], } try...
50
1
'''simple docstring''' import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def lowerCamelCase__ ( A : Optional[Any] , A : Tuple=1 ): '''simple docstring''' if n_shave_prefix_segments >= 0: r...
50
'''simple docstring''' import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def lowerCamelCase__ ( A : Optional[Any] , A : Tuple=1 ): '''simple docstring''' if n_shave_prefix_segments >= 0: r...
50
1
'''simple docstring''' from __future__ import annotations _lowercase : List[Any] = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def lowerCamelCase__ ( A : list[list[int]] , A : list[int] , A : list[int] , A : ...
50
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Any = logging.get_logger(__name__) _lowercase : Dict = { """facebook/dpr-ctx_encoder-single-nq-base""": ( """https://huggingface.co/facebook/dpr-ctx_encod...
50
1
'''simple docstring''' import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def lowerCamelCase__ ( A : List[str] , A : Optional[Any]=None ): '''simple docstring''' UpperCAmel...
50
'''simple docstring''' import argparse import json import os import pickle import shutil import numpy as np import torch from distiller import Distiller from lm_seqs_dataset import LmSeqsDataset from transformers import ( BertConfig, BertForMaskedLM, BertTokenizer, DistilBertConfig, DistilBe...
50
1
'''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 BatchF...
50
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCamelCase__( lowerCAmelCase ): __magic_name__ : Tuple = ["image_processor", "tokenizer"] __magic_name__ : Any = "ViT...
50
1
'''simple docstring''' import ast import os import re import shutil import tempfile import unittest from unittest import mock import torch from accelerate.test_utils.examples import compare_against_test from accelerate.test_utils.testing import TempDirTestCase, require_trackers, run_command, slow from accelerat...
50
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _lowercase : Any = { """configuration_maskformer""": ["""MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MaskFormerConfig"""], ...
50
1
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers import is_speech_available, is_vision_available from transformers.testing_utils import require_torch if is_vision_available(): from transformers import TvltImageProcessor if is_speech_avai...
50
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from acceler...
50
1
'''simple docstring''' import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict _lowercase : List[str] = namedtuple( """_TestCom...
50
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # #...
50
1
'''simple docstring''' from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def lowerCamelCase__ ( A : Namespace ): '''simple docstring''' return ConvertCommand( args.model_type , args.tf_checkpoin...
50
'''simple docstring''' import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Union[str, Any] = logging.get_logger(__name__) _lowercase : List[str] = { """facebook/encodec_24khz""...
50
1
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_b...
50
'''simple docstring''' # Copyright 2022 The HuggingFace Team and The OpenBMB 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/lic...
50
1
'''simple docstring''' from math import ceil from typing import List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor from ...utils import TensorType, logging _lo...
50
'''simple docstring''' import heapq def lowerCamelCase__ ( A : dict ): '''simple docstring''' UpperCAmelCase = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the queue will be filled like a Prior...
50
1
'''simple docstring''' from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class UpperCamelCase__( lowerCAmelCase ): def a__( self : List[Any] , lowerCAmelCase : float )-> float: ...
50
'''simple docstring''' import argparse import os import re import packaging.version _lowercase : Optional[int] = """examples/""" _lowercase : str = { """examples""": (re.compile(r"""^check_min_version\(\"[^\"]+\"\)\s*$""", re.MULTILINE), """check_min_version(\"VERSION\")\n"""), ...
50
1
'''simple docstring''' import math from collections.abc import Callable def lowerCamelCase__ ( A : Callable[[float], float] , A : float , A : float ): '''simple docstring''' UpperCAmelCase = xa UpperCAmelCase = xa while...
50
'''simple docstring''' import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteria,...
50
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : Any = logging.get_logger(__name__) _lowercase : Dict = { """facebook/dpr-ctx_encoder-single-nq-base""": ( """https://huggingface.co/facebook/dpr-ctx_encod...
50
'''simple docstring''' from ..utils import DummyObject, requires_backends class UpperCamelCase__( metaclass=lowerCAmelCase ): __magic_name__ : List[str] = ["note_seq"] def __init__( self : Any , *lowerCAmelCase : List[str] , **lowerCAmelCase : int...
50
1
'''simple docstring''' from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class UpperCamelCase__( lowerCAmelCase ): __m...
50
'''simple docstring''' import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def lowerCamelCase__ ( A : List[Any] , A : int , A ...
50
1
'''simple docstring''' import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size from ..uti...
50
'''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 UpperCamelCase__( unittest.TestCase ): ...
50
1
'''simple docstring''' def lowerCamelCase__ ( A : list[int] ): '''simple docstring''' if not numbers: return 0 if not isinstance(A , (list, tuple) ) or not all( isinstance(A , A ) for number in numbers ): raise ValueError('...
50
'''simple docstring''' from argparse import ArgumentParser from . import BaseTransformersCLICommand def lowerCamelCase__ ( A : List[Any] ): '''simple docstring''' return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) ...
50
1
'''simple docstring''' import gc import math import unittest import torch from diffusers import UNetaDModel from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixi...
50
'''simple docstring''' def lowerCamelCase__ ( A : str ): '''simple docstring''' assert column_title.isupper() UpperCAmelCase = 0 UpperCAmelCase = len(A ) - 1 UpperCAmelCase = 0 while index >= 0: UpperCAmelCase ...
50
1
'''simple docstring''' import operator def lowerCamelCase__ ( A : list , A : bool = False , A : list | None = None ): '''simple docstring''' UpperCAmelCase = operator.lt if reverse else operator.gt UpperCAmelCase = solution o...
50
'''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_modeling...
50
1
'''simple docstring''' import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class UpperCamelCase__( un...
50
'''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, BatchEncoding, PreTrainedTokenizer from ...utils import logging _lowercase : str = logging.get_logger(__name_...
50
1
'''simple docstring''' import json import os import pickle import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers import is_faiss_available from transformers.models.bart.configuration_bart import BartConfig fr...
50
'''simple docstring''' # 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 # # ...
50
1