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
from __future__ import annotations import unittest from transformers import RoFormerConfig, 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 ...
10
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A = { "configuration_distilbert": [ "DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"...
10
1
import requests from bsa import BeautifulSoup def lowerCAmelCase_ ( __a = "AAPL" ) -> str: """simple docstring""" lowerCamelCase__: int =F"""https://in.finance.yahoo.com/quote/{symbol}?s={symbol}""" lowerCamelCase__: List[str] =BeautifulSoup(requests.get(_...
10
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=__SCREAMING_SNAKE_CASE ) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring'...
10
1
import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_common import Fla...
10
import logging from transformers.configuration_utils import PretrainedConfig __A = logging.getLogger(__name__) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = "masked_bert" def __init__(self : Dict , UpperCAmelCase_ ...
10
1
import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet import VOCAB_FILES_NAMES, P...
10
class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Optional[Any] , UpperCAmelCase_ : int) ->Optional[int]: '''simple docstring''' lowerCamelCase__: Any =n lowerCamelCase__: Tuple =[None] * self.n lowerCamelCase__: ...
10
1
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = (DDPMParallelScheduler,) def SCREAMING_SNAKE_CASE_ (self : Any ,...
10
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.set_verbosity_info() __A ...
10
1
import collections import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = "▁" __A = {"vocab_file": "prophetnet.tokeni...
10
from math import ceil, sqrt def lowerCAmelCase_ ( __a = 1000000 ) -> int: """simple docstring""" lowerCamelCase__: Optional[int] =0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: lowerCamelCase__: Dict =max(ceil(...
10
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "abeja/gpt-neox-japanese-2.7b": "https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/main/config.json", } class _SCREAMING_SNAKE_CASE ( __SCRE...
10
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 ..utils import assert_arrow_...
10
1
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils im...
10
import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py __A = "." if __name__ == "__main__": __A = os.path.join(REPO_PATH, "utils/documentation_tests.txt") __A = [] ...
10
1
import fire from utils import calculate_rouge, save_json def lowerCAmelCase_ ( __a , __a , __a=None , **__a ) -> Optional[Any]: """simple docstring""" lowerCamelCase__: Any =[x.strip() for x in open(__a ).readlines()] lowerCamelCase__: Dict =[x....
10
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_...
10
1
import argparse from pathlib import Path import fairseq import torch from fairseq.models.xmod import XMODModel as FairseqXmodModel from packaging import version from transformers import XmodConfig, XmodForMaskedLM, XmodForSequenceClassification from transformers.utils import logging if version.parse(fairseq._...
10
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = (DDPMParallelScheduler,) def SCREAMING_SNAKE_CASE_ (self : Any ,...
10
1
import numpy as np def lowerCAmelCase_ ( __a ) -> np.array: """simple docstring""" return 1 / (1 + np.exp(-vector )) def lowerCAmelCase_ ( __a ) -> np.array: """simple docstring""" return vector * sigmoid(1.7_0_2 * vector ) if __name_...
10
from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def lowerCAmelCase_ ( ) -> Optional[int]: """simple docstring""" lowerCamelCase__ , lowerCamelCase__: int =9, 14 # noqa: F841 lowerCamelCase__: Lis...
10
1
import copy import os import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np import pyarrow as pa import pyarrow.parquet as pq import pytest from datasets.arrow_writer import ArrowWriter, OptimizedTypedSequence, ParquetWriter, TypedSequence from datasets.features import...
10
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin __A = get_tests_dir("fixtures/test_sentencepiece_bpe.model") ...
10
1
from __future__ import annotations def lowerCAmelCase_ ( __a , __a , __a , __a , __a , ) -> None: """simple docstring""" lowerCamelCase__: List[Any] =len(__a ) # If row is equal to the size of the board it means there are a queen in each row in # ...
10
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, logging, ) logging.s...
10
1
from ..utils import DummyObject, requires_backends class _SCREAMING_SNAKE_CASE ( metaclass=__SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = ["sentencepiece"] def __init__(self : List[str] , *UpperCAmelCase_ : Union[str, Any] , **UpperCAmelCase_ : ...
10
from typing import Any def lowerCAmelCase_ ( __a , __a , __a , __a , __a , ) -> list: """simple docstring""" _validation( __a , __a , __a , __a , __a , ) # Creates data structures and fill initial step lowerCamelCase__: dict ={}...
10
1
from __future__ import annotations def lowerCAmelCase_ ( __a , __a , __a , ) -> tuple: """simple docstring""" if (electron_conc, hole_conc, intrinsic_conc).count(0 ) != 1: raise ValueError("You cannot supply more or less than 2 values" ) elif electron_conc < 0...
10
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "microsoft/unispeech-large-1500h-cv": ( "https://huggingface.co/microsoft/unispeech-large-1500h-cv/resolve/main/config....
10
1
from __future__ import annotations def lowerCAmelCase_ ( __a ) -> bool: """simple docstring""" return len(set(__a ) ) == len(__a ) if __name__ == "__main__": import doctest doctest.testmod()
10
from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def lowerCAmelCase_ ( __a , __a , __a = 10**-10 ) -> float: """simple docstring""" lowerCamelCase__: str =a while True: lowerCamelCase...
10
1
from __future__ import annotations from typing import TypedDict class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = 42 lowercase_ = 42 def lowerCAmelCase_ ( __a ) -> list[str]: """simple docstring""" if no...
10
import itertools import math def lowerCAmelCase_ ( __a ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not pr...
10
1
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaImgPipeline, UNeta...
10
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, prepare_image_inputs if is_torch_available(): import ...
10
1
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=__SCREAMING_SNAKE_CASE ) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = fiel...
10
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ....tokenization_utils_fast import PreTrainedTokenizerFast from ....utils import logging from .tokenization_retribert import RetriBertTokenizer __A = logging.get_logger(__name__) __A = {"vocab_f...
10
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __A = { "configuration_graphormer": ["GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "GraphormerConfig"], } try: if not is_torch_available(): ...
10
import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_common import Fla...
10
1
import doctest from collections import deque import numpy as np class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Any) ->None: '''simple docstring''' lowerCamelCase__: Tuple =[2, 1, 2, -1] lowerCamelCase__: List[Any] =[1, 2, ...
10
import collections import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = "▁" __A = {"vocab_file": "prophetnet.tokeni...
10
1
from math import ceil, sqrt def lowerCAmelCase_ ( __a = 1000000 ) -> int: """simple docstring""" lowerCamelCase__: Optional[int] =0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: lowerCamelCase__: Dict =max(ceil(...
10
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A = {"configuration_ibert": ["IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "IBertConfig", "IBertOnnxConfig"]} try: if not is_torch_available(): raise OptionalDependencyNot...
10
1
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, OptionalDependencyNotAvailable, is_flax_available, is_k_diffusion_available, is_k_diffusion_version, is_onnx_available, is...
10
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A = { "configuration_distilbert": [ "DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"...
10
1
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 ..utils import assert_arrow_...
10
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=__SCREAMING_SNAKE_CASE ) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring'...
10
1
import os import unicodedata 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 SPIECE_UNDERLINE, logging __A = logging.get_logger(__name__) __A =...
10
import logging from transformers.configuration_utils import PretrainedConfig __A = logging.getLogger(__name__) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = "masked_bert" def __init__(self : Dict , UpperCAmelCase_ ...
10
1
# Copyright 2023 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 app...
10
class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Optional[Any] , UpperCAmelCase_ : int) ->Optional[int]: '''simple docstring''' lowerCamelCase__: Any =n lowerCamelCase__: Tuple =[None] * self.n lowerCamelCase__: ...
10
1
from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class _SCREAMIN...
10
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.set_verbosity_info() __A ...
10
1
def lowerCAmelCase_ ( __a , __a ) -> int: """simple docstring""" return int((input_a, input_a).count(0 ) == 0 ) def lowerCAmelCase_ ( ) -> None: """simple docstring""" assert and_gate(0 , 0 ) == 0 assert and_gate(0 , 1 ) == 0 a...
10
from math import ceil, sqrt def lowerCAmelCase_ ( __a = 1000000 ) -> int: """simple docstring""" lowerCamelCase__: Optional[int] =0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: lowerCamelCase__: Dict =max(ceil(...
10
1
def lowerCAmelCase_ ( __a = 50 ) -> int: """simple docstring""" lowerCamelCase__: List[str] =[1] * (length + 1) for row_length in range(3 , length + 1 ): for block_length in range(3 , row_length + 1 ): for block_start in range(row_length - block_lengt...
10
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 ..utils import assert_arrow_...
10
1
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging __A ...
10
import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py __A = "." if __name__ == "__main__": __A = os.path.join(REPO_PATH, "utils/documentation_tests.txt") __A = [] ...
10
1
def lowerCAmelCase_ ( __a , __a , __a ) -> bool: """simple docstring""" return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(__a ) ) def lowerCAmelCase_ ( __a , __a , __a , __a ) -> bool: ...
10
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_...
10
1
import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS_CACHE, WEIGHTS_NAME, cached_file, get_...
10
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = (DDPMParallelScheduler,) def SCREAMING_SNAKE_CASE_ (self : Any ,...
10
1
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def lowerCAmelCase_ ( ) -> tuple[list[int], int]: """simple docstring""" lowerCamelCase__: List[Any] =[randint(-1000 , 1000 ) for i in range...
10
from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def lowerCAmelCase_ ( ) -> Optional[int]: """simple docstring""" lowerCamelCase__ , lowerCamelCase__: int =9, 14 # noqa: F841 lowerCamelCase__: Lis...
10
1
import unittest from transformers import SPIECE_UNDERLINE, XLNetTokenizer, XLNetTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin __A = get_tests_dir("fixtures/test_sentenc...
10
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin __A = get_tests_dir("fixtures/test_sentencepiece_bpe.model") ...
10
1
from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("repo_id" , ["canonical_dataset_name", "org-name/dataset-name"] ) @pytest.mark.parametrize("path" , ["filename.csv", "filename with blanks.csv"] ) @pytest.mark.parametrize("revision" , ...
10
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, logging, ) logging.s...
10
1
from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "google/canine-s": "https://huggingface.co/google/canine-s/resolve/main/config.json", # See all CANINE models at https://huggingface.co/models?filter=canine ...
10
from typing import Any def lowerCAmelCase_ ( __a , __a , __a , __a , __a , ) -> list: """simple docstring""" _validation( __a , __a , __a , __a , __a , ) # Creates data structures and fill initial step lowerCamelCase__: dict ={}...
10
1
def lowerCAmelCase_ ( __a = 10**12 ) -> int: """simple docstring""" lowerCamelCase__: str =1 lowerCamelCase__: List[str] =0 lowerCamelCase__: Optional[int] =1 lowerCamelCase__: List[Any] =1 while numerator <= 2 * min_total - 1: pre...
10
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "microsoft/unispeech-large-1500h-cv": ( "https://huggingface.co/microsoft/unispeech-large-1500h-cv/resolve/main/config....
10
1
from math import sqrt def lowerCAmelCase_ ( __a = 1000000 ) -> int: """simple docstring""" lowerCamelCase__: int =0 lowerCamelCase__: int =0 lowerCamelCase__: int while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_sides in ...
10
from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def lowerCAmelCase_ ( __a , __a , __a = 10**-10 ) -> float: """simple docstring""" lowerCamelCase__: str =a while True: lowerCamelCase...
10
1
import argparse import re import numpy as np import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SamConfig, SamImageProcessor, SamModel, SamProcessor, SamVisionConfig, ) __A = { "iou_prediction_head.layers...
10
import itertools import math def lowerCAmelCase_ ( __a ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not pr...
10
1
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = "▁" __A = {"vocab_file": "sentenc...
10
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, prepare_image_inputs if is_torch_available(): import ...
10
1
from abc import ABC, abstractmethod from argparse import ArgumentParser class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' @staticmethod @abstractmethod def SCREAMING_SNAKE_CASE_ (UpperCAmelCase_ : ArgumentParser) ->int: '''simple d...
10
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ....tokenization_utils_fast import PreTrainedTokenizerFast from ....utils import logging from .tokenization_retribert import RetriBertTokenizer __A = logging.get_logger(__name__) __A = {"vocab_f...
10
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __A = { "configuration_groupvit": [ "GROUPVIT_PRETRAINED_CONFIG_ARCHIVE_MAP", "GroupViTConfig", "GroupViTOnnxConfig", "GroupViTTe...
10
import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_common import Fla...
10
1
import itertools import math def lowerCAmelCase_ ( __a ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not pr...
10
import collections import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = "▁" __A = {"vocab_file": "prophetnet.tokeni...
10
1
from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def lowerCAmelCase_ ( __a , __a , __a = 10**-10 ) -> float: """simple docstring""" lowerCamelCase__: str =a while True: lowerCamelCase...
10
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A = {"configuration_ibert": ["IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "IBertConfig", "IBertOnnxConfig"]} try: if not is_torch_available(): raise OptionalDependencyNot...
10
1
import os import re import shutil from argparse import ArgumentParser, Namespace from datasets.commands import BaseDatasetsCLICommand from datasets.utils.logging import get_logger __A = "<<<<<<< This should probably be modified because it mentions: " __A = "=======\n>>>>>>>\n" __A ...
10
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A = { "configuration_distilbert": [ "DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"...
10
1
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() __A = logging.get_logger(__name__) __A = { "post_extract_proj": "feature_projection.projection", "encoder...
10
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=__SCREAMING_SNAKE_CASE ) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring'...
10
1
class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Optional[Any] , UpperCAmelCase_ : int) ->Optional[int]: '''simple docstring''' lowerCamelCase__: Any =n lowerCamelCase__: Tuple =[None] * self.n lowerCamelCase__: ...
10
import logging from transformers.configuration_utils import PretrainedConfig __A = logging.getLogger(__name__) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = "masked_bert" def __init__(self : Dict , UpperCAmelCase_ ...
10
1
import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration __A = [ # tf -> hf ("/", "."), ("layer_", "layers."), ("kernel", "weight"), ("beta", "bias"), ...
10
class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Optional[Any] , UpperCAmelCase_ : int) ->Optional[int]: '''simple docstring''' lowerCamelCase__: Any =n lowerCamelCase__: Tuple =[None] * self.n lowerCamelCase__: ...
10
1
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 torch if is_tf_availabl...
10
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.set_verbosity_info() __A ...
10
1
def lowerCAmelCase_ ( __a = 10**9 ) -> int: """simple docstring""" lowerCamelCase__: str =1 lowerCamelCase__: Optional[int] =2 lowerCamelCase__: List[str] =0 lowerCamelCase__: Dict =0 lowerCamelCase__: Any =0 while perimeter ...
10
from math import ceil, sqrt def lowerCAmelCase_ ( __a = 1000000 ) -> int: """simple docstring""" lowerCamelCase__: Optional[int] =0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: lowerCamelCase__: Dict =max(ceil(...
10
1
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedTokenizerBase, TensorType ...
10
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 ..utils import assert_arrow_...
10
1
from __future__ import annotations import typing from collections.abc import Iterable import numpy as np __A = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 __A = typing.Union[np.floataa, int, float] # noqa: UP007 def lowerCAmelCase_ ( __a , _...
10
import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py __A = "." if __name__ == "__main__": __A = os.path.join(REPO_PATH, "utils/documentation_tests.txt") __A = [] ...
10
1
from typing import Union import fire import torch from tqdm import tqdm def lowerCAmelCase_ ( __a , __a = "cpu" , __a = None ) -> None: """simple docstring""" lowerCamelCase__: int =torch.load(__a , map_location=__a ) for k, v in tqdm(state_dict.items() ...
10
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_...
10
1
__A = "Input must be a string of 8 numbers plus letter" __A = "TRWAGMYFPDXBNJZSQVHLCKE" def lowerCAmelCase_ ( __a ) -> bool: """simple docstring""" if not isinstance(__a , __a ): lowerCamelCase__: Union[str, Any] =F"""Expected string as ...
10
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = (DDPMParallelScheduler,) def SCREAMING_SNAKE_CASE_ (self : Any ,...
10
1
from __future__ import annotations __A = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def lowerCAmelCase_ ( __a , __a , __a , __a , __a , ) -> tuple[list[list[int]], list[list[int]]]: """simple docstring""" low...
10
from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def lowerCAmelCase_ ( ) -> Optional[int]: """simple docstring""" lowerCamelCase__ , lowerCamelCase__: int =9, 14 # noqa: F841 lowerCamelCase__: Lis...
10
1
def lowerCAmelCase_ ( __a , __a ) -> int: """simple docstring""" if len(__a ) != len(__a ): raise ValueError("String lengths must match!" ) lowerCamelCase__: Dict =0 for chara, chara in zip(__a , __a ): if chara != chara: count += 1 return...
10
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin __A = get_tests_dir("fixtures/test_sentencepiece_bpe.model") ...
10
1
from __future__ import annotations import math from collections.abc import Callable def lowerCAmelCase_ ( __a , __a , __a , __a = 100 , ) -> float: """simple docstring""" lowerCamelCase__: List[str] =x_start lowerCamelCase__: List[str] =fnc(__a...
10
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, logging, ) logging.s...
10
1
# Logistic Regression from scratch # In[62]: # In[63]: # importing all the required libraries import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def lowerCAmelCase_ ( __a ) -> Union[str, Any]: """simple docstring""" return 1 / (1 + np.exp...
10
from typing import Any def lowerCAmelCase_ ( __a , __a , __a , __a , __a , ) -> list: """simple docstring""" _validation( __a , __a , __a , __a , __a , ) # Creates data structures and fill initial step lowerCamelCase__: dict ={}...
10
1
import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin @require_toke...
10
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "microsoft/unispeech-large-1500h-cv": ( "https://huggingface.co/microsoft/unispeech-large-1500h-cv/resolve/main/config....
10
1
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "microsoft/unispeech-large-1500h-cv": ( "https://huggingface.co/microsoft/unispeech-large-1500h-cv/resolve/main/config....
10
from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def lowerCAmelCase_ ( __a , __a , __a = 10**-10 ) -> float: """simple docstring""" lowerCamelCase__: str =a while True: lowerCamelCase...
10
1
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable __A = {"configuration_dpt": ["DPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "DPTConfig"]} try: if not is_vision_ava...
10
import itertools import math def lowerCAmelCase_ ( __a ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not pr...
10
1
from typing import Any def lowerCAmelCase_ ( __a ) -> list[Any]: """simple docstring""" if not input_list: return [] lowerCamelCase__: int =[input_list.count(__a ) for value in input_list] lowerCamelCase__: int =max(__a ) # Gets the maximum count ...
10
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, prepare_image_inputs if is_torch_available(): import ...
10
1
import os import textwrap import pyarrow as pa import pytest from datasets import ClassLabel, Features, Image from datasets.packaged_modules.csv.csv import Csv from ..utils import require_pil @pytest.fixture def lowerCAmelCase_ ( __a ) -> int: """simple docstring""" lowerC...
10
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ....tokenization_utils_fast import PreTrainedTokenizerFast from ....utils import logging from .tokenization_retribert import RetriBertTokenizer __A = logging.get_logger(__name__) __A = {"vocab_f...
10
1
import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCAmelCase_ ( __a , __a , __a ) -> List[str]: """simple docstring""" ...
10
import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_common import Fla...
10
1
import math def lowerCAmelCase_ ( __a ) -> int: """simple docstring""" if not isinstance(__a , __a ): lowerCamelCase__: str =F"""Input value of [number={number}] must be an integer""" raise TypeError(__a ) if number < 1: lowerCamelCase__: Lis...
10
import collections import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = "▁" __A = {"vocab_file": "prophetnet.tokeni...
10
1
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.activations import gelu_new, gelu_python, get_activation @require_torch class _SCREAMING_SNAKE_CASE ( unittest.TestCase ...
10
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A = {"configuration_ibert": ["IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "IBertConfig", "IBertOnnxConfig"]} try: if not is_torch_available(): raise OptionalDependencyNot...
10
1
from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def lowerCAmelCase_ ( ) -> Optional[int]: """simple docstring""" lowerCamelCase__ , lowerCamelCase__: int =9, 14 # noqa: F841 lowerCamelCase__: Lis...
10
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A = { "configuration_distilbert": [ "DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"...
10
1
import os def lowerCAmelCase_ ( __a ) -> Dict: """simple docstring""" lowerCamelCase__: Union[str, Any] =len(grid[0] ) lowerCamelCase__: List[Any] =len(__a ) lowerCamelCase__: str =0 lowerCamelCase__: Tuple =0 lowerCamelCase__: ...
10
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=__SCREAMING_SNAKE_CASE ) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring'...
10
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __A = { "configuration_pix2struct": [ "PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP", "Pix2StructConfig", "Pix2StructTextConfig", ...
10
import logging from transformers.configuration_utils import PretrainedConfig __A = logging.getLogger(__name__) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = "masked_bert" def __init__(self : Dict , UpperCAmelCase_ ...
10
1
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if i...
10
class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Optional[Any] , UpperCAmelCase_ : int) ->Optional[int]: '''simple docstring''' lowerCamelCase__: Any =n lowerCamelCase__: Tuple =[None] * self.n lowerCamelCase__: ...
10
1
def lowerCAmelCase_ ( __a , __a ) -> bool: """simple docstring""" return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
10
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.set_verbosity_info() __A ...
10
1
import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils import require_keras_nlp, require_t...
10
from math import ceil, sqrt def lowerCAmelCase_ ( __a = 1000000 ) -> int: """simple docstring""" lowerCamelCase__: Optional[int] =0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: lowerCamelCase__: Dict =max(ceil(...
10
1
def lowerCAmelCase_ ( ) -> Any: """simple docstring""" lowerCamelCase__: Tuple =[] lowerCamelCase__: Tuple =1 while len(__a ) < 1e6: constant.append(str(__a ) ) i += 1 lowerCamelCase__: List[Any] ="".join(__a ) return ( int(co...
10
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 ..utils import assert_arrow_...
10
1
import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig __A = { "facebook/maskformer-swin-base-ade": ( "https://huggingface...
10
import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py __A = "." if __name__ == "__main__": __A = os.path.join(REPO_PATH, "utils/documentation_tests.txt") __A = [] ...
10
1
import argparse import os import re import tensorflow as tf import torch from transformers import BertConfig, BertModel from transformers.utils import logging logging.set_verbosity_info() __A = logging.get_logger(__name__) def lowerCAmelCase_ ( __a , __a , __a ) -> Dict:...
10
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_...
10
1
from __future__ import annotations from collections.abc import Iterator class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Dict , UpperCAmelCase_ : int) ->None: '''simple docstring''' lowerCamelCase__: int =value lowerCamelC...
10
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = (DDPMParallelScheduler,) def SCREAMING_SNAKE_CASE_ (self : Any ,...
10
1
from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = { "nielsr/canine-s": 2048, } # Unicode defines 1,114,112 total “codepoints” __A = 111_4112 # B...
10
from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def lowerCAmelCase_ ( ) -> Optional[int]: """simple docstring""" lowerCamelCase__ , lowerCamelCase__: int =9, 14 # noqa: F841 lowerCamelCase__: Lis...
10
1
def lowerCAmelCase_ ( __a , __a ) -> list: """simple docstring""" lowerCamelCase__: int =word.split() def justify(__a , __a , __a ) -> str: lowerCamelCase__: Tuple =max_width - width lowerCamelCase__: str =len(__a ) if len(__a ...
10
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin __A = get_tests_dir("fixtures/test_sentencepiece_bpe.model") ...
10
1
from PIL import Image def lowerCAmelCase_ ( __a ) -> Image: """simple docstring""" lowerCamelCase__ , lowerCamelCase__: Tuple =image.size lowerCamelCase__: Optional[Any] =0 lowerCamelCase__: List[str] =image.load() for i in range(__a ): ...
10
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, logging, ) logging.s...
10
1
import importlib.util import os import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import ( is_accelerate_available, is_flax_available, is_safetensors_available, is_tf_available, is_torch_available, ) from . import Ba...
10
from typing import Any def lowerCAmelCase_ ( __a , __a , __a , __a , __a , ) -> list: """simple docstring""" _validation( __a , __a , __a , __a , __a , ) # Creates data structures and fill initial step lowerCamelCase__: dict ={}...
10
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A = {"configuration_ibert": ["IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "IBertConfig", "IBertOnnxConfig"]} try: if not is_torch_available(): raise OptionalDependencyNot...
10
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "microsoft/unispeech-large-1500h-cv": ( "https://huggingface.co/microsoft/unispeech-large-1500h-cv/resolve/main/config....
10
1
from __future__ import annotations def lowerCAmelCase_ ( __a ) -> int: """simple docstring""" lowerCamelCase__: int =len(__a ) // 2 # choose the middle 3 elements lowerCamelCase__: int =lst[m - 1 : m + 2] # if middle element is peak if three[1] > ...
10
from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def lowerCAmelCase_ ( __a , __a , __a = 10**-10 ) -> float: """simple docstring""" lowerCamelCase__: str =a while True: lowerCamelCase...
10
1
from functools import lru_cache @lru_cache def lowerCAmelCase_ ( __a ) -> int: """simple docstring""" if num < 0: raise ValueError("Number should not be negative." ) return 1 if num in (0, 1) else num * factorial(num - 1 ) if __name__ == "__main__": import doc...
10
import itertools import math def lowerCAmelCase_ ( __a ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not pr...
10
1
import gc import random import tempfile import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMInverseScheduler, DDIMScheduler, DPMSolverMultistepInverseScheduler, ...
10
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, prepare_image_inputs if is_torch_available(): import ...
10
1
def lowerCAmelCase_ ( __a , __a ) -> tuple[float, float]: """simple docstring""" if not len(__a ) == len(__a ) == 3: raise ValueError("Please enter a valid equation." ) if equationa[0] == equationa[1] == equationa[0] == equationa[1] == 0: raise ValueError("Both a &...
10
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ....tokenization_utils_fast import PreTrainedTokenizerFast from ....utils import logging from .tokenization_retribert import RetriBertTokenizer __A = logging.get_logger(__name__) __A = {"vocab_f...
10
1
from __future__ import annotations import inspect import unittest from typing import List, Tuple from transformers import RegNetConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_config...
10
import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_common import Fla...
10
1
def lowerCAmelCase_ ( __a ) -> list[int]: """simple docstring""" lowerCamelCase__: List[str] =len(__a ) for i in range(__a ): for j in range(i + 1 , __a ): if numbers[j] < numbers[i]: lowerCamelCase__ , lowerCamelCase__: Optional[Any] ...
10
import collections import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) __A = "▁" __A = {"vocab_file": "prophetnet.tokeni...
10
1
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel from diffusers.utils import ...
10
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A = {"configuration_ibert": ["IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "IBertConfig", "IBertOnnxConfig"]} try: if not is_torch_available(): raise OptionalDependencyNot...
10
1
import warnings from ...utils import logging from .image_processing_perceiver import PerceiverImageProcessor __A = logging.get_logger(__name__) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__(self : List[str] , *UpperCAme...
10
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) __A = { "configuration_distilbert": [ "DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP"...
10
1
import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset __A = {1: (1, 1), 2: (2, 1), 3: (3, 1), 4: (2, 2), 5: (5, 1), 6: (3, 2), 7: (7, 1), 8: (4,...
10
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=__SCREAMING_SNAKE_CASE ) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring'...
10
1
from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .embeddings import GaussianFourierProjection, TimestepEmbedding, Timesteps from .modeling_utils imp...
10
import logging from transformers.configuration_utils import PretrainedConfig __A = logging.getLogger(__name__) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = "masked_bert" def __init__(self : Dict , UpperCAmelCase_ ...
10
1
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 = { "facebook/data2vec-vision-base-ft":...
10
class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Optional[Any] , UpperCAmelCase_ : int) ->Optional[int]: '''simple docstring''' lowerCamelCase__: Any =n lowerCamelCase__: Tuple =[None] * self.n lowerCamelCase__: ...
10
1
import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, slow, ) from...
10
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import YolosConfig, YolosForObjectDetection, YolosImageProcessor from transformers.utils import logging logging.set_verbosity_info() __A ...
10
1
from __future__ import annotations def lowerCAmelCase_ ( __a , __a , __a ) -> tuple[float, list[float]]: """simple docstring""" lowerCamelCase__: Any =list(range(len(__a ) ) ) lowerCamelCase__: Optional[Any] =[v / w for v, w in zip(__a , __a )...
10
from math import ceil, sqrt def lowerCAmelCase_ ( __a = 1000000 ) -> int: """simple docstring""" lowerCamelCase__: Optional[int] =0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: lowerCamelCase__: Dict =max(ceil(...
10
1
import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from ...test_modeling...
10
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 ..utils import assert_arrow_...
10
1
import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' def __init__(self : Any , UpperCAmelCase_ : Dict , UpperCAmelC...
10
import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py __A = "." if __name__ == "__main__": __A = os.path.join(REPO_PATH, "utils/documentation_tests.txt") __A = [] ...
10
1
from __future__ import annotations def lowerCAmelCase_ ( __a , __a , __a , __a ) -> list: """simple docstring""" lowerCamelCase__: Any =[] lowerCamelCase__ , lowerCamelCase__: Any =input_list[low:mid], input_list[mid : high + 1] while left ...
10
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_...
10
1
import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def lowerCAmelCase_ ( __a , __a , __a , __a , __a , __a ) -> np.ndarray: """simple docstring""" if (ksize % 2) == 0: lowerCamelCase__: Optional[int]...
10
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring''' lowercase_ = (DDPMParallelScheduler,) def SCREAMING_SNAKE_CASE_ (self : Any ,...
10
1
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Image from .base import TaskTemplate @dataclass(frozen=__SCREAMING_SNAKE_CASE ) class _SCREAMING_SNAKE_CASE ( __SCREAMING_SNAKE_CASE ): '''simple docstring'...
10
from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def lowerCAmelCase_ ( ) -> Optional[int]: """simple docstring""" lowerCamelCase__ , lowerCamelCase__: int =9, 14 # noqa: F841 lowerCamelCase__: Lis...
10
1
import datasets __A = "\\n@InProceedings{conneau2018xnli,\n author = \"Conneau, Alexis\n and Rinott, Ruty\n and Lample, Guillaume\n and Williams, Adina\n and Bowman, Samuel R.\n and Schwenk, Holger\n and ...
10
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin __A = get_tests_dir("fixtures/test_sentencepiece_bpe.model") ...
10
1