code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" # limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401 fro...
616
"""simple docstring""" import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def lowerCAmelCase_ ( ): """simple docstring""" wit...
616
1
"""simple docstring""" import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def lowerCAmelCase_ ( ): """simple docstring""" wit...
616
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : list , UpperCamelCase__ : int , UpperCamelCase__ : int = 0 , UpperCamelCase__ : int = 0 ): """simple docstring""" __lowercase = right or len(UpperCamelCase__ ...
616
1
"""simple docstring""" from __future__ import annotations import math def lowerCAmelCase_ ( UpperCamelCase__ : int , UpperCamelCase__ : int , UpperCamelCase__ : bool , UpperCamelCase__ : list[int] , UpperCamelCase__ : float ): """...
616
"""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 BatchEncoding, PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ ...
616
1
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int ): """simple docstring""" if not isinstance(UpperCamelCase__ , UpperCamelCase__ ): __lowercase = f'''Input value of [number={number}] must be an integer''' raise TypeError(Uppe...
616
"""simple docstring""" import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig ...
616
1
"""simple docstring""" import cva import numpy as np class lowerCamelCase__ : def __init__( self : Optional[Any] , A_ : float , A_ : int ): '''simple docstring''' if k in (0.04, 0.06): __lowercase ...
616
"""simple docstring""" import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, ...
616
1
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : str ): """simple docstring""" __lowercase = 0 # if input_string is "aba" than new_input_string become "a|b|a" __lowercase = """""" __lowercase = """""" # append...
616
"""simple docstring""" from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def lowerCAmelCase_ ( UpperCamelCase__ : str , UpperCamelCase__ : str , UpperCamelCase__ : Optional[str] = None ): ...
616
1
"""simple docstring""" import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fssp...
616
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : int ): """simple docstring""" if n == 0: return 1 elif n % 2 == 1: return (binary_exponentiation...
616
1
"""simple docstring""" from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def lowerCAmelCase_ ( UpperCamelCase__ : np.ndarray , UpperCamelCase__ : np.ndarray , UpperCamelCase__ : np.ndarray , UpperCamelCase__ : int...
616
"""simple docstring""" import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_available...
616
1
"""simple docstring""" import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import D...
616
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze...
616
1
"""simple docstring""" import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplica...
616
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int , UpperCamelCase__ : int ): """simple docstring""" return x if y == 0 else greatest_common_divisor(UpperCamelCase__ , x % y ) def lowerCAmelCase_ ( UpperCamelCase__ ...
616
1
"""simple docstring""" import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def lowerCAmelCase_ ( UpperCamelCase__ : Optional[Any] , UpperCamelCase__ : str , UpperCamelCase__ : Any , UpperCamelCase__ : List[str]=5 ): ...
616
"""simple docstring""" import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging...
616
1
"""simple docstring""" import itertools import os from collections import Counter, defaultdict from concurrent.futures import ThreadPoolExecutor, as_completed import numpy as np import datasets from .execute import check_correctness UpperCAmelCase__ ="\\n@misc{chen2021evaluating,\n ti...
616
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int ): """simple docstring""" assert ( isinstance(UpperCamelCase__ , UpperCamelCase__ ) and number_of_steps > 0 ), f'''number_of_steps needs to be positive integer, your input {number_of_s...
616
1
"""simple docstring""" import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging...
616
"""simple docstring""" import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tok...
616
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import f...
616
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.mod...
616
1
"""simple docstring""" from collections import defaultdict from math import gcd def lowerCAmelCase_ ( UpperCamelCase__ : int = 1500000 ): """simple docstring""" __lowercase = defaultdict(UpperCamelCase__ ) __lowercase = 2 while 2 * eu...
616
"""simple docstring""" class lowerCamelCase__ : def __init__( self : Optional[Any] , A_ : Dict , A_ : str , A_ : Any ): '''simple docstring''' __lowercase = None __lowercase = ...
616
1
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black UpperCAmelCase__ =os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_copies # noqa:...
616
"""simple docstring""" from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def lowerCAmelCase_ ( UpperCamelCase__ : np.ndarray , UpperCamelCase__ : np.ndarray , UpperCamelCase__ : np.ndarray , UpperCamelCase__ : int...
616
1
"""simple docstring""" import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import T...
616
"""simple docstring""" from PIL import Image def lowerCAmelCase_ ( UpperCamelCase__ : Image , UpperCamelCase__ : int ): """simple docstring""" __lowercase = (259 * (level + 255)) / (255 * (259 - level)) def contrast(UpperCamelCase__ ...
616
1
"""simple docstring""" import math def lowerCAmelCase_ ( UpperCamelCase__ : float , UpperCamelCase__ : float ): """simple docstring""" return math.pow(UpperCamelCase__ , 2 ) - a def lowerCAmelCase_ ( UpperCamelCase__ : float ...
616
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black UpperCAmelCase__ =os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_copies # noqa:...
616
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) UpperCAmelCase__ ={ "configuration_blip": [ "BLIP_PRETRAINED_CONFIG_ARCHIVE...
616
"""simple docstring""" from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, ad...
616
1
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.ut...
616
"""simple docstring""" from __future__ import annotations def lowerCAmelCase_ ( UpperCamelCase__ : list[float] , UpperCamelCase__ : Any ): """simple docstring""" print(f'''Vertex\tShortest Distance from vertex {src}''' ) for i, d in enumerate(Upp...
616
1
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow if is_torch_available(): import torch from transformers import XLMRobertaModel @require_...
616
"""simple docstring""" import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedToke...
616
1
"""simple docstring""" from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. UpperCAmelCase__ =10 def lowerCAmelCase_ ( UpperCamelCase__ : int , UpperCamelC...
616
"""simple docstring""" from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import log...
616
1
"""simple docstring""" import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ =logging.get_logger(__name__) UpperCAmelCase__ ={ "vocab_file": "vocab.json", "tokeni...
616
"""simple docstring""" import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def lowerCAmelCase_ ( ): """simple docstring""" wit...
616
1
"""simple docstring""" 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 impo...
616
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : list , UpperCamelCase__ : int , UpperCamelCase__ : int = 0 , UpperCamelCase__ : int = 0 ): """simple docstring""" __lowercase = right or len(UpperCamelCase__ ...
616
1
"""simple docstring""" class lowerCamelCase__ : def __init__( self : Dict , A_ : int , A_ : Dict ): '''simple docstring''' __lowercase = name __lowercase = val def __str__( self ...
616
"""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 BatchEncoding, PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ ...
616
1
"""simple docstring""" import argparse from typing import List import evaluate import numpy as np import torch from datasets import DatasetDict, load_dataset # New Code # # We'll be using StratifiedKFold for this example from sklearn.model_selection import StratifiedKFold from torch.optim import A...
616
"""simple docstring""" import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig ...
616
1
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int = 10 ): """simple docstring""" if not isinstance(UpperCamelCase__ , UpperCamelCase__ ) or n < 0: raise ValueError("""Invalid input""" ) __lowercase = 10**n __lowercase ...
616
"""simple docstring""" import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, ...
616
1
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : list[int] , UpperCamelCase__ : list[int] , UpperCamelCase__ : int ): """simple docstring""" return not any( neighbour == 1 and colored_vertices[i] == color for i, neigh...
616
"""simple docstring""" from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def lowerCAmelCase_ ( UpperCamelCase__ : str , UpperCamelCase__ : str , UpperCamelCase__ : Optional[str] = None ): ...
616
1
"""simple docstring""" import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_visio...
616
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : int ): """simple docstring""" if n == 0: return 1 elif n % 2 == 1: return (binary_exponentiation...
616
1
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : str , UpperCamelCase__ : str ): """simple docstring""" if not (isinstance(UpperCamelCase__ , UpperCamelCase__ ) and isinstance(UpperCamelCase__ , UpperCamelCase__ )): raise Val...
616
"""simple docstring""" import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_available...
616
1
"""simple docstring""" from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast from ...utils import logging UpperCAmel...
616
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze...
616
1
"""simple docstring""" from PIL import Image def lowerCAmelCase_ ( UpperCamelCase__ : Image , UpperCamelCase__ : int ): """simple docstring""" __lowercase = (259 * (level + 255)) / (255 * (259 - level)) def contrast(UpperCamelCase__ ...
616
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int , UpperCamelCase__ : int ): """simple docstring""" return x if y == 0 else greatest_common_divisor(UpperCamelCase__ , x % y ) def lowerCAmelCase_ ( UpperCamelCase__ ...
616
1
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int , UpperCamelCase__ : int , UpperCamelCase__ : int ): """simple docstring""" if exponent == 1: return base if exponent % 2 == 0: __lowercase = _modexpt(UpperCa...
616
"""simple docstring""" import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging...
616
1
"""simple docstring""" from __future__ import annotations def lowerCAmelCase_ ( UpperCamelCase__ : list[int] , UpperCamelCase__ : list[int] , UpperCamelCase__ : list[int] , UpperCamelCase__ : list[list[str]] , UpperCamelCase__ : int , ): ...
616
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int ): """simple docstring""" assert ( isinstance(UpperCamelCase__ , UpperCamelCase__ ) and number_of_steps > 0 ), f'''number_of_steps needs to be positive integer, your input {number_of_s...
616
1
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/L...
616
"""simple docstring""" import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tok...
616
1
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.mod...
616
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.mod...
616
1
"""simple docstring""" import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters UpperCAmelCase__ =(720, 1280) # Height, Width UpperCAmelCase__ =(0.4, 0.6) # if height or width lower than this scale, drop it. UpperCAmelCase...
616
"""simple docstring""" class lowerCamelCase__ : def __init__( self : Optional[Any] , A_ : Dict , A_ : str , A_ : Any ): '''simple docstring''' __lowercase = None __lowercase = ...
616
1
"""simple docstring""" import os import pickle import unittest from transformers import AutoTokenizer from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.models.bert_japanese.tokenization_bert_japanese import ( VOCAB_FILES_NAMES, BertJapaneseTokenizer, C...
616
"""simple docstring""" from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def lowerCAmelCase_ ( UpperCamelCase__ : np.ndarray , UpperCamelCase__ : np.ndarray , UpperCamelCase__ : np.ndarray , UpperCamelCase__ : int...
616
1
"""simple docstring""" from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class lowerCamelCase__ ( _a ): a : Dict = """EncodecFeatureExtractor""" a : str = ("""T5T...
616
"""simple docstring""" from PIL import Image def lowerCAmelCase_ ( UpperCamelCase__ : Image , UpperCamelCase__ : int ): """simple docstring""" __lowercase = (259 * (level + 255)) / (255 * (259 - level)) def contrast(UpperCamelCase__ ...
616
1
"""simple docstring""" from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def lowerCAmelCase_ ( ): """simple docstring""" __lowercase = HfArgumentParser(UpperCamelCase__ ) __lowercase = parser.parse_args_...
616
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black UpperCAmelCase__ =os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_copies # noqa:...
616
1
"""simple docstring""" from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings...
616
"""simple docstring""" from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, ad...
616
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ =logging.get_logger(__name__) UpperCAmelCase__ ={ "weiweishi/roc-bert-base-zh": "https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json", } ...
616
"""simple docstring""" from __future__ import annotations def lowerCAmelCase_ ( UpperCamelCase__ : list[float] , UpperCamelCase__ : Any ): """simple docstring""" print(f'''Vertex\tShortest Distance from vertex {src}''' ) for i, d in enumerate(Upp...
616
1
"""simple docstring""" import json from typing import Iterator, List, Union from tokenizers import AddedToken, Regex, Tokenizer, decoders, normalizers, pre_tokenizers, trainers from tokenizers.implementations.base_tokenizer import BaseTokenizer from tokenizers.models import Unigram from tokenizers.proce...
616
"""simple docstring""" import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedToke...
616
1
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() ex...
616
"""simple docstring""" from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import log...
616
1
"""simple docstring""" import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class lowerCamelCase__ ( unittest.TestCase ): def SCREAMING_SNAKE_CASE_ ( self : Optional[int] ...
616
"""simple docstring""" import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def lowerCAmelCase_ ( ): """simple docstring""" wit...
616
1
"""simple docstring""" from ..utils import ( OptionalDependencyNotAvailable, is_flax_available, is_scipy_available, is_torch_available, is_torchsde_available, ) try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDepende...
616
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : list , UpperCamelCase__ : int , UpperCamelCase__ : int = 0 , UpperCamelCase__ : int = 0 ): """simple docstring""" __lowercase = right or len(UpperCamelCase__ ...
616
1
"""simple docstring""" import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase_ ( UpperCamelCase__ : Optional[int] , UpperCamelCase__ : Dict ...
616
"""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 BatchEncoding, PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ ...
616
1
"""simple docstring""" import inspect import unittest from datasets import load_dataset from packaging import version from transformers import BeitConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow...
616
"""simple docstring""" import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig ...
616
1
"""simple docstring""" import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from d...
616
"""simple docstring""" import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, ...
616
1
"""simple docstring""" from __future__ import annotations from dataclasses import dataclass @dataclass class lowerCamelCase__ : a : float a : TreeNode | None = None a : TreeNode | None = None def lowerCAmelCase_ ( UpperCa...
616
"""simple docstring""" from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def lowerCAmelCase_ ( UpperCamelCase__ : str , UpperCamelCase__ : str , UpperCamelCase__ : Optional[str] = None ): ...
616
1
"""simple docstring""" import sys import turtle def lowerCAmelCase_ ( UpperCamelCase__ : tuple[float, float] , UpperCamelCase__ : tuple[float, float] ): """simple docstring""" return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def lowerCAmelCase_ ...
616
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : int ): """simple docstring""" if n == 0: return 1 elif n % 2 == 1: return (binary_exponentiation...
616
1
"""simple docstring""" import unittest import numpy as np from diffusers import OnnxStableDiffusionInpaintPipelineLegacy from diffusers.utils.testing_utils import ( is_onnx_available, load_image, load_numpy, nightly, require_onnxruntime, require_torch_gpu, ) if is_onn...
616
"""simple docstring""" import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_available...
616
1
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transform...
616
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze...
616
1
"""simple docstring""" # Copyright 2022 The HuggingFace Team and The OpenBMB Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apach...
616
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int , UpperCamelCase__ : int ): """simple docstring""" return x if y == 0 else greatest_common_divisor(UpperCamelCase__ , x % y ) def lowerCAmelCase_ ( UpperCamelCase__ ...
616
1
"""simple docstring""" from scipy.stats import spearmanr import datasets UpperCAmelCase__ ="\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implying no correlatio...
616
"""simple docstring""" import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging...
616
1
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int ): """simple docstring""" if num < 0: return False __lowercase = num __lowercase = 0 while num > 0: __lowercase = rev_num * 10 + (num % 10) num //= 10 ...
616
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int ): """simple docstring""" assert ( isinstance(UpperCamelCase__ , UpperCamelCase__ ) and number_of_steps > 0 ), f'''number_of_steps needs to be positive integer, your input {number_of_s...
616
1
"""simple docstring""" import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available...
616
"""simple docstring""" import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tok...
616
1
"""simple docstring""" 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 imp...
616
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.mod...
616
1
"""simple docstring""" import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class lowerCamelC...
616
"""simple docstring""" class lowerCamelCase__ : def __init__( self : Optional[Any] , A_ : Dict , A_ : str , A_ : Any ): '''simple docstring''' __lowercase = None __lowercase = ...
616
1
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int , UpperCamelCase__ : int ): """simple docstring""" return x if y == 0 else greatest_common_divisor(UpperCamelCase__ , x % y ) def lowerCAmelCase_ ( UpperCamelCase__ ...
616
"""simple docstring""" from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def lowerCAmelCase_ ( UpperCamelCase__ : np.ndarray , UpperCamelCase__ : np.ndarray , UpperCamelCase__ : np.ndarray , UpperCamelCase__ : int...
616
1
import numpy as np import qiskit def __lowercase ( snake_case = 8, snake_case = None ): """simple docstring""" __magic_name__ :List[Any] = np.random.default_rng(seed=snake_case ) # Roughly 25% of the qubits will contribute to the key. # So we take more than we ne...
0
"""simple docstring""" from PIL import Image def lowerCAmelCase_ ( UpperCamelCase__ : Image , UpperCamelCase__ : int ): """simple docstring""" __lowercase = (259 * (level + 255)) / (255 * (259 - level)) def contrast(UpperCamelCase__ ...
616
0
from datetime import datetime import requests def _A ( _lowercase ) -> bytes: """simple docstring""" __UpperCamelCase = 'https://downloadgram.net/wp-json/wppress/video-downloader/video?url=' __UpperCamelCase = requests.get(base_url + url ).json()[0]['urls'][0]...
1
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black UpperCAmelCase__ =os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_copies # noqa:...
616
0
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import ...
2
"""simple docstring""" from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, ad...
616
0
'''simple docstring''' lowerCAmelCase : List[Any] = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] lowerCAmelCase : int = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] lowerCAmelCase : List[Any] = { 0: 'Sunday', 1: 'Monday', 2: 'Tuesday', 3: 'Wednesday', 4: ...
3
"""simple docstring""" from __future__ import annotations def lowerCAmelCase_ ( UpperCamelCase__ : list[float] , UpperCamelCase__ : Any ): """simple docstring""" print(f'''Vertex\tShortest Distance from vertex {src}''' ) for i, d in enumerate(Upp...
616
0
"""simple docstring""" from ..utils import DummyObject, requires_backends class a ( metaclass=a__ ): snake_case__ = ['''flax''', '''transformers'''] def __init__( self , *_snake_case , **_snake_case ): """simple docstring""" r...
4
"""simple docstring""" import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedToke...
616
0
'''simple docstring''' import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed fr...
5
"""simple docstring""" from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import log...
616
0
class UpperCamelCase_ : def __init__( self :int , __A :list ) -> None: """simple docstring""" SCREAMING_SNAKE_CASE__ = set_counts SCREAMING_SNAKE_CASE__ = max(__A ) SCREAMING_SNAKE_CASE__ = len(__A ) ...
6
"""simple docstring""" import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def lowerCAmelCase_ ( ): """simple docstring""" wit...
616
0
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a = logging.get_logger(__name__) a = { '''BAAI/AltCLIP''': '''https://huggingface.co/BAAI/AltCLIP/resolve/main/config.json'...
7
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : list , UpperCamelCase__ : int , UpperCamelCase__ : int = 0 , UpperCamelCase__ : int = 0 ): """simple docstring""" __lowercase = right or len(UpperCamelCase__ ...
616
0
'''simple docstring''' def _lowerCAmelCase ( __snake_case : int , __snake_case : list ) -> Union[str, Any]: _enforce_args(__snake_case , __snake_case ) if n == 0: return 0 __A : Any = float('-inf' ) for...
8
"""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 BatchEncoding, PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ ...
616
0
import unittest from transformers import SPIECE_UNDERLINE, XLNetTokenizer, XLNetTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin SCREAMING_SNAKE_CASE__ = get_tests_dir('''fixtur...
9
"""simple docstring""" import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig ...
616
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_channel_dimension_format...
10
"""simple docstring""" import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, ...
616
0
'''simple docstring''' import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class __A ( unittest.TestCase ): '''simple docstring''' __lowerCamelCase : Tuple = JukeboxTokenizer __lowerCamelCase : Dict = {...
11
"""simple docstring""" from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def lowerCAmelCase_ ( UpperCamelCase__ : str , UpperCamelCase__ : str , UpperCamelCase__ : Optional[str] = None ): ...
616
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase__ : List[Any] = logging.get_logger(__name__) lowerCamelCase__ : Union[str, Any] = { "...
12
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : int ): """simple docstring""" if n == 0: return 1 elif n % 2 == 1: return (binary_exponentiation...
616
0
'''simple docstring''' import argparse import os 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_task_guides.py A__ : Any = """src/transformers""" A__ : U...
13
"""simple docstring""" import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_available...
616
0
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def __UpperCAmelCase ( ) -> None: """simple docstring""" print('''Making key files...''' ) make_key_files('''r...
14
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze...
616
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_nlp, req...
15
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int , UpperCamelCase__ : int ): """simple docstring""" return x if y == 0 else greatest_common_divisor(UpperCamelCase__ , x % y ) def lowerCAmelCase_ ( UpperCamelCase__ ...
616
0
def __a ( A__ : int = 2000000 ): SCREAMING_SNAKE_CASE = [0 for i in range(n + 1 )] SCREAMING_SNAKE_CASE = 1 SCREAMING_SNAKE_CASE = 1 for i in range(2 , int(n**0.5 ) + 1 ): if primality_list[i] == 0: ...
16
"""simple docstring""" import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging...
616
0
import json import logging import os import socket import git import numpy as np import torch logging.basicConfig( format='''%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s''', datefmt='''%m/%d/%Y %H:%M:%S''', level=logging.INFO, ) UpperCAmelCase_ : List[str] = lo...
17
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int ): """simple docstring""" assert ( isinstance(UpperCamelCase__ , UpperCamelCase__ ) and number_of_steps > 0 ), f'''number_of_steps needs to be positive integer, your input {number_of_s...
616
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _SCREAMING_SNAKE_CASE = { "configuration_biogpt": ["BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BioGptConfig"], "tokenization_bi...
18
"""simple docstring""" import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tok...
616
0
"""simple docstring""" import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def lowerCamelCase__...
19
"""simple docstring""" import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffusers.mod...
616
0
def _lowercase( __a : float , __a : float ): if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) return (bulk_modulus / density) ** 0.5 if __name...
20
"""simple docstring""" class lowerCamelCase__ : def __init__( self : Optional[Any] , A_ : Dict , A_ : str , A_ : Any ): '''simple docstring''' __lowercase = None __lowercase = ...
616
0
import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart import BartToken...
21
"""simple docstring""" from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def lowerCAmelCase_ ( UpperCamelCase__ : np.ndarray , UpperCamelCase__ : np.ndarray , UpperCamelCase__ : np.ndarray , UpperCamelCase__ : int...
616
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffu...
22
"""simple docstring""" from PIL import Image def lowerCAmelCase_ ( UpperCamelCase__ : Image , UpperCamelCase__ : int ): """simple docstring""" __lowercase = (259 * (level + 255)) / (255 * (259 - level)) def contrast(UpperCamelCase__ ...
616
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) snake_case__ : str = {"""configuration_fnet""": ["""FNET_PRETRAINED_CONFIG_...
23
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black UpperCAmelCase__ =os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import check_copies # noqa:...
616
0
'''simple docstring''' from __future__ import annotations from math import pi, sqrt def _UpperCamelCase (_lowerCamelCase : float , _lowerCamelCase : float )-> tuple: '''simple docstring''' if inductance <= 0: raise ValueError('''Inductance cannot be...
24
"""simple docstring""" from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, ad...
616
0
# Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config # - generate model_cards - usef...
25
"""simple docstring""" from __future__ import annotations def lowerCAmelCase_ ( UpperCamelCase__ : list[float] , UpperCamelCase__ : Any ): """simple docstring""" print(f'''Vertex\tShortest Distance from vertex {src}''' ) for i, d in enumerate(Upp...
616
0
'''simple docstring''' def _a ( _lowerCamelCase , _lowerCamelCase ) -> list[str]: """simple docstring""" return [sentence[i : i + ngram_size] for i in range(len(_lowerCamelCase ) - ngram_size + 1 )] if __name__ == "__main__": from doctest import te...
26
"""simple docstring""" import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedToke...
616
0
def __lowerCAmelCase( _SCREAMING_SNAKE_CASE ) -> str: """simple docstring""" _A = 0 # if input_string is "aba" than new_input_string become "a|b|a" _A = '' _A = '' # append each character + "|" in new_string f...
27
"""simple docstring""" from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import log...
616
0
'''simple docstring''' import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging UpperCam...
28
"""simple docstring""" import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def lowerCAmelCase_ ( ): """simple docstring""" wit...
616
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ = { """configuration_nllb_moe""": [ """NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NllbMoeConfig""", ] } try: if not is_tor...
29
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : list , UpperCamelCase__ : int , UpperCamelCase__ : int = 0 , UpperCamelCase__ : int = 0 ): """simple docstring""" __lowercase = right or len(UpperCamelCase__ ...
616
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 ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, ViltForMaskedLM, Vilt...
30
"""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 BatchEncoding, PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ ...
616
0
import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def UpperCAmelCase_ ( __UpperCAmelCase : str ) -> Tuple: # picklable for mul...
31
"""simple docstring""" import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig ...
616
0
from typing import List from .keymap import KEYMAP, get_character def A__ ( SCREAMING_SNAKE_CASE_ : str ) -> List[str]: """simple docstring""" def decorator(SCREAMING_SNAKE_CASE_ : List[Any] ): _UpperCAmelCase = getattr(SCREAMING_SNAKE_...
32
"""simple docstring""" import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, ...
616
0
from collections.abc import Sequence def SCREAMING_SNAKE_CASE ( __lowerCAmelCase , __lowerCAmelCase = False ) -> float: if not arr: return 0 snake_case__ = 0 if allow_empty_subarrays else float('''-inf''' ) snake_case__ = 0.0 for num in arr: s...
33
"""simple docstring""" from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def lowerCAmelCase_ ( UpperCamelCase__ : str , UpperCamelCase__ : str , UpperCamelCase__ : Optional[str] = None ): ...
616
0
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class snake_case_ ( lowerCamelCas...
34
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : Union[str, Any] , UpperCamelCase__ : int ): """simple docstring""" if n == 0: return 1 elif n % 2 == 1: return (binary_exponentiation...
616
0
import argparse import importlib from pathlib import Path # Test all the extensions added in the setup a_ :Optional[int] = [ 'kernels/rwkv/wkv_cuda.cu', 'kernels/rwkv/wkv_op.cpp', 'kernels/deformable_detr/ms_deform_attn.h', 'kernels/deformable_detr/cuda/ms_deform_im2col_cuda.cuh', 'mo...
35
"""simple docstring""" import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_available...
616
0
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): i...
36
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze...
616
0
import math from datetime import datetime, timedelta def UpperCamelCase_ ( __a ) -> datetime: a__ : Union[str, Any] = year % 19 a__ : List[str] = year % 4 a__ : str = year % 7 a__ : Any = math.floor(year / 100 ) a__ : List[str] = m...
37
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int , UpperCamelCase__ : int ): """simple docstring""" return x if y == 0 else greatest_common_divisor(UpperCamelCase__ , x % y ) def lowerCAmelCase_ ( UpperCamelCase__ ...
616
0
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, LEDTokenizer, LEDTokenizerFast from transformers.models.led.tokenization_led import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers.utils import ...
38
"""simple docstring""" import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging...
616
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 snake_case_ ( __A , unittest.TestCase ): '''simple docstring'...
39
"""simple docstring""" def lowerCAmelCase_ ( UpperCamelCase__ : int ): """simple docstring""" assert ( isinstance(UpperCamelCase__ , UpperCamelCase__ ) and number_of_steps > 0 ), f'''number_of_steps needs to be positive integer, your input {number_of_s...
616
0