code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : List[Any] = logging.get_logger(__name__) A_ : str = { 'microsoft/markuplm-base': 'https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json', 'microsoft/markuplm-large...
370
import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py A_ : List[str] = '.' if __name__ == "__main__": A_ : Dict = os.path.join(REPO_PATH, 'utils/documentation_tests.txt') ...
292
0
import re import time from typing import Optional import IPython.display as disp from ..trainer_callback import TrainerCallback from ..trainer_utils import IntervalStrategy, has_length def snake_case (UpperCAmelCase__ ) -> Optional[Any]: UpperCamelCase_: List[Any] = int(__lowerCAmelCase ) ...
371
import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...t...
292
0
def snake_case (UpperCAmelCase__ = 6_0_0_8_5_1_4_7_5_1_4_3 ) -> int: """simple docstring""" try: UpperCamelCase_: Dict = int(UpperCAmelCase__ ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <=...
350
import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def snake_case (UpperCAmelCase__ ) -> tuple: return (data["data...
292
0
import random import unittest import torch from diffusers import IFInpaintingPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params import ( ...
351
import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import TokenizerTester...
292
0
from sklearn.metrics import recall_score import datasets A_ : Any = '\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 and FN is the false ...
352
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Tuple = logging.get_logger(__name__) A_ : Dict = { 'facebook/xglm-564M': 'https://huggingface.co/facebook/xglm-564M/resolve/main/config.json', # See all XGLM models at https://huggi...
292
0
"""simple docstring""" from __future__ import annotations A_ : List[str] = [] def snake_case (UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ) -> bool: for i in range(len(UpperCAmelCase__ ) ): if board[row][i] == 1: return False for i ...
353
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) A_ : Tuple = { 'configuration_funnel': ['FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FunnelConfi...
292
0
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/r...
354
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A_ : List[Any] = logging.get_logger(__name__) A_ : Optional[Any] = { 'YituTech/conv-bert-bas...
292
0
import unittest from transformers import ( MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING, TextGenerationPipeline, logging, pipeline, ) from transformers.testing_utils import ( CaptureLogger, is_pipeline_test, require_accelerate, require_tf, ...
355
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_channel_d...
292
0
import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class _lowerCAmelCase: """simple docstring""" def __init__( self , _lowerCamelCase=2 , _lowerCamelCase=3 ,...
356
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _lowerCAmelCase( unittest....
292
0
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_download, hf_hub_url from PIL import Image from transformers import DetaConfig, DetaForObjectDetection, DetaImageProcessor, SwinConfig from transformers.utils imp...
357
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @requ...
292
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging A_ : Any = logging.get_logger(__name__) A_ : Tuple = {'vocab_file': ...
358
from abc import ABC, abstractmethod from argparse import ArgumentParser class _lowerCAmelCase( UpperCAmelCase_ ): """simple docstring""" @staticmethod @abstractmethod def _a ( _lowerCamelCase ): raise NotImplemen...
292
0
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 from diffusers.utils.testing_util...
359
def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> int: while b: UpperCamelCase_ ,UpperCamelCase_: int = b, a % b return a def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> int: return a if b == 0 else euclidean_gcd_recursive(UpperCAmelCase...
292
0
"""simple docstring""" from __future__ import annotations from collections.abc import Generator def snake_case () -> Generator[int, None, None]: UpperCamelCase_: dict[int, int] = {} UpperCamelCase_: Union[str, Any] = 2 while True: UpperCamelCase_: Dict ...
360
import unittest from transformers import RoFormerTokenizer, RoFormerTokenizerFast from transformers.testing_utils import require_rjieba, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_rjieba @require_tokenizers class _lowerCAmelCase( UpperCAm...
292
0
# Lint as: python3 import itertools import os import re A_ : Dict = re.compile(r'([A-Z]+)([A-Z][a-z])') A_ : List[str] = re.compile(r'([a-z\d])([A-Z])') A_ : Optional[int] = re.compile(r'(?<!_)_(?!_)') A_ : Tuple = re.compile(r'(_{2,})') A_ : Tuple = r'^\w+(\...
361
# A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and v to U. We can a...
292
0
import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ....
362
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertToken...
292
0
from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def snake_case (UpperCAmelCase__ ) -> None: UpperCamelCase_: Dict = analyze_text(UpperCAmelCase__ ) UpperCamelCase_: List[str] = list(' ' + ascii_lowerca...
363
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def snake_case (UpperCAmelCase__ , UpperCAmelCase__=() , UpperCAmelCase__=None , UpperCAmelCase__="n...
292
0
"""simple docstring""" import math from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : int = logging.get_logger(__name__) A_ : str = { 'facebook/data2vec-base-960h': 'https://huggingface.co/facebook/data2vec-audio-base-960h/re...
364
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
292
0
import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class _lowerCAmelCase( unittest.TestCase ): """simple docstring""" def _a ( self ): UpperCamelCase_: Tuple = [ 'sa...
365
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() A_ : str = [ 'word_embeddings_la...
292
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...im...
366
import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configuration_pegasus import DEFAULTS...
292
0
import os import zipfile import pytest from datasets.utils.extract import ( BzipaExtractor, Extractor, GzipExtractor, LzaExtractor, SevenZipExtractor, TarExtractor, XzExtractor, ZipExtractor, ZstdExtractor, ) from .utils import require_lza, require_p...
367
def snake_case (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: UpperCamelCase_: List[Any] = F'''The input value of [n={number}]...
292
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A_ : List[Any] = logging.get_logger(__name__) A_ : Optional[Any] = { 'YituTech/conv-bert-base'...
368
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_unordered...
292
0
from abc import ABC, abstractmethod from argparse import ArgumentParser class _lowerCAmelCase( UpperCAmelCase_ ): """simple docstring""" @staticmethod @abstractmethod def _a ( _lowerCamelCase ): raise NotImplemen...
369
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> np.array: UpperCamelCase_: Dict = F'''{sampling_rate}''' UpperCamelCase_: Any = '1' UpperC...
292
0
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class _lowerCAmelCase: """simple docstring""" a : Union[str, Any] =None def _a ( self ): ...
370
import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py A_ : List[str] = '.' if __name__ == "__main__": A_ : Dict = os.path.join(REPO_PATH, 'utils/documentation_tests.txt') ...
292
0
def snake_case (UpperCAmelCase__ = 1_0_0_0 ) -> int: UpperCamelCase_: List[Any] = 2**power UpperCamelCase_: Any = str(UpperCAmelCase__ ) UpperCamelCase_: Union[str, Any] = list(UpperCAmelCase__ ) UpperCamelCase_: str = 0 for i in list_num: sum_of_num += ...
371
import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...t...
292
0
def snake_case (UpperCAmelCase__ ) -> "list[int]": """simple docstring""" if upper_limit < 0: raise ValueError('Limit for the Catalan sequence must be ≥ 0' ) UpperCamelCase_: Optional[int] = [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 Up...
350
import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def snake_case (UpperCAmelCase__ ) -> tuple: return (data["data...
292
0
import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, require_tf, ...
351
import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import TokenizerTester...
292
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging A_ : Union[str, Any] = logging.get_logger(__name__) A_ : Union[s...
352
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Tuple = logging.get_logger(__name__) A_ : Dict = { 'facebook/xglm-564M': 'https://huggingface.co/facebook/xglm-564M/resolve/main/config.json', # See all XGLM models at https://huggi...
292
0
"""simple docstring""" import heapq import sys import numpy as np A_ : List[str] = tuple[int, int] class _lowerCAmelCase: """simple docstring""" def __init__( self ): UpperCamelCase_: Any = [] ...
353
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) A_ : Tuple = { 'configuration_funnel': ['FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FunnelConfi...
292
0
def snake_case (UpperCAmelCase__ ) -> int: if n == 1 or not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): return 0 elif n == 2: return 1 else: UpperCamelCase_: Optional[int] = [0, 1] for i in range(2 , n + 1 ): sequence.append(sequence[i...
354
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A_ : List[Any] = logging.get_logger(__name__) A_ : Optional[Any] = { 'YituTech/conv-bert-bas...
292
0
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_available,...
355
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_channel_d...
292
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : int = { 'configuration_upernet': ['UperNetConfig'], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDe...
356
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _lowerCAmelCase( unittest....
292
0
from __future__ import annotations import requests A_ : Dict = set( 'approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post category clicked content_categories created_...
357
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @requ...
292
0
import webbrowser from sys import argv from urllib.parse import parse_qs, quote import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": A_ : List[str] = '%20'.join(argv[1:]) if len(argv) > 1 else quote(str(input('Search: '))) ...
358
from abc import ABC, abstractmethod from argparse import ArgumentParser class _lowerCAmelCase( UpperCAmelCase_ ): """simple docstring""" @staticmethod @abstractmethod def _a ( _lowerCamelCase ): raise NotImplemen...
292
0
from abc import ABC, abstractmethod from argparse import ArgumentParser class _lowerCAmelCase( UpperCAmelCase_ ): """simple docstring""" @staticmethod @abstractmethod def _a ( _lowerCamelCase ): raise NotImplemen...
359
def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> int: while b: UpperCamelCase_ ,UpperCamelCase_: int = b, a % b return a def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> int: return a if b == 0 else euclidean_gcd_recursive(UpperCAmelCase...
292
0
"""simple docstring""" from __future__ import annotations from cmath import sqrt def snake_case (UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ) -> tuple[complex, complex]: if a == 0: raise ValueError('Coefficient \'a\' must not be zero.' ) UpperCame...
360
import unittest from transformers import RoFormerTokenizer, RoFormerTokenizerFast from transformers.testing_utils import require_rjieba, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_rjieba @require_tokenizers class _lowerCAmelCase( UpperCAm...
292
0
from argparse import ArgumentParser, Namespace from ..utils import logging from . import BaseTransformersCLICommand def snake_case (UpperCAmelCase__ ) -> Optional[int]: return ConvertCommand( args.model_type , args.tf_checkpoint , args.pytorch_dump_output , args.config , a...
361
# A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and v to U. We can a...
292
0
import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoFeatureExtractor, WavaVecaFeatureExtractor from transformers.testing_utils i...
362
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertToken...
292
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A_ = {'configuration_plbart': ['PLBART_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PLBartConfig']} ...
363
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def snake_case (UpperCAmelCase__ , UpperCAmelCase__=() , UpperCAmelCase__=None , UpperCAmelCase__="n...
292
0
"""simple docstring""" def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> Optional[int]: UpperCamelCase_: Optional[Any] = [0 for i in range(r + 1 )] # nc0 = 1 UpperCamelCase_: Union[str, Any] = 1 for i in range(1 , n + 1 ): # to compute...
364
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
292
0
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : int = logging.get_logger(__name__) A_ : List[str] = { 'naver-clova-ix/donut-base': 'https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json', # See all Donut model...
365
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() A_ : str = [ 'word_embeddings_la...
292
0
"""simple docstring""" import gc import inspect import unittest import torch from parameterized import parameterized from diffusers import PriorTransformer from diffusers.utils import floats_tensor, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_fu...
366
import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configuration_pegasus import DEFAULTS...
292
0
from collections import namedtuple import requests from lxml import html # type: ignore A_ : int = namedtuple('covid_data', 'cases deaths recovered') def snake_case (UpperCAmelCase__ = "https://www.worldometers.info/coronavirus/" ) -> covid_data: UpperCamelCase_: Union[str, A...
367
def snake_case (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: UpperCamelCase_: List[Any] = F'''The input value of [n={number}]...
292
0
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : List[str] = logging.get_logger(__name__) A_ : int = {'ctrl': 'https://huggingface.co/ctrl/resolve/main/config.json'} class _lowerCAmelCase( UpperCAmelCase_ ): """...
368
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_unordered...
292
0
import heapq as hq import math from collections.abc import Iterator class _lowerCAmelCase: """simple docstring""" def __init__( self , _lowerCamelCase ): UpperCamelCase_: Dict = str(id_ ) UpperCamelCase_:...
369
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> np.array: UpperCamelCase_: Dict = F'''{sampling_rate}''' UpperCamelCase_: Any = '1' UpperC...
292
0
import unittest from transformers import MPNetConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from ...t...
370
import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py A_ : List[str] = '.' if __name__ == "__main__": A_ : Dict = os.path.join(REPO_PATH, 'utils/documentation_tests.txt') ...
292
0
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_channel_dimension_format, )...
371
import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...t...
292
0
from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common im...
350
import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def snake_case (UpperCAmelCase__ ) -> tuple: return (data["data...
292
0
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput...
351
import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import TokenizerTester...
292
0
from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin ...
352
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Tuple = logging.get_logger(__name__) A_ : Dict = { 'facebook/xglm-564M': 'https://huggingface.co/facebook/xglm-564M/resolve/main/config.json', # See all XGLM models at https://huggi...
292
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available A_ : str = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDepen...
353
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) A_ : Tuple = { 'configuration_funnel': ['FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FunnelConfi...
292
0
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def snake_case (UpperCAmelCase__ , UpperCAmelCase__=() , UpperCAmelCase__=None , UpperCAmelCase__="n...
354
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A_ : List[Any] = logging.get_logger(__name__) A_ : Optional[Any] = { 'YituTech/conv-bert-bas...
292
0
import math class _lowerCAmelCase: """simple docstring""" def _a ( self , _lowerCamelCase , _lowerCamelCase ): UpperCamelCase_: List[Any] = 0.0 UpperCamelCase_: List[str] = 0.0 fo...
355
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_channel_d...
292
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Optional[int] = logging.get_logger(__name__) A_ : str = { 'BridgeTower/bridgetower-base': 'https://huggingface.co/BridgeTower/bridgeto...
356
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _lowerCAmelCase( unittest....
292
0
import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMix...
357
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @requ...
292
0
import pytest import datasets.config from datasets.utils.info_utils import is_small_dataset @pytest.mark.parametrize('dataset_size' , [None, 4_0_0 * 2**2_0, 6_0_0 * 2**2_0] ) @pytest.mark.parametrize('input_in_memory_max_size' , ['default', 0, 1_0_0 * 2**2_0, 9_0_0 * 2**2_0] ) def ...
358
from abc import ABC, abstractmethod from argparse import ArgumentParser class _lowerCAmelCase( UpperCAmelCase_ ): """simple docstring""" @staticmethod @abstractmethod def _a ( _lowerCamelCase ): raise NotImplemen...
292
0
from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass class _...
359
def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> int: while b: UpperCamelCase_ ,UpperCamelCase_: int = b, a % b return a def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> int: return a if b == 0 else euclidean_gcd_recursive(UpperCAmelCase...
292
0
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary # Register SEW's fairseq modules from sew_asapp import tasks # noqa: F401 from transformers import ( SEWConfig, SEWForCTC, SEWModel, Wava...
360
import unittest from transformers import RoFormerTokenizer, RoFormerTokenizerFast from transformers.testing_utils import require_rjieba, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_rjieba @require_tokenizers class _lowerCAmelCase( UpperCAm...
292
0
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_configuration_common import Confi...
361
# A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and v to U. We can a...
292
0
def snake_case (UpperCAmelCase__ ) -> bool: if num < 0: return False UpperCamelCase_: int = num UpperCamelCase_: int = 0 while num > 0: UpperCamelCase_: str = rev_num * 1_0 + (num % 1_0) num //= 1_0 return num_copy == rev_num if __nam...
362
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertToken...
292
0
def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> None: UpperCamelCase_: Tuple = len(UpperCAmelCase__ ) print('The following activities are selected:' ) # The first activity is always selected UpperCamelCase_: Dict = 0 print(UpperCAmelCase__ , ...
363
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def snake_case (UpperCAmelCase__ , UpperCAmelCase__=() , UpperCAmelCase__=None , UpperCAmelCase__="n...
292
0
"""simple docstring""" from typing import Callable, Dict, Optional, Tuple import torch from torch import nn from torch.distributions import ( AffineTransform, Distribution, Independent, NegativeBinomial, Normal, StudentT, TransformedDistribution, ) ...
364
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
292
0
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler,...
365
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() A_ : str = [ 'word_embeddings_la...
292
0
"""simple docstring""" import math import flax.linen as nn import jax.numpy as jnp def snake_case (UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ = 1 , UpperCAmelCase__ = 1 , UpperCAmelCase__ = 1.0E4 , UpperCAmelCase__ = False , UpperCAmelCase_...
366
import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configuration_pegasus import DEFAULTS...
292
0
from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concatenate_iterable...
367
def snake_case (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: UpperCamelCase_: List[Any] = F'''The input value of [n={number}]...
292
0
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> List[str]: UpperCamelCase_: List[str] ...
368
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_unordered...
292
0
import unittest from transformers import RoFormerTokenizer, RoFormerTokenizerFast from transformers.testing_utils import require_rjieba, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_rjieba @require_tokenizers class _lowerCAmelCase( UpperCAm...
369
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> np.array: UpperCamelCase_: Dict = F'''{sampling_rate}''' UpperCamelCase_: Any = '1' UpperC...
292
0
def snake_case (UpperCAmelCase__ ) -> bool: if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): UpperCamelCase_: Optional[Any] = F'''Input value of [number={number}] must be an integer''' raise TypeError(UpperCAmelCase__ ) if number < 0: return False Upp...
370
import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py A_ : List[str] = '.' if __name__ == "__main__": A_ : Dict = os.path.join(REPO_PATH, 'utils/documentation_tests.txt') ...
292
0
import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def snake_case (UpperCAmelCase__ ) -> Union[str, Any]: # vision encoder if "img_encoder.pos_embed" in name: UpperCamelCase_: Union[str, Any] = name.re...
371
import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...t...
292
0
import re def snake_case (UpperCAmelCase__ ) -> bool: """simple docstring""" UpperCamelCase_: List[str] = re.compile( R'^(?:0|94|\+94|0{2}94)' R'7(0|1|2|4|5|6|7|8)' R'(-| |)' R'\d{7}$' ) return bool(re.search(UpperCAmelCase__ , UpperCAmelCase_...
350
import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def snake_case (UpperCAmelCase__ ) -> tuple: return (data["data...
292
0
def snake_case (UpperCAmelCase__ , UpperCAmelCase__ = False ) -> str: if not isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): UpperCamelCase_: Optional[int] = F'''Expected string as input, found {type(UpperCAmelCase__ )}''' raise ValueError(UpperCAmelCase__ ) ...
351
import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import TokenizerTester...
292
0
from math import factorial def snake_case (UpperCAmelCase__ = 1_0_0 ) -> int: return sum(int(UpperCAmelCase__ ) for x in str(factorial(UpperCAmelCase__ ) ) ) if __name__ == "__main__": print(solution(int(input('Enter the Number: ').strip())))
352
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Tuple = logging.get_logger(__name__) A_ : Dict = { 'facebook/xglm-564M': 'https://huggingface.co/facebook/xglm-564M/resolve/main/config.json', # See all XGLM models at https://huggi...
292
0
"""simple docstring""" import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, ...
353
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) A_ : Tuple = { 'configuration_funnel': ['FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FunnelConfi...
292
0
import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp ...
354
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A_ : List[Any] = logging.get_logger(__name__) A_ : Optional[Any] = { 'YituTech/conv-bert-bas...
292
0
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_unordered...
355
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_channel_d...
292
0
A_ : List[str] = [ 'DownloadConfig', 'DownloadManager', 'DownloadMode', 'StreamingDownloadManager', ] from .download_config import DownloadConfig from .download_manager import DownloadManager, DownloadMode from .streaming_download_manager import StreamingDownloadManager...
356
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _lowerCAmelCase( unittest....
292
0
A_ : List[Any] = { 'a': 'AAAAA', 'b': 'AAAAB', 'c': 'AAABA', 'd': 'AAABB', 'e': 'AABAA', 'f': 'AABAB', 'g': 'AABBA', 'h': 'AABBB', 'i': 'ABAAA', 'j': 'BBBAA', 'k': 'ABAAB', 'l': 'ABABA', 'm': 'ABABB', 'n': 'ABBAA', 'o': 'AB...
357
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @requ...
292
0
import numpy as np def snake_case (UpperCAmelCase__ ) -> np.array: return 1 / (1 + np.exp(-vector )) def snake_case (UpperCAmelCase__ ) -> np.array: return vector * sigmoid(1.702 * vector ) if __name__ == "__main__": import doctest doctest.testmod()
358
from abc import ABC, abstractmethod from argparse import ArgumentParser class _lowerCAmelCase( UpperCAmelCase_ ): """simple docstring""" @staticmethod @abstractmethod def _a ( _lowerCamelCase ): raise NotImplemen...
292
0
# # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_node 2 --nnodes 1 torch...
359
def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> int: while b: UpperCamelCase_ ,UpperCamelCase_: int = b, a % b return a def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> int: return a if b == 0 else euclidean_gcd_recursive(UpperCAmelCase...
292
0
"""simple docstring""" from __future__ import annotations A_ : int = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } class _lowerCAmelCase: ...
360
import unittest from transformers import RoFormerTokenizer, RoFormerTokenizerFast from transformers.testing_utils import require_rjieba, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_rjieba @require_tokenizers class _lowerCAmelCase( UpperCAm...
292
0
def snake_case (UpperCAmelCase__ ) -> bool: UpperCamelCase_: List[Any] = [int(UpperCAmelCase__ ) for i in ip_va_address.split('.' ) if i.isdigit()] return len(UpperCAmelCase__ ) == 4 and all(0 <= int(UpperCAmelCase__ ) <= 2_5_4 for octet in octets ) if __name__ == "__main__": A_ : ...
361
# A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and v to U. We can a...
292
0
import os import unittest from huggingface_hub.utils import are_progress_bars_disabled import transformers.models.bart.tokenization_bart from transformers import logging from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context from transformers.utils.logging import disable_...
362
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertToken...
292
0
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> np.array: UpperCamelCase_: Dict = F'''{sampling_rate}''' UpperCamelCase_: Any = '1' UpperC...
363
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def snake_case (UpperCAmelCase__ , UpperCAmelCase__=() , UpperCAmelCase__=None , UpperCAmelCase__="n...
292
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) A_ : Tuple = { 'configuration_falcon': ['FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FalconConfig'], } try: ...
364
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
292
0
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
365
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() A_ : str = [ 'word_embeddings_la...
292
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Any = logging.get_logger(__name__) A_ : List[str] = { 'google/vivit-b-16x2-kinetics400': ( 'https://huggingface.co/google/vivit-b-16x2-kinetics40...
366
import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configuration_pegasus import DEFAULTS...
292
0
def snake_case (UpperCAmelCase__ ) -> None: UpperCamelCase_: Union[str, Any] = generate_pascal_triangle(UpperCAmelCase__ ) for row_idx in range(UpperCAmelCase__ ): # Print left spaces for _ in range(num_rows - row_idx - 1 ): print(end=' ' ) # Print row values...
367
def snake_case (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: UpperCamelCase_: List[Any] = F'''The input value of [n={number}]...
292
0
import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class _lowerCAmelCase...
368
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_unordered...
292
0
class _lowerCAmelCase: """simple docstring""" def __init__( self , _lowerCamelCase , _lowerCamelCase ): UpperCamelCase_: List[str] = name UpperCamelCase_: str = val def __str__( self ...
369
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> np.array: UpperCamelCase_: Dict = F'''{sampling_rate}''' UpperCamelCase_: Any = '1' UpperC...
292
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) A_ : Tuple = { 'configuration_encodec': [ 'ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP', 'EncodecConfig', ], 'feature_extr...
370
import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py A_ : List[str] = '.' if __name__ == "__main__": A_ : Dict = os.path.join(REPO_PATH, 'utils/documentation_tests.txt') ...
292
0
import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( is_pipeline_test, ...
371
import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...t...
292
0
import os import tempfile import unittest from transformers import FlaubertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterM...
350
import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def snake_case (UpperCAmelCase__ ) -> tuple: return (data["data...
292
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) A_ : List[Any] = { 'configuration_perceiver': ['PERCEIVER_PRETRAINED_CONFIG_ARCHIVE_MAP'...
351
import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import TokenizerTester...
292
0
A_ : Tuple = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } def snake_case (UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ) -> list[str]: UpperCam...
352
from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Tuple = logging.get_logger(__name__) A_ : Dict = { 'facebook/xglm-564M': 'https://huggingface.co/facebook/xglm-564M/resolve/main/config.json', # See all XGLM models at https://huggi...
292
0
"""simple docstring""" import os import numpy import onnx def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> Any: UpperCamelCase_: Union[str, Any] = a.name UpperCamelCase_: Any = b.name UpperCamelCase_: str = '' UpperCamelCase_: Tu...
353
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) A_ : Tuple = { 'configuration_funnel': ['FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FunnelConfi...
292
0
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo A_ : int = '\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Y...
354
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A_ : List[Any] = logging.get_logger(__name__) A_ : Optional[Any] = { 'YituTech/conv-bert-bas...
292
0
def snake_case () -> int: return 1 def snake_case (UpperCAmelCase__ ) -> int: return 0 if x < 0 else two_pence(x - 2 ) + one_pence() def snake_case (UpperCAmelCase__ ) -> int: return 0 if x < 0 else five_pence(x - 5 ) + two_pence(UpperCAmelCase__ ) def snake_case (U...
355
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_channel_d...
292
0
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_image, l...
356
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _lowerCAmelCase( unittest....
292
0
from ....configuration_utils import PretrainedConfig from ....utils import logging A_ : List[str] = logging.get_logger(__name__) # TODO: upload to AWS A_ : List[Any] = { 'yjernite/retribert-base-uncased': ( 'https://huggingface.co/yjernite/retribert-base-uncased/r...
357
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @requ...
292
0
import multiprocessing import os from typing import BinaryIO, Optional, Union import fsspec from .. import Dataset, Features, NamedSplit, config from ..formatting import query_table from ..packaged_modules.json.json import Json from ..utils import logging from ..utils.typing import NestedDataS...
358
from abc import ABC, abstractmethod from argparse import ArgumentParser class _lowerCAmelCase( UpperCAmelCase_ ): """simple docstring""" @staticmethod @abstractmethod def _a ( _lowerCamelCase ): raise NotImplemen...
292
0
import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import TokenizerTester...
359
def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> int: while b: UpperCamelCase_ ,UpperCamelCase_: int = b, a % b return a def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> int: return a if b == 0 else euclidean_gcd_recursive(UpperCAmelCase...
292
0