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 sklearn.metrics import fa_score import datasets A_ : Tuple = '\nThe F1 score is the harmonic mean of the precision and recall. It can be computed with the equation:\nF1 = 2 * (precision * recall) / (precision + recall)\n' A_ : Tuple = '\nArgs:\n predictions (`list`...
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 os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _lowerCAmelCase( __A , unittest.TestCase ): """simple docstr...
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 itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_featur...
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 sacrebleu as scb from packaging import version from sacrebleu import TER import datasets A_ : Any = '\\n@inproceedings{snover-etal-2006-study,\n title = \"A Study of Translation Edit Rate with Targeted Human Annotation\",\n author = \"Snover, Matthew and\n Dorr, Bonnie and\n ...
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 string from math import logaa def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> Union[str, Any]: UpperCamelCase_: List[Any] = document.translate( str.maketrans('' , '' , string.punctuation ) ).replace('\n' , '' ) UpperCamelCase_: Uni...
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 pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ...te...
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 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_fast import BertTokenizerFast from .token...
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 typing import Dict, Iterable, 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...
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 json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging A_ : Optional[int]...
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 __future__ import annotations def snake_case (UpperCAmelCase__ ) -> Any: if not nums: return 0 UpperCamelCase_: int = nums[0] UpperCamelCase_: Dict = 0 for num in nums[1:]: UpperCamelCase_: Any = ( max_excluding + num, max(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
import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokenization_transfo_x...
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 collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def snake_case () -> Tuple: UpperCamelCase_: Tuple = 9, 1_4 # noqa: F841 UpperCamelCase_: Optional[int] = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], ...
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 os import sys import warnings from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xop...
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 __future__ import annotations from scipy.special import comb # type: ignore class _lowerCAmelCase: """simple docstring""" def __init__( self , _lowerCamelCase ): UpperCamelCase_: int = list_of_points # Degree determines the flexibili...
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 itertools import product def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> Optional[Any]: """simple docstring""" UpperCamelCase_: Optional[Any] = sides_number UpperCamelCase_: List[str] = max_face_number * dice_number UpperCamelC...
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__ , UpperCAmelCase__ , UpperCAmelCase__ ) -> int: # Return True if there is node that has not iterated. UpperCamelCase_: List[Any] = [False] * len(__lowerCamelCase ) UpperCamelCase_: Any = [] queue.app...
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 argparse import collections import os import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_table.py A_ : Any = """src/transformers""" ...
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 json import os from functools import lru_cache from typing import TYPE_CHECKING, List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transfor...
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 hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration A_ : Union[str, Any] = { 'tiny.en': 'https://openaipublic.azureedge.net/mai...
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 argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, ...
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
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless...
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_ : Dict = logging.get_logger(__name__) A_ : List[str] = { 'abeja/gpt-neox-japanese-2.7b': 'https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/main/config.json', } class ...
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 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.generation import (...
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 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 _lowerCAmelCase( unittest.TestCase )...
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 typing import Any class _lowerCAmelCase: """simple docstring""" def __init__( self , _lowerCamelCase ): UpperCamelCase_: int = num_of_nodes ...
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
A_ : Optional[Any] = tuple[float, float, float] A_ : Union[str, Any] = tuple[float, float, float] def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> Vectorad: UpperCamelCase_: int = end_pointa[0] - end_pointa[0] UpperCamelCase_: Union[str, Any] = end_p...
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 collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient A_ : Dict = WebClient(token=os.environ['CI_SLACK_BOT_TOKEN']) def snake_case (UpperCAmelCase__ ) ->...
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 os import time import pytest from datasets.utils.filelock import FileLock, Timeout def snake_case (UpperCAmelCase__ ) -> str: UpperCamelCase_: Dict = FileLock(str(tmpdir / 'foo.lock' ) ) UpperCamelCase_: Tuple = FileLock(str(tmpdir / 'foo.lock' ) ) Upp...
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 __future__ import annotations def snake_case (UpperCAmelCase__ , UpperCAmelCase__ = None , UpperCAmelCase__ = None ) -> Optional[Any]: if start is None: UpperCamelCase_: Dict = 0 if end is None: UpperCamelCase_: Tuple ...
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 copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : str = logging.get_logger(__name__) A_ : Union[str, Any] = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/goog...
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
# DISCLAIMER: This code is strongly influenced by https://github.com/pesser/pytorch_diffusion # and https://github.com/hojonathanho/diffusion import math from dataclasses import dataclass from typing import List, Optional, Tuple, Union import numpy as np import torch from diffusers.configuratio...
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 __future__ import annotations def snake_case (UpperCAmelCase__ ) -> None: create_state_space_tree(__lowerCamelCase , [] , 0 , [0 for i in range(len(__lowerCamelCase ) )] ) def snake_case (UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , Up...
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 json import os import tempfile import unittest import numpy as np from datasets import load_dataset from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common im...
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 argparse import math import os import torch from neural_compressor.utils.pytorch import load from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, StableDiffusionPipeline, UNetaDConditionModel def snake_case () -> str: ...
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 math import qiskit def snake_case (UpperCAmelCase__ = 1 , UpperCAmelCase__ = 1 , UpperCAmelCase__ = 1 ) -> qiskit.result.counts.Counts: if ( isinstance(_lowerCAmelCase , _lowerCAmelCase ) or isinstance(_lowerCAmelCase , _lowerCAmelCase ) or isinstance(...
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 collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging A_ : Any = lo...
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 Optional, Union import torch from torch import nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention from ...modeling...
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 from .. import Features, NamedSplit from ..packaged_modules.text.text import Text from ..utils.typing import NestedDataStructureLike, PathLike from .abc import AbstractDatasetReader class _lowerCAmelCase( lowerCAmelCase_ ): """simple docstri...
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""" def snake_case (UpperCAmelCase__ ) -> Optional[int]: return "".join(chr(ord(lowerCamelCase__ ) - 3_2 ) if 'a' <= char <= 'z' else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
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 ...configuration_utils import PretrainedConfig from ...utils import logging A_ : List[str] = logging.get_logger(__name__) A_ : Optional[Any] = { 'RWKV/rwkv-4-169m-pile': 'https://huggingface.co/RWKV/rwkv-4-169m-pile/resolve/main/config.json', 'RWKV/rwkv-4-430m-p...
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 os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_RECORDS...
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 torch from transformers import PreTrainedModel, XLMRobertaConfig, XLMRobertaModel class _lowerCAmelCase( snake_case_ ): """simple docstring""" a : Tuple ='''M-CLIP''' def __init__( self , _lowerCamelCase=1_0_2...
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
def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> Optional[Any]: def get_matched_characters(UpperCAmelCase__ , UpperCAmelCase__ ) -> str: UpperCamelCase_: List[Any] = [] UpperCamelCase_: Any = min(len(_stra ) , len(_stra ) ) // 2 f...
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
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available A_ : Dict = { 'configuration_gpt_neo': ['GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTNeoConfig', 'GPTNeoOnnxConfig'], } try: if not is_tor...
358
from abc import ABC, abstractmethod from argparse import ArgumentParser class _lowerCAmelCase( UpperCAmelCase_ ): """simple docstring""" @staticmethod @abstractmethod def _a ( _lowerCamelCase ): raise NotImplemen...
292
0
def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> list: UpperCamelCase_: List[str] = word.split() def justify(UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ ) -> str: UpperCamelCase_: Optional[Any] = max_width - width UpperCamelCa...
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 logging import os from .state import PartialState class _lowerCAmelCase( logging.LoggerAdapter ): """simple docstring""" @staticmethod def _a ( _lowerCamelCase ): UpperCamelCase_...
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 torch import nn def snake_case (UpperCAmelCase__ ) -> Dict: if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU() else: raise ValueError(F'''Unsupported activation function: {act_fn}''' )
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
from __future__ import annotations def snake_case (UpperCAmelCase__ ) -> list[int]: # This function is recursive UpperCamelCase_: Union[str, Any] = len(__lowerCAmelCase ) # If the array contains only one element, we return it (it's the stop condition of # recursion) if arra...
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 copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=_A ) class _lowerCAmelCase( _A ): """simple docstring""" a ...
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 argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ...
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
def snake_case (UpperCAmelCase__ ) -> List[str]: UpperCamelCase_: str = (1 + 2_4 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def snake_case (UpperCAmelCase__ = 5_0_0_0 ) -> Optional[Any]: UpperCamelCase_: Union[str, Any] = [(i * (3 * i - 1)) // 2 for i in range(1...
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 random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteSchedul...
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 copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Any = logging.get_logger(__name__) A_ : Tuple = { 'google/pix2struct-textcaps-base': ( 'https://huggingface.co/google/pix2str...
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 __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def snake_case (UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__ , ) -> list[float]: UpperCamelCase_: Optional[int] = coe...
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 typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class _lowerCAmelCase( UpperCAmelCase_ , UpperCAmelCase_ ): """simple doc...
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 argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.set_verbosi...
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 logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) A_ : int = logging.getLogger(__name__) if __name__ == "__main__": A_ : List[Any]...
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 from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class _lowerCAmelCase( a_ ): """simple docstring""" def __lt__( self , _lowerCamelCase ): ...
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 gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.models.attention_proc...
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 unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_deter...
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 from math import ceil, floor, sqrt def snake_case (UpperCAmelCase__ = 2_0_0_0_0_0_0 ) -> List[Any]: UpperCamelCase_: Any = [0] UpperCamelCase_: Optional[int] = 4_2 for idx in range(1 , ceil(sq...
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 __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers import...
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 importlib.util import json import os import warnings from dataclasses import dataclass, field import torch from ..training_args import TrainingArguments from ..utils import cached_property, is_sagemaker_dp_enabled, logging A_ : Optional[int] = logging.get_logger(__name_...
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 def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> np.ndarray: return np.where(vector > 0 , __UpperCAmelCase , (alpha * (np.exp(__UpperCAmelCase ) - 1)) ) if __name__ == "__main__": import doctest doctest.testmod()
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 string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency A_ : Union[str, Any] = { '''E''': 12.70, '''T''': 9.06, '''A''': 8.17, '''O''': 7.51, '''I''': 6.97, '''N''': 6.75, '''S''': 6.33, '''H''': 6.09, '''R''': 5.99, ...
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
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A_ : Optional[int] = logging.get_logger(__name__) A_ : Dict = { '''huggingface/informer-tourism-monthly''': ( '''https://huggingface.co/hu...
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 itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin if is_speech_av...
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 typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available A_ : Optional[int] = {"configuration_swin": ["SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP", "SwinConfig", "SwinOnnxConfig"]} ...
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 collections import Counter from timeit import timeit def snake_case (UpperCAmelCase__ = "" , ) -> List[str]: return sum(c % 2 for c in Counter(input_str.replace(' ' , '' ).lower() ).values() ) < 2 def snake_case (UpperCAmelCase__ = "" ) -> Union[str, Any]: if len(_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 functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def snake_case (*UpperCAmelCase__ ) -> int: if not isinstance(__lowerCAmelCase , __lowerCAmelCase ): UpperCamelCase_: int = list(__lowerCAmelCas...
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 argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def snake_case (UpperCAmelCase__ ) -> Dict: UpperCamelCase_: List[str] = [ "encoder.version", "decoder.version", "model.encoder...
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 __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from tran...
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 argparse import math import traceback import dateutil.parser as date_parser import requests def snake_case (UpperCAmelCase__ ) -> Union[str, Any]: UpperCamelCase_: Optional[int] = {} UpperCamelCase_: List[Any] = job['started_at'] UpperCamelCase_: Tuple ...
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 math import isqrt, loga def snake_case (UpperCAmelCase__ ) -> Any: UpperCamelCase_: Dict = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , lowerCAmelCase__ ...
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 argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from transformers import HfArgument...
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 os import time import pytest from datasets.utils.filelock import FileLock, Timeout def snake_case (UpperCAmelCase__ ) -> Optional[Any]: UpperCamelCase_: Tuple = FileLock(str(tmpdir / 'foo.lock' ) ) UpperCamelCase_: int = FileLock(str(tmpdir / 'foo.lock' ) )...
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 json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_im...
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 torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class _lowerCAmelCase( _lowerCAmelCase ): """simple docstring""" a : Optional[int] =(DDPMParallelScheduler,) ...
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 os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py A_ : Union[str, Any] = 'src/diffusers' # Matches is_xxx_available() A_ : Union[str, Any] = re.compile(r'is\_([a-z_]*...
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 pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class _lowerCAmelCase( unittest.TestCase ): """simple docstring""" ...
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 argparse import json from collections import OrderedDict from functools import partial from pathlib import Path import timm import torch from huggingface_hub import hf_hub_download from transformers import LevitConfig, LevitForImageClassificationWithTeacher, LevitImageProcessor from tr...
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 ) -> str: return sum(int(lowerCAmelCase__ ) for x in str(factorial(lowerCAmelCase__ ) ) ) 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 math import os import sys def snake_case (UpperCAmelCase__ ) -> Optional[Any]: UpperCamelCase_: Optional[int] = '' try: with open(UpperCAmelCase__ , 'rb' ) as binary_file: UpperCamelCase_: Optional[int] = binary_f...
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 logging import os from dataclasses import dataclass, field from typing import Dict, Optional import numpy as np from utils_multiple_choice import MultipleChoiceDataset, Split, processors import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice, ...
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 huggingface_hub import hf_hub_download from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor from transformers.pipelines import VideoClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested...
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 json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_im...
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
def snake_case (UpperCAmelCase__ , UpperCAmelCase__ ) -> int: return 1 if input_a == input_a else 0 def snake_case () -> None: assert xnor_gate(0 , 0 ) == 1 assert xnor_gate(0 , 1 ) == 0 assert xnor_gate(1 , 0 ) == 0 assert xnor_gate(1 , 1 ) == ...
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 argparse import os import re import zipfile import torch from transformers import AutoTokenizer, GPTaConfig def snake_case (UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmelCase__=0 ) -> Union[str, Any]: # Format the message. if name is None: UpperCamelCase_: Tup...
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 .imports import is_rich_available if is_rich_available(): from rich.traceback import install install(show_locals=False) else: raise ModuleNotFoundError('To use the rich extension, install rich with `pip install rich`')
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 from ...utils.dataclasses import ( ComputeEnvironment, DistributedType, DynamoBackend, PrecisionType, SageMakerDistributedType, ) from ..menu import BulletMenu A_ : List[Any] = [ 'EAGER', 'AOT_EAGER', ...
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 collections import Counter from timeit import timeit def snake_case (UpperCAmelCase__ = "" , ) -> bool: return sum(c % 2 for c in Counter(input_str.replace(' ' , '' ).lower() ).values() ) < 2 def snake_case (UpperCAmelCase__ = "" ) -> bool: if len(UpperCAmelCase__ ) == 0: ...
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
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, OptionalDependencyNotAvailable, is_flax_available, is_k_diffusion_available, is_k_diffusion_version, is_o...
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 Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resi...
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 argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def snake_case (UpperCAmelCase__ , UpperCAmelCase__ , UpperCAmel...
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 re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class _lowerCAmelCase( a__ ): """simple docstring""" def _a ( self , _lowerCamelCase ): with open(SCREAMING_SNA...
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 __future__ import annotations def snake_case (UpperCAmelCase__ , UpperCAmelCase__ = None , UpperCAmelCase__ = None , UpperCAmelCase__ = False , ) -> tuple[int, float, str]: UpperCamelCase_: Optional[int] = cipher_alphabet or ...
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 torch from torch import nn from transformers import CLIPPreTrainedModel, CLIPVisionModel from ...models.attention import BasicTransformerBlock from ...utils import logging A_ : List[Any] = logging.get_logger(__name__) # pylint: disable=invalid-name class _lowerCAm...
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 numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class _lowerCAmelCase( UpperCamelCase__ ): """simple docstring""" def __init__( self , _lowerCamelCase , _lowerC...
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 pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils import require_keras_...
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