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""" def _a ( UpperCAmelCase__ ) -> bool: __SCREAMING_SNAKE_CASE = (1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def _a ( UpperCAmelCase__ = 50_00 ) -> int: __SCREAMING_SNAKE_CASE = [(i * (3 * i - 1)) // ...
717
"""simple docstring""" import math lowerCAmelCase__ =10 lowerCAmelCase__ =7 lowerCAmelCase__ =BALLS_PER_COLOUR * NUM_COLOURS def _a ( UpperCAmelCase__ = 20 ) -> str: __SCREAMING_SNAKE_CASE = math.comb(UpperCAmelCase__ , UpperCAmelCase__ ...
690
0
import string def _a ( UpperCAmelCase__ ) -> None: for key in range(len(string.ascii_uppercase ) ): __SCREAMING_SNAKE_CASE = '''''' for symbol in message: if symbol in string.ascii_uppercase: __SCREAMING_...
718
"""simple docstring""" from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_avail...
690
0
"""simple docstring""" def _a ( UpperCAmelCase__ ) -> int: assert isinstance(UpperCAmelCase__ , UpperCAmelCase__ ), f"""The input value of [n={number}] is not an integer""" if number == 1: return 2 elif number < 1: __SCREAMING_SNAKE_CASE ...
719
"""simple docstring""" from __future__ import annotations from collections.abc import Callable lowerCAmelCase__ =list[list[float | int]] def _a ( UpperCAmelCase__ , UpperCAmelCase__ ) -> Matrix: __SCREAMING_SNAKE_CASE = len(UpperCAmelCase__ ) __S...
690
0
"""simple docstring""" from __future__ import annotations lowerCAmelCase__ =10 def _a ( UpperCAmelCase__ ) -> list[int]: __SCREAMING_SNAKE_CASE = 1 __SCREAMING_SNAKE_CASE = max(UpperCAmelCase__ ) while placement <= max_digit: ...
720
"""simple docstring""" from json import JSONDecodeError # Workaround for requests.exceptions.JSONDecodeError import requests def _a ( UpperCAmelCase__ = "isbn/0140328726" ) -> dict: __SCREAMING_SNAKE_CASE = olid.strip().strip('''/''' ) # Remove leading/trailing w...
690
0
"""simple docstring""" from __future__ import annotations def _a ( UpperCAmelCase__ , UpperCAmelCase__ = None , UpperCAmelCase__ = None ) -> None: if start is None: __SCREAMING_SNAKE_CASE = 0 if end is None: __SCREAMING_SNAKE_CASE ...
721
"""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 ...
690
0
"""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, ...
700
"""simple docstring""" def _a ( UpperCAmelCase__ ) -> str: __SCREAMING_SNAKE_CASE = '''''' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def _a ( UpperCAmel...
690
0
"""simple docstring""" import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ =logging.get_logger(__name__) lowerCAmelCase__...
701
"""simple docstring""" from __future__ import annotations import inspect import unittest from typing import List, Tuple from transformers import RegNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_av...
690
0
"""simple docstring""" from timeit import timeit lowerCAmelCase__ ={ "MALAYALAM": True, "String": False, "rotor": True, "level": True, "A": True, "BB": True, "ABC": False, "amanaplanacanalpanama": True, # "a man a plan a canal panama" } # Ensure our test data is valid...
702
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cach...
690
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_...
703
"""simple docstring""" from __future__ import annotations lowerCAmelCase__ =8.9_8_8E9 # units = N * m^s * C^-2 def _a ( UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ) -> dict[str, float]: __SCREAMING_SNAKE_CASE = abs(c...
690
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device f...
704
"""simple docstring""" import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() lowerCAmelCase__ =logging.get_logger(__name__) def _a ( UpperCAmelCase__ ) -> Tuple:...
690
0
import pandas as pd from matplotlib import pyplot as plt from sklearn.linear_model import LinearRegression # Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split # Fitting Polynomial Regression to the dataset from sklearn.preprocessing import PolynomialFeat...
705
"""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/LICEN...
690
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor lowerCAmelCase__ =logging.get_logger(__name__) class A__( __magic_name__ ): def __init__( self : int , *__SCREAMING_...
706
"""simple docstring""" import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class A__( unittest.Tes...
690
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCAmelCase__ ={ "configuration_canine": ["CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP", "CanineConfig"], "tokenization_canine":...
707
"""simple docstring""" import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging if is_torc...
690
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available lowerCAmelCase__ ={"configuration_speech_encoder_decoder": ["SpeechEncoderDecoderConfig"]} try: if not is_torch_available(): raise OptionalDepende...
708
"""simple docstring""" from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCAmelCase__ ={"UserAgent": UserAgent().random} def _a ( UpperCAmelCase__ ) -> dict: __SCREAMING_SNAKE_CASE ...
690
0
"""simple docstring""" import importlib import os import sys # This is required to make the module import works (when the python process is running from the root of the repo) sys.path.append(".") def _a ( UpperCAmelCase__ ) -> Dict: __SCREAMING_SNAKE_CASE = test_file...
709
"""simple docstring""" from sklearn.metrics import recall_score import datasets lowerCAmelCase__ ="\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is the true positives ...
690
0
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingStrategy, logging from .tokenization_realm import Re...
710
"""simple docstring""" def _a ( UpperCAmelCase__ = 10**9 ) -> int: __SCREAMING_SNAKE_CASE = 1 __SCREAMING_SNAKE_CASE = 2 __SCREAMING_SNAKE_CASE = 0 __SCREAMING_SNAKE_CASE = 0 __SCREAMING_SNAKE_CASE = 0 ...
690
0
"""simple docstring""" import argparse import logging import pickle from collections import Counter logging.basicConfig( format="%(asctime)s - %(levelname)s - %(name)s - %(message)s", datefmt="%m/%d/%Y %H:%M:%S", level=logging.INFO ) lowerCAmelCase__ =logging.getLogger(__name__) if __name__ ==...
711
"""simple docstring""" import pandas as pd from matplotlib import pyplot as plt from sklearn.linear_model import LinearRegression # Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split # Fitting Polynomial Regression to the dataset from sklearn.prepr...
690
0
"""simple docstring""" import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.g...
712
"""simple docstring""" from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_conf...
690
0
"""simple docstring""" import math def _a ( UpperCAmelCase__ , UpperCAmelCase__ ) -> float: if initial_intensity < 0: raise ValueError('''The value of intensity cannot be negative''' ) # handling of negative values of initial intensity if ang...
713
"""simple docstring""" from ....configuration_utils import PretrainedConfig from ....utils import logging lowerCAmelCase__ =logging.get_logger(__name__) lowerCAmelCase__ ={ "Visual-Attention-Network/van-base": ( "https://huggingface.co/Visual-Attention-Network/van-base/blob/mai...
690
0
"""simple docstring""" from json import JSONDecodeError # Workaround for requests.exceptions.JSONDecodeError import requests def _a ( UpperCAmelCase__ = "isbn/0140328726" ) -> dict: __SCREAMING_SNAKE_CASE = olid.strip().strip('''/''' ) # Remove leading/trailing w...
714
"""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....
690
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, StableDi...
715
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCAmelCase__ ={ "configuration_altclip": [ "ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP", "AltCLIPConfig", ...
690
0
"""simple docstring""" import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class A__: def __init__( self : List[str] , __SCREAMING_SNAKE_CASE : int=2 , __SCREAMING_SNAKE_CASE...
716
"""simple docstring""" import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transformers.testing_u...
690
0
"""simple docstring""" from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torc...
717
"""simple docstring""" import math lowerCAmelCase__ =10 lowerCAmelCase__ =7 lowerCAmelCase__ =BALLS_PER_COLOUR * NUM_COLOURS def _a ( UpperCAmelCase__ = 20 ) -> str: __SCREAMING_SNAKE_CASE = math.comb(UpperCAmelCase__ , UpperCAmelCase__ ...
690
0
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Dataset from tra...
718
"""simple docstring""" from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_avail...
690
0
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): ...
719
"""simple docstring""" from __future__ import annotations from collections.abc import Callable lowerCAmelCase__ =list[list[float | int]] def _a ( UpperCAmelCase__ , UpperCAmelCase__ ) -> Matrix: __SCREAMING_SNAKE_CASE = len(UpperCAmelCase__ ) __S...
690
0
"""simple docstring""" import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionTextToImagePipeline from diffusers.utils.testing_utils import nightly, require_torch_gpu, torch_device lowerCAmelCase__ =False class A__( unitte...
720
"""simple docstring""" from json import JSONDecodeError # Workaround for requests.exceptions.JSONDecodeError import requests def _a ( UpperCAmelCase__ = "isbn/0140328726" ) -> dict: __SCREAMING_SNAKE_CASE = olid.strip().strip('''/''' ) # Remove leading/trailing w...
690
0
"""simple docstring""" import os import tempfile import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from torch import nn from transformers import ( Adafactor, Ada...
721
"""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 ...
690
0
'''simple docstring''' from __future__ import annotations from collections.abc import Iterator class A : def __init__( self , snake_case_ ) -> None: _a = value _a = None _a = None class A : ...
691
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require...
691
1
'''simple docstring''' from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __snake_case : Tuple = { "configuration_informer": [ "INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", ...
691
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : Tuple = logging.get_logger(__name__) __snake_case : int = { "facebook/wav2vec2-base-960h": "https://huggingface.c...
691
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImagePr...
691
'''simple docstring''' def _lowercase ( lowerCamelCase__ : int, lowerCamelCase__ : int ): return number | (1 << position) def _lowercase ( lowerCamelCase__ : int, lowerCamelCase__ : int ): return number & ~(1 << position) def _lowercase ( lowerCamelCase_...
691
1
'''simple docstring''' import math import qiskit def _lowercase ( lowerCamelCase__ : int = 1, lowerCamelCase__ : int = 1, lowerCamelCase__ : int = 1 ): if ( isinstance(lowerCamelCase__, lowerCamelCase__ ) or isinstance(lowerCamelCase__, lowerCamelCase__ )...
691
'''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 # ...
691
1
'''simple docstring''' import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging __snake_case : Optional[Any] = logging.get_logger(__name__) def _lowercase ( lowe...
691
'''simple docstring''' def _lowercase ( lowerCamelCase__ : list[list] ): _a = current_set.copy() for row_index, row in enumerate(lowerCamelCase__ ): _a = row[0] for column_index, column in enumerate(lowerCamelCase__ ): if mag...
691
1
'''simple docstring''' import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax im...
691
'''simple docstring''' import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unorde...
691
1
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require...
691
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings __snake_case : Optional[int] = R"\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n c...
691
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 __...
691
'''simple docstring''' class A : def __init__( self ) -> List[str]: _a = 0 _a = 0 _a = {} def __lowerCAmelCase ( self , snake_case_ ) -> int: if vertex not in self.adjacency: ...
691
1
'''simple docstring''' import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class A ( unittest.TestCase ): ...
691
'''simple docstring''' import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, f...
691
1
'''simple docstring''' import argparse import re import numpy as np import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SamConfig, SamImageProcessor, SamModel, SamProcessor, SamVisionConfig, ) __snake_case : Union[st...
691
'''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, ) __snake_case : Union[st...
691
1
'''simple docstring''' import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis from lavis.models import load_model_and_preprocess from PIL import Image from transforme...
691
'''simple docstring''' import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput de...
691
1
'''simple docstring''' from collections.abc import Generator from math import sin def _lowercase ( lowerCamelCase__ : bytes ): if len(lowerCamelCase__ ) != 32: raise ValueError("Input must be of length 32" ) _a = b"" for i in [3, 2, 1, 0]: l...
691
'''simple docstring''' def _lowercase ( lowerCamelCase__ : list[int], lowerCamelCase__ : list[int], lowerCamelCase__ : int ): return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(lowerCamelCase__ ) ) def _lowercas...
691
1
'''simple docstring''' import argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def _lowercase ( lowerCamelCase__ : Tuple ): _a = [ "encoder.version", "decoder.version", "model.en...
691
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class A : def __init__( self , snake_case_ ) -> Optional[int]: _a = str(id_ ) _a = None _a = None _a = ...
691
1
'''simple docstring''' # limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401 from .utils...
691
'''simple docstring''' __snake_case : List[str] = "Tobias Carryer" from time import time class A : def __init__( self , snake_case_ , snake_case_ , snake_case_ , snake_case_=int(time() ) ) -> str: # noqa: B008 _a = mul...
691
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig class A ( a ): __UpperCAmelCase : List[str] = """bert-generation""" def __init__( self , snake_case_=5_0_3_5_8 , snake_case_=1_0_2_4 , snake_case_=2_4 , snake_case_=...
691
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/facebook/musicgen-small...
691
1
'''simple docstring''' from math import factorial def _lowercase ( lowerCamelCase__ : int = 100 ): return sum(map(lowerCamelCase__, str(factorial(lowerCamelCase__ ) ) ) ) if __name__ == "__main__": print(solution(int(input("Enter the Number: ").strip()))) ...
691
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __snake_case : int = { "configuration_bloom": ["BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP", "BloomConfig", "BloomOnnxConfig"],...
691
1
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_available, is_tf_a...
691
'''simple docstring''' from ..utils import DummyObject, requires_backends class A ( metaclass=a ): __UpperCAmelCase : int = ["""torch""", """scipy"""] def __init__( self , *snake_case_ , **snake_case_ ) -> Tuple: requires_backends(self ...
691
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 f...
691
'''simple docstring''' __snake_case : Dict = { "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", ...
691
1
'''simple docstring''' from __future__ import annotations from dataclasses import dataclass @dataclass class A : __UpperCAmelCase : float __UpperCAmelCase : TreeNode | None = None __UpperCAmelCase : TreeNode | None = None def _lowerc...
691
'''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 imp...
691
1
'''simple docstring''' 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 fr...
691
'''simple docstring''' import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCal...
691
1
'''simple docstring''' import argparse import os import torch from transformers.utils import WEIGHTS_NAME __snake_case : Dict = ["small", "medium", "large"] __snake_case : Optional[int] = "lm_head.decoder.weight" __snake_case : Optional[int] = "lm_...
691
'''simple docstring''' # Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def _lowercase ( lowerCamelCase__ : Any, lowerCamelCase__ : Optional[int], lowerCamelCase__ : Dict, lowerCamelCase__ : List[str] ): _a = { "en": "Machine learning is ...
691
1
'''simple docstring''' from ..utils import ( OptionalDependencyNotAvailable, is_flax_available, is_scipy_available, is_torch_available, is_torchsde_available, ) try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailabl...
691
'''simple docstring''' import json from typing import 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 .tokenization_mvp impor...
691
1
'''simple docstring''' from ..utils import DummyObject, requires_backends class A ( metaclass=a ): __UpperCAmelCase : int = ["""torch""", """scipy"""] def __init__( self , *snake_case_ , **snake_case_ ) -> Tuple: requires_backends(self ...
691
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require...
691
1
'''simple docstring''' import enum import shutil import sys __snake_case , __snake_case : List[Any] = shutil.get_terminal_size() __snake_case : int = {"UP": "A", "DOWN": "B", "RIGHT": "C", "LEFT": "D"} class A ( enum.Enum ): __UpperCAmelCase ...
691
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : Tuple = logging.get_logger(__name__) __snake_case : int = { "facebook/wav2vec2-base-960h": "https://huggingface.c...
691
1
'''simple docstring''' import collections import importlib.util import os import re from pathlib import Path __snake_case : List[str] = "src/transformers" # Matches is_xxx_available() __snake_case : Optional[Any] = re.compile(R"is\_([a-z_]*)_available()") # Catches a o...
691
'''simple docstring''' def _lowercase ( lowerCamelCase__ : int, lowerCamelCase__ : int ): return number | (1 << position) def _lowercase ( lowerCamelCase__ : int, lowerCamelCase__ : int ): return number & ~(1 << position) def _lowercase ( lowerCamelCase_...
691
1
'''simple docstring''' def _lowercase ( lowerCamelCase__ : list[list] ): _a = current_set.copy() for row_index, row in enumerate(lowerCamelCase__ ): _a = row[0] for column_index, column in enumerate(lowerCamelCase__ ): if mag...
691
'''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 # ...
691
1
'''simple docstring''' def _lowercase ( lowerCamelCase__ : list ): if len(lowerCamelCase__ ) <= 1: return [tuple(lowerCamelCase__ )] _a = [] def generate(lowerCamelCase__ : int, lowerCamelCase__ : list ): if k == 1: res.a...
691
'''simple docstring''' def _lowercase ( lowerCamelCase__ : list[list] ): _a = current_set.copy() for row_index, row in enumerate(lowerCamelCase__ ): _a = row[0] for column_index, column in enumerate(lowerCamelCase__ ): if mag...
691
1
'''simple docstring''' import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets __snake_case : Optional[int] = "\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin...
691
'''simple docstring''' import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unorde...
691
1
'''simple docstring''' import inspect import unittest import warnings from transformers import DeiTConfig from transformers.models.auto import get_values from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) f...
691
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings __snake_case : Optional[int] = R"\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n c...
691
1
'''simple docstring''' from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand __snake_case : List[Any] = logging.get_logger(__name__) # pylint: disable=inv...
691
'''simple docstring''' class A : def __init__( self ) -> List[str]: _a = 0 _a = 0 _a = {} def __lowerCAmelCase ( self , snake_case_ ) -> int: if vertex not in self.adjacency: ...
691
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __snake_case : Dict = logging.get_logger(__name__) __snake_case : Tuple ...
691
'''simple docstring''' import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, f...
691
1
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, PNDMScheduler, StableDiffusionLDMaDPipeline, UNetaDConditionModel, ) from diffusers.ut...
691
'''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, ) __snake_case : Union[st...
691
1
'''simple docstring''' import argparse import os import re __snake_case : str = "src/diffusers" # Pattern that looks at the indentation in a line. __snake_case : Optional[int] = re.compile(R"^(\s*)\S") # Pattern that matches `"key":" and puts `key` in group 0. __snake_c...
691
'''simple docstring''' import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput de...
691
1
'''simple docstring''' def _lowercase ( lowerCamelCase__ : int, lowerCamelCase__ : int ): return number | (1 << position) def _lowercase ( lowerCamelCase__ : int, lowerCamelCase__ : int ): return number & ~(1 << position) def _lowercase ( lowerCamelCase_...
691
'''simple docstring''' def _lowercase ( lowerCamelCase__ : list[int], lowerCamelCase__ : list[int], lowerCamelCase__ : int ): return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(lowerCamelCase__ ) ) def _lowercas...
691
1
'''simple docstring''' import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput de...
691
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class A : def __init__( self , snake_case_ ) -> Optional[int]: _a = str(id_ ) _a = None _a = None _a = ...
691
1
'''simple docstring''' import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class A ( a ): __UpperCAmelCase : ...
691
'''simple docstring''' __snake_case : List[str] = "Tobias Carryer" from time import time class A : def __init__( self , snake_case_ , snake_case_ , snake_case_ , snake_case_=int(time() ) ) -> str: # noqa: B008 _a = mul...
691
1
'''simple docstring''' import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow __snake_case : Optional[Any] = False class A ( unittest.TestCase ): ...
691
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/facebook/musicgen-small...
691
1
'''simple docstring''' import string from math import logaa def _lowercase ( lowerCamelCase__ : str, lowerCamelCase__ : str ): _a = document.translate( str.maketrans("", "", string.punctuation ) ).replace("\n", "" ) _a = document_w...
691
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __snake_case : int = { "configuration_bloom": ["BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP", "BloomConfig", "BloomOnnxConfig"],...
691
1
'''simple docstring''' import math import unittest def _lowercase ( lowerCamelCase__ : int ): assert isinstance(lowerCamelCase__, lowerCamelCase__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: # 2 and 3 are primes ...
691
'''simple docstring''' from ..utils import DummyObject, requires_backends class A ( metaclass=a ): __UpperCAmelCase : int = ["""torch""", """scipy"""] def __init__( self , *snake_case_ , **snake_case_ ) -> Tuple: requires_backends(self ...
691
1
'''simple docstring''' import enum import warnings from .. import MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING from ..utils import add_end_docstrings, is_tf_available from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf class A ( enum.Enu...
691
'''simple docstring''' __snake_case : Dict = { "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", ...
691
1
'''simple docstring''' from __future__ import annotations class A : def __init__( self , snake_case_=None ) -> Any: _a = data _a = None def __repr__( self ) -> Optional[int]: _a = [] _a ...
691
'''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 imp...
691
1
'''simple docstring''' import random import unittest import numpy as np from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionImgaImgPipeline, PNDMScheduler, ) from diffusers.utils import fl...
691
'''simple docstring''' import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCal...
691
1
'''simple docstring''' from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, Ten...
691
'''simple docstring''' # Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def _lowercase ( lowerCamelCase__ : Any, lowerCamelCase__ : Optional[int], lowerCamelCase__ : Dict, lowerCamelCase__ : List[str] ): _a = { "en": "Machine learning is ...
691
1
'''simple docstring''' from typing import Optional, Tuple import jax import jax.numpy as jnp from flax import linen as nn from flax.core.frozen_dict import FrozenDict from transformers import CLIPConfig, FlaxPreTrainedModel from transformers.models.clip.modeling_flax_clip import FlaxCLIPVisionModule def ...
691
'''simple docstring''' import json from typing import 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 .tokenization_mvp impor...
691
1
'''simple docstring''' from datetime import datetime import requests def _lowercase ( lowerCamelCase__ : str ): _a = "https://downloadgram.net/wp-json/wppress/video-downloader/video?url=" _a = requests.get(base_url + url ).json()[0]["urls"][0]["src"] ...
691
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require...
691
1
'''simple docstring''' import socket def _lowercase ( ): _a = socket.socket(socket.AF_INET, socket.SOCK_STREAM ) _a = socket.gethostname() _a = 12_312 sock.connect((host, port) ) sock.send(b"Hello server!" ) with open("R...
691
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : Tuple = logging.get_logger(__name__) __snake_case : int = { "facebook/wav2vec2-base-960h": "https://huggingface.c...
691
1
'''simple docstring''' import requests from bsa import BeautifulSoup def _lowercase ( lowerCamelCase__ : str = "https://www.worldometers.info/coronavirus" ): _a = BeautifulSoup(requests.get(lowerCamelCase__ ).text, "html.parser" ) _a = soup.findAll(...
691
'''simple docstring''' def _lowercase ( lowerCamelCase__ : int, lowerCamelCase__ : int ): return number | (1 << position) def _lowercase ( lowerCamelCase__ : int, lowerCamelCase__ : int ): return number & ~(1 << position) def _lowercase ( lowerCamelCase_...
691
1
'''simple docstring''' def _lowercase ( lowerCamelCase__ : Any, lowerCamelCase__ : Any ): _a = [1] for i in range(2, lowerCamelCase__ ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" _a = ...
691
'''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 # ...
691
1
'''simple docstring''' from manim import * class A ( a ): def __lowerCAmelCase ( self ) -> str: _a = Rectangle(height=0.5 , width=0.5 ) _a = Rectangle(height=0.25 , width=0.25 ) _a = Rectangle(height=...
691
'''simple docstring''' def _lowercase ( lowerCamelCase__ : list[list] ): _a = current_set.copy() for row_index, row in enumerate(lowerCamelCase__ ): _a = row[0] for column_index, column in enumerate(lowerCamelCase__ ): if mag...
691
1
'''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 __snake_case : Dict = ...
691
'''simple docstring''' import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unorde...
691
1
'''simple docstring''' import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSample...
691
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings __snake_case : Optional[int] = R"\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n c...
691
1
'''simple docstring''' import torch from torch import nn class A ( nn.Module ): def __init__( self , snake_case_ , snake_case_ , snake_case_ , snake_case_ , snake_case_=1 , snake_case_=False ) -> List[Any]: super().__init__() ...
691
'''simple docstring''' class A : def __init__( self ) -> List[str]: _a = 0 _a = 0 _a = {} def __lowerCAmelCase ( self , snake_case_ ) -> int: if vertex not in self.adjacency: ...
691
1
'''simple docstring''' from abc import ABC, abstractmethod from argparse import ArgumentParser class A ( a ): @staticmethod @abstractmethod def __lowerCAmelCase ( snake_case_ ) -> str: raise NotImplementedError() @abstractmethod def __lowe...
691
'''simple docstring''' import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, f...
691
1
'''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_DOCSTRING, BERT_START_D...
691
'''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, ) __snake_case : Union[st...
691
1
'''simple docstring''' def _lowercase ( lowerCamelCase__ : int, lowerCamelCase__ : int ): if b == 0: return 1 if (b % 2) == 0: return actual_power(lowerCamelCase__, int(b / 2 ) ) * actual_power(lowerCamelCase__, int(b / 2 ) ) else: r...
691
'''simple docstring''' import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput de...
691
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_segformer import SegformerImageProcessor __snake_case : Optional[Any] = logging.get_logger(__name__) class A ( a ): def __init__( self , *snake_case_ , **snake_cas...
691
'''simple docstring''' def _lowercase ( lowerCamelCase__ : list[int], lowerCamelCase__ : list[int], lowerCamelCase__ : int ): return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(lowerCamelCase__ ) ) def _lowercas...
691
1
'''simple docstring''' def _lowercase ( lowerCamelCase__ : list ): if not isinstance(lowerCamelCase__, lowerCamelCase__ ): raise ValueError("Input series is not valid, valid series - [2, 4, 6]" ) if len(lowerCamelCase__ ) == 0: raise ValueError("Input li...
691
'''simple docstring''' import heapq as hq import math from collections.abc import Iterator class A : def __init__( self , snake_case_ ) -> Optional[int]: _a = str(id_ ) _a = None _a = None _a = ...
691
1
'''simple docstring''' import numpy # List of input, output pairs __snake_case : List[str] = ( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) __snake_case : Tuple = (((515, 22, 13), 555), ((61, 35, 49), 150)...
691
'''simple docstring''' __snake_case : List[str] = "Tobias Carryer" from time import time class A : def __init__( self , snake_case_ , snake_case_ , snake_case_ , snake_case_=int(time() ) ) -> str: # noqa: B008 _a = mul...
691
1
'''simple docstring''' import inspect import os import unittest from dataclasses import dataclass import torch from accelerate import Accelerator, DistributedDataParallelKwargs, GradScalerKwargs from accelerate.state import AcceleratorState from accelerate.test_utils import execute_subprocess_async, require_cu...
691
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/facebook/musicgen-small...
691
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, PNDMScheduler, StableDiffusionInpaintPipeline, UNetaDConditionModel from diffusers.util...
691
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __snake_case : int = { "configuration_bloom": ["BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP", "BloomConfig", "BloomOnnxConfig"],...
691
1
'''simple docstring''' import time import warnings from abc import ABC from copy import deepcopy from typing import Optional import torch from ..utils import add_start_docstrings, logging __snake_case : Optional[int] = logging.get_logger(__name__) __snake_case : Tuple = ...
691
'''simple docstring''' from ..utils import DummyObject, requires_backends class A ( metaclass=a ): __UpperCAmelCase : int = ["""torch""", """scipy"""] def __init__( self , *snake_case_ , **snake_case_ ) -> Tuple: requires_backends(self ...
691
1
'''simple docstring''' import math def _lowercase ( lowerCamelCase__ : float, lowerCamelCase__ : float ): if ( not isinstance(lowerCamelCase__, (int, float) ) or power_factor < -1 or power_factor > 1 ): raise ValueError("power_factor must be a v...
691
'''simple docstring''' __snake_case : Dict = { "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", ...
691
1
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_chan...
691
'''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 imp...
691
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 imp...
691
'''simple docstring''' import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCal...
691
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 # ...
691
'''simple docstring''' # Usage: # ./gen-card-allenai-wmt16.py import os from pathlib import Path def _lowercase ( lowerCamelCase__ : Any, lowerCamelCase__ : Optional[int], lowerCamelCase__ : Dict, lowerCamelCase__ : List[str] ): _a = { "en": "Machine learning is ...
691
1
'''simple docstring''' import sys def _lowercase ( lowerCamelCase__ : Dict ): _a = len(lowerCamelCase__ ) _a = [[0 for x in range(lowerCamelCase__ )] for x in range(lowerCamelCase__ )] _a = [[0 for x in range(lowerCamelCase__ ...
691
'''simple docstring''' import json from typing import 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 .tokenization_mvp impor...
691
1
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/facebook/musicgen-small...
691
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require...
691
1
'''simple docstring''' from __future__ import annotations def _lowercase ( lowerCamelCase__ : list[int | str] ): create_state_space_tree(lowerCamelCase__, [], 0, [0 for i in range(len(lowerCamelCase__ ) )] ) def _lowercase ( lowerCamelCase__ : list[int | s...
691
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case : Tuple = logging.get_logger(__name__) __snake_case : int = { "facebook/wav2vec2-base-960h": "https://huggingface.c...
691
1
'''simple docstring''' import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transformers.testing_utils...
691
'''simple docstring''' def _lowercase ( lowerCamelCase__ : int, lowerCamelCase__ : int ): return number | (1 << position) def _lowercase ( lowerCamelCase__ : int, lowerCamelCase__ : int ): return number & ~(1 << position) def _lowercase ( lowerCamelCase_...
691
1
'''simple docstring''' from dataclasses import dataclass from typing import Tuple import numpy as np import torch @dataclass class A : __UpperCAmelCase : torch.Tensor # [batch_size x 3] __UpperCAmelCase : torch.Tensor # [batch_size x 3] __UpperCAmelCase : torch....
691
'''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 # ...
691
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __snake_case : Dict = { "configuration_time_series_transformer": [ "TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "Time...
691
'''simple docstring''' def _lowercase ( lowerCamelCase__ : list[list] ): _a = current_set.copy() for row_index, row in enumerate(lowerCamelCase__ ): _a = row[0] for column_index, column in enumerate(lowerCamelCase__ ): if mag...
691
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 impo...
691
'''simple docstring''' import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unorde...
691
1
'''simple docstring''' __snake_case : Dict = { "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", ...
691
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings __snake_case : Optional[int] = R"\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n c...
691
1