code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision fr...
242
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig _A = logging.get_logger(__name__) class _lowerCamelCase : def __init__( sel...
242
1
"""simple docstring""" from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class _lowerCamelCase ( a_ ): def __init__( self : Optional[int] , UpperCamelCase : Calla...
242
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: def count_of_possible_combinations(__UpperCAmelCase ) -> int: if target < 0: return 0 if target == 0: r...
242
1
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig _A = logging.get_logger(__name__) _A = { """Intel/dpt-large""": """https://huggingface.co/Intel/dpt-large/resolve/main/config.json"""...
242
"""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/LICENSE-2...
242
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { """face...
242
"""simple docstring""" from typing import Any import numpy as np def lowercase_ ( __UpperCAmelCase ) -> bool: return np.array_equal(__UpperCAmelCase , matrix.conjugate().T ) def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> Any: ...
242
1
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from typing import Optional import evaluate import numpy as np import torch from datasets import load_dataset from PIL import Image from torchvision.transforms import ( CenterCrop, Compose, Normalize,...
242
"""simple docstring""" from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _lowerCamelCase ( a_ ): def _lowerCAmelCase ( self : Any ) -> str: """simple docstring""" return [ ...
242
1
"""simple docstring""" from __future__ import annotations def lowercase_ ( __UpperCAmelCase ) -> int: if not nums: return 0 lowerCAmelCase__ : List[Any] = nums[0] lowerCAmelCase__ : List[str] = 0 for num in nums[1:]: ...
242
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( ...
242
1
"""simple docstring""" from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class _lowerCamelCase ( a_ ): def __init__( self : Union[s...
242
"""simple docstring""" 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 transf...
242
1
"""simple docstring""" from typing import List import jiwer import jiwer.transforms as tr from packaging import version import datasets from datasets.config import PY_VERSION if PY_VERSION < version.parse("""3.8"""): import importlib_metadata else: import importlib.metadata as importlib_metadata _A ...
242
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { """face...
242
1
"""simple docstring""" from math import pi def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> float: return 2 * pi * radius * (angle / 360) if __name__ == "__main__": print(arc_length(9_0, 1_0))
242
"""simple docstring""" from __future__ import annotations import bisect def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase = 0 , __UpperCAmelCase = -1 ) -> int: if hi < 0: lowerCAmelCase__ : Union[str, Any] = len(__Uppe...
242
1
"""simple docstring""" import gc import random import tempfile import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LMSDiscreteScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipel...
242
"""simple docstring""" import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, 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...
242
1
"""simple docstring""" import numpy as np _A = [ ["""a""", """b""", """c""", """d""", """e"""], ["""f""", """g""", """h""", """i""", """k"""], ["""l""", """m""", """n""", """o""", """p"""], ["""q""", """r""", """s""", """t""", """u"""], ["""v""", """w""", """x""", """y""", """z...
242
"""simple docstring""" from __future__ import annotations def lowercase_ ( __UpperCAmelCase ) -> int: if not nums: return 0 lowerCAmelCase__ : List[Any] = nums[0] lowerCAmelCase__ : List[str] = 0 for num in nums[1:]: ...
242
1
"""simple docstring""" import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoT...
242
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowercase_ ( ) -> Optional[int]: lowerCAmelCase__ : Dict = { """repo_name""": ["""test_repo1""...
242
1
"""simple docstring""" from __future__ import annotations from collections.abc import MutableSequence class _lowerCamelCase : def __init__( self : Optional[Any] , UpperCamelCase : int , UpperCamelCase : MutableSequence[float] ) -> None: """simple docstring""" ...
242
"""simple docstring""" import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoT...
242
1
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin if is_torch_available(): import t...
242
"""simple docstring""" from itertools import product def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> list[int]: lowerCAmelCase__ : Union[str, Any] = sides_number lowerCAmelCase__ : Optional[int] = max_face_number * dice_number ...
242
1
"""simple docstring""" from functools import reduce _A = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """1254069874715852386305071569329096329522744304355...
242
"""simple docstring""" from string import ascii_uppercase _A = {str(ord(c) - 5_5): c for c in ascii_uppercase} def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> str: if isinstance(__UpperCAmelCase , __UpperCAmelCase ): raise TypeEr...
242
1
"""simple docstring""" from math import factorial def lowercase_ ( __UpperCAmelCase = 20 ) -> int: lowerCAmelCase__ : str = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... lowerCAmelCase__ : Optional[int] ...
242
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase = 0 ) -> list: lowerCAmelCase__ : Optional[Any] = length or len(__UpperCAmelCase ) lowerCAmelCase__ : int = False for i in range(length - 1 ): ...
242
1
"""simple docstring""" import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStructProcessor, ...
242
"""simple docstring""" import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def lowercase_ ( __UpperCAmelCase ) ->...
242
1
"""simple docstring""" import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMSchedule...
242
"""simple docstring""" 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, ) fro...
242
1
"""simple docstring""" import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 _A = 0b101_100_111_110_110_010_010_000_011_110_111_01...
242
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _A = logging.get_logger(__name__) _A = { """SenseTime/deformable-detr""": """https://huggingface.co/sensetime/deformable-detr/r...
242
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { """weiweishi/roc-bert-base-zh""": """https://huggingface.co/weiweishi/roc-bert-base-zh/resolve/main/config.json""", } class _lowerC...
242
"""simple docstring""" def lowercase_ ( __UpperCAmelCase = 1000 ) -> int: lowerCAmelCase__ : Optional[Any] = 2**power lowerCAmelCase__ : Optional[int] = str(__UpperCAmelCase ) lowerCAmelCase__ : Optional[int] = list(__Upper...
242
1
"""simple docstring""" def lowercase_ ( __UpperCAmelCase ) -> str: return "".join(chr(ord(__UpperCAmelCase ) - 32 ) if """a""" <= char <= """z""" else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
242
"""simple docstring""" 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 accele...
242
1
"""simple docstring""" from __future__ import annotations _A = 1.6021e-19 # units = C def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , ) -> tuple[str, float]: if (conductivity, electron_conc, mobility).count(0 ) != 1: ...
242
"""simple docstring""" import math def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> int: lowerCAmelCase__ : Any = len(__UpperCAmelCase ) lowerCAmelCase__ : int = int(math.floor(math.sqrt(__UpperCAmelCase ) ) ) ...
242
1
"""simple docstring""" import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class _lowerCamelCase ( a_ ): _lowerCamelCase :int = (PNDMScheduler,) _lowerCamelCase :Optional[int] = (("num_inference_steps", 50),) ...
242
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig _A = logging.get_logger(__name__) class _lowerCamelCase : def __init__( sel...
242
1
"""simple docstring""" def lowercase_ ( __UpperCAmelCase = 1000 ) -> int: lowerCAmelCase__ : Optional[Any] = 2**power lowerCAmelCase__ : Optional[int] = str(__UpperCAmelCase ) lowerCAmelCase__ : Optional[int] = list(__Upper...
242
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: def count_of_possible_combinations(__UpperCAmelCase ) -> int: if target < 0: return 0 if target == 0: r...
242
1
"""simple docstring""" # Copyright 2022 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 # ...
242
"""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/LICENSE-2...
242
1
"""simple docstring""" 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 accele...
242
"""simple docstring""" from typing import Any import numpy as np def lowercase_ ( __UpperCAmelCase ) -> bool: return np.array_equal(__UpperCAmelCase , matrix.conjugate().T ) def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> Any: ...
242
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { """SCUT-DLVCLab/lilt-roberta-en-base""": ( """https://huggingface.co/SCUT-DLVCLab/lilt-roberta-en-base/resolve/main/config.js...
242
"""simple docstring""" from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _lowerCamelCase ( a_ ): def _lowerCAmelCase ( self : Any ) -> str: """simple docstring""" return [ ...
242
1
"""simple docstring""" import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ...test_modelin...
242
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( ...
242
1
"""simple docstring""" import re import tempfile from pathlib import Path import pytest import yaml from datasets.utils.readme import ReadMe # @pytest.fixture # def example_yaml_structure(): _A = yaml.safe_load( """\ name: \"\" allow_empty: false allow_empty_text: true subsections: - nam...
242
"""simple docstring""" 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 transf...
242
1
"""simple docstring""" from typing import Any def lowercase_ ( __UpperCAmelCase ) -> list[Any]: if not input_list: return [] lowerCAmelCase__ : str = [input_list.count(__UpperCAmelCase ) for value in input_list] lowerCAmelCase__ : str...
242
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { """face...
242
1
"""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...
242
"""simple docstring""" from __future__ import annotations import bisect def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase = 0 , __UpperCAmelCase = -1 ) -> int: if hi < 0: lowerCAmelCase__ : Union[str, Any] = len(__Uppe...
242
1
"""simple docstring""" def lowercase_ ( __UpperCAmelCase ) -> bool: if number < 0: raise ValueError("""number must not be negative""" ) return number & (number - 1) == 0 if __name__ == "__main__": import doctest doctest.testmod()
242
"""simple docstring""" import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, 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...
242
1
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> list: lowerCAmelCase__ : Dict = len(__UpperCAmelCase ) lowerCAmelCase__ : Tuple = [[0] * n for i in range(__UpperCAmelCase )] ...
242
"""simple docstring""" from __future__ import annotations def lowercase_ ( __UpperCAmelCase ) -> int: if not nums: return 0 lowerCAmelCase__ : List[Any] = nums[0] lowerCAmelCase__ : List[str] = 0 for num in nums[1:]: ...
242
1
"""simple docstring""" def lowercase_ ( __UpperCAmelCase ) -> int: lowerCAmelCase__ : list[list[int]] = [[0 for _ in range(__UpperCAmelCase )] for _ in range(m + 1 )] for i in range(m + 1 ): lowerCAmelCase__ : Any = 1 ...
242
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowercase_ ( ) -> Optional[int]: lowerCAmelCase__ : Dict = { """repo_name""": ["""test_repo1""...
242
1
"""simple docstring""" from __future__ import annotations import bisect def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase = 0 , __UpperCAmelCase = -1 ) -> int: if hi < 0: lowerCAmelCase__ : Union[str, Any] = len(__Uppe...
242
"""simple docstring""" import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoT...
242
1
"""simple docstring""" from __future__ import annotations def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> list[tuple[int, int]]: lowerCAmelCase__ , lowerCAmelCase__ : Optional[int] = position lowerCAmelCase__ : Any = [ ...
242
"""simple docstring""" from itertools import product def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> list[int]: lowerCAmelCase__ : Union[str, Any] = sides_number lowerCAmelCase__ : Optional[int] = max_face_number * dice_number ...
242
1
"""simple docstring""" def lowercase_ ( ) -> Dict: for n in range(1 , 100_0000 ): yield n * (n + 1) // 2 def lowercase_ ( __UpperCAmelCase ) -> int: lowerCAmelCase__ : Tuple = 1 lowerCAmelCase__ : Optional[Any]...
242
"""simple docstring""" from string import ascii_uppercase _A = {str(ord(c) - 5_5): c for c in ascii_uppercase} def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> str: if isinstance(__UpperCAmelCase , __UpperCAmelCase ): raise TypeEr...
242
1
"""simple docstring""" import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaa...
242
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase = 0 ) -> list: lowerCAmelCase__ : Optional[Any] = length or len(__UpperCAmelCase ) lowerCAmelCase__ : int = False for i in range(length - 1 ): ...
242
1
"""simple docstring""" import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def lowercase_ ( __UpperCAmelCase ) -> Dict: lowerCAmelCase__ : Optional[int] = [ """encoder.version""", ...
242
"""simple docstring""" import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def lowercase_ ( __UpperCAmelCase ) ->...
242
1
"""simple docstring""" import baseaa def lowercase_ ( __UpperCAmelCase ) -> bytes: return baseaa.aaaencode(string.encode("""utf-8""" ) ) def lowercase_ ( __UpperCAmelCase ) -> str: return baseaa.aaadecode(__UpperCAmelCase ).decode...
242
"""simple docstring""" 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, ) fro...
242
1
"""simple docstring""" import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transforme...
242
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _A = logging.get_logger(__name__) _A = { """SenseTime/deformable-detr""": """https://huggingface.co/sensetime/deformable-detr/r...
242
1
"""simple docstring""" def lowercase_ ( __UpperCAmelCase = 200_0000 ) -> int: lowerCAmelCase__ : Union[str, Any] = [0 for i in range(n + 1 )] lowerCAmelCase__ : Any = 1 lowerCAmelCase__ : Optional[Any] = 1 for i in r...
242
"""simple docstring""" def lowercase_ ( __UpperCAmelCase = 1000 ) -> int: lowerCAmelCase__ : Optional[Any] = 2**power lowerCAmelCase__ : Optional[int] = str(__UpperCAmelCase ) lowerCAmelCase__ : Optional[int] = list(__Upper...
242
1
"""simple docstring""" _A = [0, 2, 4, 6, 8] _A = [1, 3, 5, 7, 9] def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: if remaining_length == 0: if digits[0] == 0 or digits[-1] == ...
242
"""simple docstring""" 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 accele...
242
1
"""simple docstring""" # HF Trainer benchmarking tool # # This tool can be used to run and compare multiple dimensions of the HF Trainers args. # # It then prints a report once in github format with all the information that needs to be shared # with others and second time in a console-friendly format, so it's ea...
242
"""simple docstring""" import math def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> int: lowerCAmelCase__ : Any = len(__UpperCAmelCase ) lowerCAmelCase__ : int = int(math.floor(math.sqrt(__UpperCAmelCase ) ) ) ...
242
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { """xlm-mlm-en-2048""": """https://hugg...
242
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig _A = logging.get_logger(__name__) class _lowerCamelCase : def __init__( sel...
242
1
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig _A = logging.get_logger(__name__) class _lowerCamelCase : def __init__( sel...
242
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: def count_of_possible_combinations(__UpperCAmelCase ) -> int: if target < 0: return 0 if target == 0: r...
242
1
"""simple docstring""" 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 VQDiffus...
242
"""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/LICENSE-2...
242
1
"""simple docstring""" import datasets from .evaluate import evaluate _A = """\ @inproceedings{Rajpurkar2016SQuAD10, title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text}, author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang}, booktitle={EMNLP}, y...
242
"""simple docstring""" from typing import Any import numpy as np def lowercase_ ( __UpperCAmelCase ) -> bool: return np.array_equal(__UpperCAmelCase , matrix.conjugate().T ) def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> Any: ...
242
1
"""simple docstring""" import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class _lowerCamelCase ( unittest.TestCase ...
242
"""simple docstring""" from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _lowerCamelCase ( a_ ): def _lowerCAmelCase ( self : Any ) -> str: """simple docstring""" return [ ...
242
1
"""simple docstring""" import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () _A = np.linspace(start=0, stop=7_5, num=7_5, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership function # (...
242
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( ...
242
1
"""simple docstring""" import copy import random from transformers import CLIPTokenizer class _lowerCamelCase ( a_ ): def __init__( self : List[str] , *UpperCamelCase : Dict , **UpperCamelCase : List[Any] ) -> Dict: """simple docstring""" super()...
242
"""simple docstring""" 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 transf...
242
1
"""simple docstring""" import importlib.util import json import os import warnings from dataclasses import dataclass, field import torch from ..training_args import TrainingArguments from ..utils import cached_property, is_sagemaker_dp_enabled, logging _A = logging.get_logger(__name__) def ...
242
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { """face...
242
1
"""simple docstring""" import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size from ..ut...
242
"""simple docstring""" from __future__ import annotations import bisect def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase = 0 , __UpperCAmelCase = -1 ) -> int: if hi < 0: lowerCAmelCase__ : Union[str, Any] = len(__Uppe...
242
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { """alibaba-damo/mgp-str-base""": """https://huggingface.co/alibaba-damo/mgp-str-base/resolve/main/config.json""", } class _lowerCam...
242
"""simple docstring""" import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, 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...
242
1
"""simple docstring""" import argparse import tensorflow as tf import torch from transformers import BertConfig, BertForMaskedLM from transformers.models.bert.modeling_bert import ( BertIntermediate, BertLayer, BertOutput, BertPooler, BertSelfAttention, BertSelfOutput, ) from transforme...
242
"""simple docstring""" from __future__ import annotations def lowercase_ ( __UpperCAmelCase ) -> int: if not nums: return 0 lowerCAmelCase__ : List[Any] = nums[0] lowerCAmelCase__ : List[str] = 0 for num in nums[1:]: ...
242
1
"""simple docstring""" from __future__ import annotations from random import choice def lowercase_ ( __UpperCAmelCase ) -> Optional[Any]: return choice(__UpperCAmelCase ) def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> int: l...
242
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowercase_ ( ) -> Optional[int]: lowerCAmelCase__ : Dict = { """repo_name""": ["""test_repo1""...
242
1
"""simple docstring""" import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_R...
242
"""simple docstring""" import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoT...
242
1
"""simple docstring""" from typing import List import numpy as np def lowercase_ ( __UpperCAmelCase ) -> int: lowerCAmelCase__ : List[Any] = {key: len(__UpperCAmelCase ) for key, value in gen_kwargs.items() if isinstance(__UpperCAmelCase , __UpperCAmelCas...
242
"""simple docstring""" from itertools import product def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> list[int]: lowerCAmelCase__ : Union[str, Any] = sides_number lowerCAmelCase__ : Optional[int] = max_face_number * dice_number ...
242
1
"""simple docstring""" import os def lowercase_ ( ) -> Tuple: lowerCAmelCase__ : Optional[Any] = os.path.dirname(os.path.realpath(__UpperCAmelCase ) ) lowerCAmelCase__ : Union[str, Any] = os.path.join(__UpperCAmelCase , """triangle.txt"...
242
"""simple docstring""" from string import ascii_uppercase _A = {str(ord(c) - 5_5): c for c in ascii_uppercase} def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> str: if isinstance(__UpperCAmelCase , __UpperCAmelCase ): raise TypeEr...
242
1
"""simple docstring""" import unittest from transformers import SPIECE_UNDERLINE, ReformerTokenizer, ReformerTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenizatio...
242
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase = 0 ) -> list: lowerCAmelCase__ : Optional[Any] = length or len(__UpperCAmelCase ) lowerCAmelCase__ : int = False for i in range(length - 1 ): ...
242
1
"""simple docstring""" import inspect import unittest from transformers import SegformerConfig, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester ...
242
"""simple docstring""" import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def lowercase_ ( __UpperCAmelCase ) ->...
242
1
"""simple docstring""" import unittest from diffusers.models.unet_ad_blocks import * # noqa F403 from diffusers.utils import torch_device from .test_unet_blocks_common import UNetBlockTesterMixin class _lowerCamelCase ( a_ , unittest.TestCase ): _lowerCamelCase :Any = DownBlo...
242
"""simple docstring""" 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, ) fro...
242
1
"""simple docstring""" def lowercase_ ( __UpperCAmelCase ) -> str: return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
242
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _A = logging.get_logger(__name__) _A = { """SenseTime/deformable-detr""": """https://huggingface.co/sensetime/deformable-detr/r...
242
1
"""simple docstring""" from manim import * class _lowerCamelCase ( a_ ): def _lowerCAmelCase ( self : int ) -> List[Any]: """simple docstring""" lowerCAmelCase__ : Optional[Any] = Rectangle(height=0.5 , width=0.5 ) lower...
242
"""simple docstring""" def lowercase_ ( __UpperCAmelCase = 1000 ) -> int: lowerCAmelCase__ : Optional[Any] = 2**power lowerCAmelCase__ : Optional[int] = str(__UpperCAmelCase ) lowerCAmelCase__ : Optional[int] = list(__Upper...
242
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/LICENSE-2...
242
"""simple docstring""" 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 accele...
242
1
"""simple docstring""" import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPri...
242
"""simple docstring""" import math def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> int: lowerCAmelCase__ : Any = len(__UpperCAmelCase ) lowerCAmelCase__ : int = int(math.floor(math.sqrt(__UpperCAmelCase ) ) ) ...
242
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { """vinvino02/glpn-kitti""": """https://huggingface.co/vinvino02/glpn-kitti/resolve/main/config.json""", # See all GLPN models at ...
242
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig _A = logging.get_logger(__name__) class _lowerCamelCase : def __init__( sel...
242
1
"""simple docstring""" import os def lowercase_ ( __UpperCAmelCase = "input.txt" ) -> int: with open(os.path.join(os.path.dirname(__UpperCAmelCase ) , __UpperCAmelCase ) ) as input_file: lowerCAmelCase__ : List[Any] = [ ...
242
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: def count_of_possible_combinations(__UpperCAmelCase ) -> int: if target < 0: return 0 if target == 0: r...
242
1
"""simple docstring""" 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 ( Autoenco...
242
"""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/LICENSE-2...
242
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _A = { """configuration_blenderbot""": [ """BLENDERBO...
242
"""simple docstring""" from typing import Any import numpy as np def lowercase_ ( __UpperCAmelCase ) -> bool: return np.array_equal(__UpperCAmelCase , matrix.conjugate().T ) def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> Any: ...
242
1
"""simple docstring""" from __future__ import annotations import math import numpy as np from numpy.linalg import norm def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> float: return math.sqrt(sum(pow(a - b , 2 ) for a, b in zip(__UpperCAmelCase , __Up...
242
"""simple docstring""" from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _lowerCamelCase ( a_ ): def _lowerCAmelCase ( self : Any ) -> str: """simple docstring""" return [ ...
242
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor _A = logging.get_logger(__name__) class _lowerCamelCase ( a_ ): def __init__( self : int , *UpperCamelCase : int , **UpperCamelCase : ...
242
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( ...
242
1
"""simple docstring""" import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def lowercase_ ( __UpperCAmelCase , __UpperCAmelCas...
242
"""simple docstring""" 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 transf...
242
1
"""simple docstring""" import copy import tempfile import unittest from huggingface_hub import HfFolder, delete_repo from parameterized import parameterized from requests.exceptions import HTTPError from transformers import AutoConfig, GenerationConfig from transformers.testing_utils import TOKEN, USER, is_sta...
242
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { """face...
242
1
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase = 0 ) -> list: lowerCAmelCase__ : Optional[Any] = length or len(__UpperCAmelCase ) lowerCAmelCase__ : int = False for i in range(length - 1 ): ...
242
"""simple docstring""" from __future__ import annotations import bisect def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase = 0 , __UpperCAmelCase = -1 ) -> int: if hi < 0: lowerCAmelCase__ : Union[str, Any] = len(__Uppe...
242
1
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: if exponent == 1: return base if exponent % 2 == 0: lowerCAmelCase__ : Optional[Any] = _modexpt(__UpperCAmelCase , expon...
242
"""simple docstring""" import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, 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...
242
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class _lowerCamelCase ( metaclass=a_ ): _lowerCamelCase :List[str] = ["flax"] def __init__( self : Optional[Any] , *UpperCamelCase : Optional[Any] , **UpperCamelCase : List[Any] ) -> ...
242
"""simple docstring""" from __future__ import annotations def lowercase_ ( __UpperCAmelCase ) -> int: if not nums: return 0 lowerCAmelCase__ : List[Any] = nums[0] lowerCAmelCase__ : List[str] = 0 for num in nums[1:]: ...
242
1
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _A = logging.get_logger(__name__) _A = """▁"...
242
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowercase_ ( ) -> Optional[int]: lowerCAmelCase__ : Dict = { """repo_name""": ["""test_repo1""...
242
1
"""simple docstring""" from __future__ import annotations from collections import deque class _lowerCamelCase : def __init__( self : Optional[Any] , UpperCamelCase : list[str] ) -> Optional[Any]: """simple docstring""" lowerCAmelCase__ : list[dict] = ...
242
"""simple docstring""" import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoT...
242
1
"""simple docstring""" import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import versio...
242
"""simple docstring""" from itertools import product def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> list[int]: lowerCAmelCase__ : Union[str, Any] = sides_number lowerCAmelCase__ : Optional[int] = max_face_number * dice_number ...
242
1
"""simple docstring""" import csv import tweepy # Twitter API credentials _A = """""" _A = """""" _A = """""" _A = """""" def lowercase_ ( __UpperCAmelCase ) -> None: # authorize twitter, initialize tweepy lowerCAme...
242
"""simple docstring""" from string import ascii_uppercase _A = {str(ord(c) - 5_5): c for c in ascii_uppercase} def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> str: if isinstance(__UpperCAmelCase , __UpperCAmelCase ): raise TypeEr...
242
1
"""simple docstring""" import argparse import logging import os from pathlib import Path from typing import Any, Dict import pytorch_lightning as pl from pytorch_lightning.utilities import rank_zero_info from transformers import ( AdamW, AutoConfig, AutoModel, AutoModelForPreTraining, AutoM...
242
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase = 0 ) -> list: lowerCAmelCase__ : Optional[Any] = length or len(__UpperCAmelCase ) lowerCAmelCase__ : int = False for i in range(length - 1 ): ...
242
1
"""simple docstring""" import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore _A = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" _A = [file for file in filepaths i...
242
"""simple docstring""" import numpy as np from sklearn.datasets import fetch_california_housing from sklearn.metrics import mean_absolute_error, mean_squared_error from sklearn.model_selection import train_test_split from xgboost import XGBRegressor def lowercase_ ( __UpperCAmelCase ) ->...
242
1
"""simple docstring""" import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever _A = logging.getLogger(__name__) class _lowerCamelCase ( a_ ): def __init__(...
242
"""simple docstring""" 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, ) fro...
242
1
"""simple docstring""" from __future__ import annotations _A = [-1_0, -5, 0, 5, 5.1, 1_1, 1_3, 2_1, 3, 4, -2_1, -1_0, -5, -1, 0] _A = [-5, 0, 5, 5.1, 1_1, 1_3, 2_1, -1, 4, -1, -1_0, -5, -1, 0, -1] def lowercase_ ( __UpperCAmelCase ) -> list[float]: l...
242
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _A = logging.get_logger(__name__) _A = { """SenseTime/deformable-detr""": """https://huggingface.co/sensetime/deformable-detr/r...
242
1
"""simple docstring""" from typing import Any def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , ) -> list: _validation( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __U...
242
"""simple docstring""" def lowercase_ ( __UpperCAmelCase = 1000 ) -> int: lowerCAmelCase__ : Optional[Any] = 2**power lowerCAmelCase__ : Optional[int] = str(__UpperCAmelCase ) lowerCAmelCase__ : Optional[int] = list(__Upper...
242
1
"""simple docstring""" import shutil import tempfile import unittest import numpy as np import pytest from transformers import is_speech_available, is_vision_available from transformers.testing_utils import require_torch if is_vision_available(): from transformers import TvltImageProcessor if is_speech_av...
242
"""simple docstring""" 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 accele...
242
1
"""simple docstring""" import unittest from transformers import PegasusConfig, PegasusTokenizer, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor if is_fl...
242
"""simple docstring""" import math def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> int: lowerCAmelCase__ : Any = len(__UpperCAmelCase ) lowerCAmelCase__ : int = int(math.floor(math.sqrt(__UpperCAmelCase ) ) ) ...
242
1
"""simple docstring""" from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import tor...
242
"""simple docstring""" import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig _A = logging.get_logger(__name__) class _lowerCamelCase : def __init__( sel...
242
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) _A = {"""configuration_beit""": ["""BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BeitConfig""...
242
"""simple docstring""" def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: def count_of_possible_combinations(__UpperCAmelCase ) -> int: if target < 0: return 0 if target == 0: r...
242
1
"""simple docstring""" import math from datetime import datetime, timedelta def lowercase_ ( __UpperCAmelCase ) -> datetime: lowerCAmelCase__ : List[Any] = year % 19 lowerCAmelCase__ : List[Any] = year % 4 lowerCAmelCase__ : Optional[int...
242
"""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/LICENSE-2...
242
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from diffusers import ( DDIMScheduler, KandinskyVaaControlnetPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_numpy...
242
"""simple docstring""" from typing import Any import numpy as np def lowercase_ ( __UpperCAmelCase ) -> bool: return np.array_equal(__UpperCAmelCase , matrix.conjugate().T ) def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase ) -> Any: ...
242
1
"""simple docstring""" import os import re import shutil import sys import tempfile import unittest import black _A = 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: E402 # This...
242
"""simple docstring""" from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _lowerCamelCase ( a_ ): def _lowerCAmelCase ( self : Any ) -> str: """simple docstring""" return [ ...
242
1
"""simple docstring""" import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class _lowerCamelCase ( datasets.BeamBasedBuilder ): def _lowerCAmelC...
242
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( ...
242
1
"""simple docstring""" import gc import unittest from transformers import MODEL_FOR_MASKED_LM_MAPPING, TF_MODEL_FOR_MASKED_LM_MAPPING, FillMaskPipeline, pipeline from transformers.pipelines import PipelineException from transformers.testing_utils import ( is_pipeline_test, is_torch_available, nested...
242
"""simple docstring""" 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 transf...
242
1
"""simple docstring""" import argparse import logging import os import sys import numpy as np import onnxruntime import torch from bart_onnx.generation_onnx import BARTBeamSearchGenerator from bart_onnx.reduce_onnx_size import remove_dup_initializers import transformers from transformers import BartForConditio...
242
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _A = logging.get_logger(__name__) _A = { """face...
242
1
"""simple docstring""" import argparse from torch import nn # transformers_old should correspond to branch `save_old_prophetnet_model_structure` here # original prophetnet_checkpoints are saved under `patrickvonplaten/..._old` respectively from transformers_old.modeling_prophetnet import ( ProphetNetForCon...
242
"""simple docstring""" from __future__ import annotations import bisect def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase = 0 , __UpperCAmelCase = -1 ) -> int: if hi < 0: lowerCAmelCase__ : Union[str, Any] = len(__Uppe...
242
1
"""simple docstring""" import inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_v...
242
"""simple docstring""" import unittest import numpy as np from transformers import RobertaPreLayerNormConfig, 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...
242
1
"""simple docstring""" from __future__ import annotations import math def lowercase_ ( __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase , __UpperCAmelCase ) -> int: if depth < 0: raise ValueError("""Depth cannot be less than...
242
"""simple docstring""" from __future__ import annotations def lowercase_ ( __UpperCAmelCase ) -> int: if not nums: return 0 lowerCAmelCase__ : List[Any] = nums[0] lowerCAmelCase__ : List[str] = 0 for num in nums[1:]: ...
242
1
"""simple docstring""" class _lowerCamelCase : def __init__( self : List[Any] , UpperCamelCase : Tuple ) -> int: """simple docstring""" # we need a list not a string, so do something to change the type lowerCAmelCase__ : str = arr.split(""",...
242
"""simple docstring""" from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowercase_ ( ) -> Optional[int]: lowerCAmelCase__ : Dict = { """repo_name""": ["""test_repo1""...
242
1