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
from __future__ import annotations import time lowerCamelCase__ = list[tuple[int, int]] lowerCamelCase__ = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0], [0, 0, ...
612
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("T") lowerCamelCase__ = TypeVar("U") class lowerCAmelCase__ ( Generic[T, U] ): def __init__( self , a , a ) ...
612
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase__ = {"configuration_fnet": ["FNET_PRETRAINED_CONFIG_ARCHIVE_MAP", "FNetConfig"]} try: if not i...
612
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @req...
612
1
def __A(lowerCAmelCase , lowerCAmelCase ) -> str: """simple docstring""" _UpperCamelCase = """""" for word_or_phrase in separated: if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise Exception("""join() accepts only strings to be joined""" ) joined +=...
612
# 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/LICENSE-2.0 # # Unless required by app...
612
1
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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, IMA...
612
from collections.abc import Sequence def __A(lowerCAmelCase = None ) -> int: """simple docstring""" if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _UpperCamelCase = nums[0] for i in range(1 , len(lowerCAmelCase ) ): _U...
612
1
import math import sys def __A(lowerCAmelCase ) -> int: """simple docstring""" if number != int(lowerCAmelCase ): raise ValueError("""the value of input must be a natural number""" ) if number < 0: raise ValueError("""the value of input must not be a negative number""" ) if nu...
612
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
1
import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging lowerCamelCase__ = { "cola": 2, ...
612
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase__ ( __lowercase ): @staticmethod @abstractmethod def A_ ( a ) -> Union[str, Any]: '''simple docstring''' raise NotImplementedError() ...
612
1
from pathlib import Path import fire def __A(lowerCAmelCase , lowerCAmelCase , lowerCAmelCase ) -> Union[str, Any]: """simple docstring""" _UpperCamelCase = Path(lowerCAmelCase ) _UpperCamelCase = Path(lowerCAmelCase ) dest_dir.mkdir(exist_ok=lowerCAmelC...
612
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
1
def __A(lowerCAmelCase ) -> list[int]: """simple docstring""" _UpperCamelCase = [0 for i in range(len(lowerCAmelCase ) )] # initialize interval's left pointer and right pointer _UpperCamelCase , _UpperCamelCase = 0, 0 for i in range(1 , len(lowerC...
612
def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise ValueError("""check_bouncy() accepts only integer arguments""" ) _UpperCamelCase = str(lowerCAmelCase ) _UpperCamelCase = """""".join(sort...
612
1
import numpy as np class lowerCAmelCase__ : def __init__( self ) -> Optional[int]: '''simple docstring''' _UpperCamelCase = (0, 0) _UpperCamelCase = None _UpperCamelCase = 0 _UpperCamelCase ...
612
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : int = (KDPMaDiscreteScheduler,) UpperCamelCase_ : Optional[int...
612
1
import os import pytest import yaml from datasets.features.features import Features, Value from datasets.info import DatasetInfo, DatasetInfosDict @pytest.mark.parametrize( """files""" , [ ["""full:README.md""", """dataset_infos.json"""], ["""empty:README.md""", """dataset_infos.json"""], ...
612
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __A(lowerCAmelCase , lowerCAmelCase ) -> np.array: """simple docstring""" _UpperCamelCase = F'{sampling_rate}' _UpperCamelCase = """1""" _UpperCam...
612
1
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTesterMixin i...
612
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
1
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 Accelerator, Dist...
612
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
1
from math import factorial def __A(lowerCAmelCase = 1_0_0 ) -> int: """simple docstring""" return sum(map(lowerCAmelCase , str(factorial(lowerCAmelCase ) ) ) ) if __name__ == "__main__": print(solution(int(input("Enter the Number: ").strip())))
612
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2struct-textcaps-ba...
612
1
import numpy # List of input, output pairs lowerCamelCase__ = ( ((5, 2, 3), 15), ((6, 5, 9), 25), ((11, 12, 13), 41), ((1, 1, 1), 8), ((11, 12, 13), 41), ) lowerCamelCase__ = (((515, 22, 13), 555), ((61, 35, 49), 150)) lowerCamelCase__ = [2, 4, 1, 5] lowerCamelCase__ =...
612
import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampler, SkipDataLoader, sk...
612
1
import json import os import unittest from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES, XLMTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class lowerCAmelCase__ ( __lowercase , unittest.TestCase ): ...
612
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 ): @pr...
612
1
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArguments @require_tf c...
612
import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modules import _PACKAGED_DATASETS_M...
612
1
from PIL import Image def __A(lowerCAmelCase , lowerCAmelCase ) -> Image: """simple docstring""" _UpperCamelCase = (2_5_9 * (level + 2_5_5)) / (2_5_5 * (2_5_9 - level)) def contrast(lowerCAmelCase ) -> int: return int(1_2_8 + factor * (c - 1_2_8) ) return img.point...
612
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __A(lowerCAmelCase ) -> Dict: """simple docstring""" _UpperCamelCase = os.path.join(args.tf_model_dir , """parameters.json""" ) _UpperCamelC...
612
1
import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTes...
612
import warnings from .generation import TFGenerationMixin class lowerCAmelCase__ ( __lowercase ): # warning at import time warnings.warn( "Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will " "be removed in Transform...
612
1
from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask fro...
612
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
612
1
def __A(lowerCAmelCase , lowerCAmelCase ) -> int: """simple docstring""" return number | (1 << position) def __A(lowerCAmelCase , lowerCAmelCase ) -> int: """simple docstring""" return number & ~(1 << position) def __A(lowerCAmelCase , lowerCAmelCase ) ->...
612
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) from ...
612
1
def __A(lowerCAmelCase ) -> bool: """simple docstring""" _UpperCamelCase = (1 + 2_4 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def __A(lowerCAmelCase = 5_0_0_0 ) -> int: """simple docstring""" _UpperCamelCase = [(i * (3 * i - 1)) // 2 for i in...
612
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impo...
612
1
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "microsoft/git-base": "https://huggingface.co/microsoft/git-base/resolve/main/config.json", } ...
612
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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, IMA...
612
1
import numpy as np def __A(lowerCAmelCase ) -> np.array: """simple docstring""" return (2 / (1 + np.exp(-2 * vector ))) - 1 if __name__ == "__main__": import doctest doctest.testmod()
612
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("T") lowerCamelCase__ = TypeVar("U") class lowerCAmelCase__ ( Generic[T, U] ): def __init__( self , a , a ) ...
612
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
612
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @req...
612
1
def __A(lowerCAmelCase ) -> list[int]: """simple docstring""" _UpperCamelCase = len(lowerCAmelCase ) for i in range(lowerCAmelCase ): for j in range(i + 1 , lowerCAmelCase ): if numbers[j] < numbers[i]: _UpperCamelCase , _UpperCamelCase =...
612
# 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/LICENSE-2.0 # # Unless required by app...
612
1
lowerCamelCase__ = "Input must be a string of 8 numbers plus letter" lowerCamelCase__ = "TRWAGMYFPDXBNJZSQVHLCKE" def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): _UpperCamelCase = F'Expected stri...
612
from collections.abc import Sequence def __A(lowerCAmelCase = None ) -> int: """simple docstring""" if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _UpperCamelCase = nums[0] for i in range(1 , len(lowerCAmelCase ) ): _U...
612
1
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor lowerCamelCase__ = logging.get_logger(__name__) class lowerCAmelCase__ ( __lowercase ): def __init__( self , *a , **a ) -> None: '''si...
612
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
1
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 HfArgumentParser, TrainingArguments f...
612
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase__ ( __lowercase ): @staticmethod @abstractmethod def A_ ( a ) -> Union[str, Any]: '''simple docstring''' raise NotImplementedError() ...
612
1
from typing import List, Optional from tokenizers import ByteLevelBPETokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_blenderbot_small import BlenderbotSmallTokenizer lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ ...
612
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
1
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 ): @pr...
612
def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise ValueError("""check_bouncy() accepts only integer arguments""" ) _UpperCamelCase = str(lowerCAmelCase ) _UpperCamelCase = """""".join(sort...
612
1
import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class lowerCAmelCase__ ( __lowercase ): def __init__( self , a , a=None , a=True , a=None ...
612
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : int = (KDPMaDiscreteScheduler,) UpperCamelCase_ : Optional[int...
612
1
import inspect 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_config_docstrings.py lowerCamelCase__ = "src/transformers" # This is to make sure the transforme...
612
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __A(lowerCAmelCase , lowerCAmelCase ) -> np.array: """simple docstring""" _UpperCamelCase = F'{sampling_rate}' _UpperCamelCase = """1""" _UpperCam...
612
1
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger lowerCamelCase__ = get_logger(__name__) class lowerCAmelCase__ ( enum.Enum ): UpperCamelCase_ : Optional[int] = "all_checks" UpperCam...
612
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
1
import json import os import unittest from typing import Tuple from transformers import WavaVecaPhonemeCTCTokenizer from transformers.models.wavaveca.tokenization_wavaveca import VOCAB_FILES_NAMES from transformers.models.wavaveca_phoneme.tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizerOutput from tra...
612
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
1
from dataclasses import dataclass from typing import Optional import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .modeling_utils import ModelMixin @dataclass class lowerCAme...
612
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2struct-textcaps-ba...
612
1
import random def __A(lowerCAmelCase ) -> bool: """simple docstring""" _UpperCamelCase = num - 1 _UpperCamelCase = 0 while s % 2 == 0: _UpperCamelCase = s // 2 t += 1 for _ in range(5 ): _UpperCamelCase = random.randrange...
612
import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampler, SkipDataLoader, sk...
612
1
import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node lowerCamelCase__ = 4 lowerCamelCase__ = 3 class lowerCAmelCase__ ( __lowercase ): ...
612
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 ): @pr...
612
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_swinv2": ["SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP", "Swinv2Config"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() ...
612
import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modules import _PACKAGED_DATASETS_M...
612
1
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_roberta import RobertaTokenizer lowe...
612
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __A(lowerCAmelCase ) -> Dict: """simple docstring""" _UpperCamelCase = os.path.join(args.tf_model_dir , """parameters.json""" ) _UpperCamelC...
612
1
from argparse import ArgumentParser from . import BaseTransformersCLICommand def __A(lowerCAmelCase ) -> Union[str, Any]: """simple docstring""" return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) class lowerCAmelCase__ ( __lowe...
612
import warnings from .generation import TFGenerationMixin class lowerCAmelCase__ ( __lowercase ): # warning at import time warnings.warn( "Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will " "be removed in Transform...
612
1
import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis from lavis.models import load_model_and_preprocess from PIL import Image from transformers import ( AutoTokenizer...
612
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
612
1
from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig lowerCamelCase__ = { "susnato/ernie-m-base_pytorch": "https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json", "susnato/ernie-m-large_pytorch": "https://huggingface.co/s...
612
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) from ...
612
1
# 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/LICENSE-2.0 # # Unless required by app...
612
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impo...
612
1
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.utils import logging logging.set_verbosity...
612
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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, IMA...
612
1
import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import f...
612
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("T") lowerCamelCase__ = TypeVar("U") class lowerCAmelCase__ ( Generic[T, U] ): def __init__( self , a , a ) ...
612
1
from __future__ import annotations def __A(lowerCAmelCase ) -> int: """simple docstring""" if not nums: return 0 _UpperCamelCase = nums[0] _UpperCamelCase = 0 for num in nums[1:]: _UpperCamelCase , _UpperCamelCase = ( max_exc...
612
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @req...
612
1
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> int: """simple docstring""" if len(lowerCAmelCase ) < k or k < 0: raise ValueError("""Invalid Input""" ) _UpperCamelCase = _UpperCamelCase = sum(array[:k] ) for i in range(...
612
# 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/LICENSE-2.0 # # Unless required by app...
612
1
import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, ...
612
from collections.abc import Sequence def __A(lowerCAmelCase = None ) -> int: """simple docstring""" if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _UpperCamelCase = nums[0] for i in range(1 , len(lowerCAmelCase ) ): _U...
612
1
import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor lowerCamelCase__ = logging.get_logger(__name__) class lowerCAmelCase__ ( __lowercase ): def __init__( self , *a , **a ) -> None: ...
612
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
1
import argparse import fairseq import torch from torch import nn from transformers import ( MBartaaTokenizer, MBartConfig, MBartForCausalLM, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaModel, logging, ) logging.set_ver...
612
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase__ ( __lowercase ): @staticmethod @abstractmethod def A_ ( a ) -> Union[str, Any]: '''simple docstring''' raise NotImplementedError() ...
612
1
import os import re import warnings from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_ta import TaTokenizer else: lowerCa...
612
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
1
import tempfile import unittest from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from transformers.testing_utils import ( is_torch_available, require_optimum, require_torch, slow, ) if is_torch_available(): import torch @require_torch @require_optimum @slow class lowerCA...
612
def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise ValueError("""check_bouncy() accepts only integer arguments""" ) _UpperCamelCase = str(lowerCAmelCase ) _UpperCamelCase = """""".join(sort...
612
1
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer, ...
612
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : int = (KDPMaDiscreteScheduler,) UpperCamelCase_ : Optional[int...
612
1
import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_available, is_tf_available, logging from .benchmark...
612
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __A(lowerCAmelCase , lowerCAmelCase ) -> np.array: """simple docstring""" _UpperCamelCase = F'{sampling_rate}' _UpperCamelCase = """1""" _UpperCam...
612
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_big_bird import Bi...
612
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
1
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @req...
612
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
1
import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate import Accelerator from accelerate.test...
612
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2struct-textcaps-ba...
612
1
from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils import stable_softmax if is_torch_ava...
612
import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampler, SkipDataLoader, sk...
612
1
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
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 ): @pr...
612
1
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impo...
612
import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modules import _PACKAGED_DATASETS_M...
612
1
# 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 required by applicab...
612
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __A(lowerCAmelCase ) -> Dict: """simple docstring""" _UpperCamelCase = os.path.join(args.tf_model_dir , """parameters.json""" ) _UpperCamelC...
612
1
import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.huggingface import HuggingFace ...
612
import warnings from .generation import TFGenerationMixin class lowerCAmelCase__ ( __lowercase ): # warning at import time warnings.warn( "Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will " "be removed in Transform...
612
1
from collections import deque from math import floor from random import random from time import time class lowerCAmelCase__ : def __init__( self ) -> Tuple: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ...
612
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
612
1
from typing import Any, Dict, List, Optional, Tuple, Union import torch from torch import nn from torch.utils.data import DistributedSampler, RandomSampler from transformers import PreTrainedModel, Trainer, logging from transformers.integrations import is_fairscale_available from transformers.models.fsmt.configurati...
612
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) from ...
612
1
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_utils import FrozenDict fro...
612
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impo...
612
1
from __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup lowerCamelCase__ = "https://www.indeed.co.in/jobs?q=mobile+app+development&l=" def __A(lowerCAmelCase = "mumbai" ) -> Generator[tuple[str, str], None, None]: """simple docst...
612
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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, IMA...
612
1
from __future__ import annotations from collections.abc import Iterator from typing import Any class lowerCAmelCase__ : def __init__( self , a ) -> Optional[int]: '''simple docstring''' _UpperCamelCase = data _UpperCamelCase ...
612
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("T") lowerCamelCase__ = TypeVar("U") class lowerCAmelCase__ ( Generic[T, U] ): def __init__( self , a , a ) ...
612
1
import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modules import _PACKAGED_DATASETS_M...
612
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @req...
612
1
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("T") lowerCamelCase__ = TypeVar("U") class lowerCAmelCase__ ( Generic[T, U] ): def __init__( self , a , a ) ...
612
# 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/LICENSE-2.0 # # Unless required by app...
612
1
import warnings from .generation import TFGenerationMixin class lowerCAmelCase__ ( __lowercase ): # warning at import time warnings.warn( "Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will " "be removed in Transform...
612
from collections.abc import Sequence def __A(lowerCAmelCase = None ) -> int: """simple docstring""" if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _UpperCamelCase = nums[0] for i in range(1 , len(lowerCAmelCase ) ): _U...
612
1
from math import pow, sqrt def __A(*lowerCAmelCase ) -> bool: """simple docstring""" _UpperCamelCase = len(lowerCAmelCase ) > 0 and all(value > 0.0 for value in values ) return result def __A(lowerCAmelCase , lowerCAmelCase ) -> float | ValueError: """simpl...
612
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
1
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from ...image_pr...
612
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase__ ( __lowercase ): @staticmethod @abstractmethod def A_ ( a ) -> Union[str, Any]: '''simple docstring''' raise NotImplementedError() ...
612
1
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "huggingface/informer-tourism-monthly": ( "https://huggingface.co/huggingface/informer-tourism-m...
612
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
1
from __future__ import annotations from random import random from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("KT") lowerCamelCase__ = TypeVar("VT") class lowerCAmelCase__ ( Generic[KT, VT] ): def __init__( self , a = "root" , a = None ...
612
def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise ValueError("""check_bouncy() accepts only integer arguments""" ) _UpperCamelCase = str(lowerCAmelCase ) _UpperCamelCase = """""".join(sort...
612
1
from math import log from scipy.constants import Boltzmann, physical_constants lowerCamelCase__ = 300 # TEMPERATURE (unit = K) def __A(lowerCAmelCase , lowerCAmelCase , lowerCAmelCase , ) -> float: """simple docstring""" if donor_conc <= 0: raise ValueError("""Donor concen...
612
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : int = (KDPMaDiscreteScheduler,) UpperCamelCase_ : Optional[int...
612
1
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, ...
612
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __A(lowerCAmelCase , lowerCAmelCase ) -> np.array: """simple docstring""" _UpperCamelCase = F'{sampling_rate}' _UpperCamelCase = """1""" _UpperCam...
612
1
from __future__ import annotations import requests lowerCamelCase__ = set( "approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post category clicked content_categories created_utc downs\n...
612
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
1
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ...
612
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
1
from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging lowerCamelCase__ = logging.get_logger(__name__) def __A(lowerCAmelCase ) -> List[int]: """simple docstring""" if isinstance(lowerCAmelCase , np.ndarray ): return l...
612
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pix2struct-textcaps-base": ( "https://huggingface.co/google/pix2struct-textcaps-ba...
612
1
def __A(lowerCAmelCase , lowerCAmelCase ) -> float: """simple docstring""" def get_matched_characters(lowerCAmelCase , lowerCAmelCase ) -> str: _UpperCamelCase = [] _UpperCamelCase = min(len(_stra ) , len(_stra ) ) // 2 for i, l in enumerate(...
612
import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampler, SkipDataLoader, sk...
612
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCamelCase__ = { "configuration_transfo_xl": ["TRANSFO_XL_PRETRAINED_CONFIG_ARCHIVE_MAP", "TransfoXLConfig"], "tokenization_transfo_xl": ["TransfoXLCorpus", "Tra...
612
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 ): @pr...
612
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "google/pegasus-large": "https://huggingface.co/google/pegasus-large/resolve/main/config.json", # See all PEGASUS models at https://huggingfac...
612
import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modules import _PACKAGED_DATASETS_M...
612
1
import os def __A(lowerCAmelCase ) -> Optional[Any]: """simple docstring""" _UpperCamelCase = len(grid[0] ) _UpperCamelCase = len(lowerCAmelCase ) _UpperCamelCase = 0 _UpperCamelCase = 0 _UpperCamelCase = 0 # Check...
612
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def __A(lowerCAmelCase ) -> Dict: """simple docstring""" _UpperCamelCase = os.path.join(args.tf_model_dir , """parameters.json""" ) _UpperCamelC...
612
1
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class lowerCAmelCase__ ( __lowercase , __lowercase ): @register_to_config def __init__( self , *, a = 4 , a = 7...
612
import warnings from .generation import TFGenerationMixin class lowerCAmelCase__ ( __lowercase ): # warning at import time warnings.warn( "Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will " "be removed in Transform...
612
1
def __A(lowerCAmelCase , lowerCAmelCase ) -> List[str]: """simple docstring""" _UpperCamelCase = [0 for i in range(r + 1 )] # nc0 = 1 _UpperCamelCase = 1 for i in range(1 , n + 1 ): # to compute current row from previous row. _UpperCamelCase ...
612
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_upernet": ["UperNetConfig"], } try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: ...
612
1
import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from transformers.utils import l...
612
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) from ...
612
1
import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : Optional[int] = (PNDMScheduler,) UpperCamelCase_ : int = (("num_inference_steps", 50),) ...
612
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers impo...
612
1
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : int = (KDPMaDiscreteScheduler,) UpperCamelCase_ : Optional[int...
612
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, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, IMA...
612
1
def __A(lowerCAmelCase ) -> str: """simple docstring""" return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
612
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCamelCase__ = TypeVar("T") lowerCamelCase__ = TypeVar("U") class lowerCAmelCase__ ( Generic[T, U] ): def __init__( self , a , a ) ...
612
1
from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDiffusionScheduler from ...utils im...
612
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp @slow @req...
612
1
from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask from ...test_pipeline...
612
# 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/LICENSE-2.0 # # Unless required by app...
612
1
from __future__ import annotations import queue class lowerCAmelCase__ : def __init__( self , a ) -> Optional[int]: '''simple docstring''' _UpperCamelCase = data _UpperCamelCase = None _UpperCamelCase ...
612
from collections.abc import Sequence def __A(lowerCAmelCase = None ) -> int: """simple docstring""" if nums is None or not nums: raise ValueError("""Input sequence should not be empty""" ) _UpperCamelCase = nums[0] for i in range(1 , len(lowerCAmelCase ) ): _U...
612
1
lowerCamelCase__ = 6_5521 def __A(lowerCAmelCase ) -> int: """simple docstring""" _UpperCamelCase = 1 _UpperCamelCase = 0 for plain_chr in plain_text: _UpperCamelCase = (a + ord(lowerCAmelCase )) % MOD_ADLER _UpperCamelCase = ...
612
from __future__ import annotations lowerCamelCase__ = "#" class lowerCAmelCase__ : def __init__( self ) -> None: '''simple docstring''' _UpperCamelCase = {} def A_ ( self , a ) -> None: ''...
612
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase__ = {"configuration_mbart": ["MBART_PRETRAINED_CONFIG...
612
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCAmelCase__ ( __lowercase ): @staticmethod @abstractmethod def A_ ( a ) -> Union[str, Any]: '''simple docstring''' raise NotImplementedError() ...
612
1
import unittest import numpy as np from transformers import BertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from transformers.models.ber...
612
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.ut...
612
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = { "configuration_nllb_moe": [ "NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP", "NllbMoeConfig", ] } try: if not is_torch_available(): raise Optiona...
612
def __A(lowerCAmelCase ) -> bool: """simple docstring""" if not isinstance(lowerCAmelCase , lowerCAmelCase ): raise ValueError("""check_bouncy() accepts only integer arguments""" ) _UpperCamelCase = str(lowerCAmelCase ) _UpperCamelCase = """""".join(sort...
612
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { "microsoft/biogpt": "https://huggingface.co/microsoft/biogpt/resolve/main/config.json", # See all BioGPT models at https://huggingface.co/mode...
612
import torch from diffusers import KDPMaDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class lowerCAmelCase__ ( __lowercase ): UpperCamelCase_ : int = (KDPMaDiscreteScheduler,) UpperCamelCase_ : Optional[int...
612
1
import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets lowerCamelCase__ = "\n@inproceedings{xu-etal-2016-optimizing,\n title = {Optimizing Statistical Machine Translation for Text Simplification},\n authors={Xu, Wei and...
612
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def __A(lowerCAmelCase , lowerCAmelCase ) -> np.array: """simple docstring""" _UpperCamelCase = F'{sampling_rate}' _UpperCamelCase = """1""" _UpperCam...
612
1
import asyncio import os import shutil import subprocess import sys import tempfile import unittest from distutils.util import strtobool from functools import partial from pathlib import Path from typing import List, Union from unittest import mock import torch from ..state import AcceleratorState, PartialState from...
612
import pprint import requests lowerCamelCase__ = "https://zenquotes.io/api" def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """/today""" ).json() def __A() -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + """...
612
1
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename lowerCamelCase__ = "http://www.mocksite.com/file1.txt" lowerCam...
612
from __future__ import annotations def __A(lowerCAmelCase , lowerCAmelCase ) -> list[list[int]]: """simple docstring""" _UpperCamelCase = [] _UpperCamelCase = [] _UpperCamelCase = 0 _UpperCamelCase = sum(lowerCAmelCase ) create_st...
612
1