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
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 BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_utils import...
327
from typing import Dict from .base import GenericTensor, Pipeline class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def UpperCAmelCase_ ( self : str , _A : Optional[Any]=None , _A : List[str]=None , _A : Optional[Any]...
327
1
import multiprocessing import os from typing import BinaryIO, Optional, Union import fsspec from .. import Dataset, Features, NamedSplit, config from ..formatting import query_table from ..packaged_modules.json.json import Json from ..utils import logging from ..utils.typing import NestedDataStr...
327
from itertools import permutations def SCREAMING_SNAKE_CASE__ ( __a ): if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if num[5] % 5 != 0: return False snake_case_ : Any = [7, 11, 13, 17] for i, test in enumerate(_...
327
1
import argparse import copy def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : int = {} with open(__a ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: snake_case_ : Optional[int] = [] _list.append([line.split()[1], lin...
327
from __future__ import annotations from collections import namedtuple def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Any = namedtuple('result' , 'name value' ) if (voltage, current, power).count(0 ) != 1: rais...
327
1
from math import isqrt def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : Any = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , __a , __a ): snake_case_ ...
327
import re import string import numpy as np import datasets _SCREAMING_SNAKE_CASE = """ Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. """ _SCREAMING_SNAKE_CASE = """ ...
327
1
import numpy as np import torch from torch.utils.data import Dataset from utils import logger class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Union[str, Any] , _A : Any , _A : Dict ) -> Union[str, Any]...
327
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, ...
327
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_canine""": ["""CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CanineConfig"""], """tokenization_...
327
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : list[list[int]] = [] snake_case_ : list[int] = [] snake_case_ : List[Any] = 0 snake_case_ : Union[str, Any] = sum(__a ) create_...
327
1
import logging import os from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union from filelock import FileLock from transformers import PreTrainedTokenizer, is_tf_available, is_torch_available _SCREAMING_SNAKE_CASE = logging.getLogger(__name...
327
def SCREAMING_SNAKE_CASE__ ( __a , __a ): if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) return (bulk_modulus / density) ** 0.5 if __name__ == "__main__": import...
327
1
import argparse import math import os from copy import deepcopy import torch from audio_diffusion.models import DiffusionAttnUnetaD from diffusion import sampling from torch import nn from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel _SCREAMING_SNAKE_CASE = ...
327
from math import pi def SCREAMING_SNAKE_CASE__ ( __a , __a ): return 2 * pi * radius * (angle / 3_60) if __name__ == "__main__": print(arc_length(90, 10))
327
1
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = {"""vocab_fi...
327
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STAN...
327
1
import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def SCREAMING_SNAKE_CASE__ ( ): with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT ):...
327
import sys _SCREAMING_SNAKE_CASE = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """6...
327
1
from __future__ import annotations from math import pi def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): if (inductance, frequency, reactance).count(0 ) != 1: raise ValueError('One and only one argument must be 0' ) if inductance < 0: raise Va...
327
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqL...
327
1
def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : Union[str, Any] = current_set.copy() for row_index, row in enumerate(__a ): snake_case_ : Optional[Any] = row[0] for column_index, column in enumerate(__a ): if magnitude == 0: snake_case_ ...
327
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _SCREAMING_SNAKE_CASE = { """configuration_poolformer""": [ """POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PoolFormerConfig...
327
1
import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE__ ...
327
import tempfile import unittest from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from transformers.testing_utils import ( is_torch_available, require_optimum, require_torch, slow, ) if is_torch_available(): import torch @require_torch @require_optimum @s...
327
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_imag...
327
import numpy as np import torch from torch.utils.data import Dataset from utils import logger class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Union[str, Any] , _A : Any , _A : Dict ) -> Union[str, Any]...
327
1
import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import load_...
327
def SCREAMING_SNAKE_CASE__ ( __a , __a ): while b: snake_case_ ,snake_case_ : Any = b, a % b return a def SCREAMING_SNAKE_CASE__ ( __a , __a ): return a if b == 0 else euclidean_gcd_recursive(__a , a % b ) def...
327
1
import asyncio import os import re import sys import tempfile import unittest from contextlib import contextmanager from copy import deepcopy from distutils.util import strtobool from enum import Enum from importlib.util import find_spec from pathlib import Path from unittest.mock import patch ...
327
import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version(""">=""", FSDP_PYTORCH_VERSION): import torch.distributed.checkpoint as dist_cp from torch.dis...
327
1
import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def SCREAMING_SNAKE_CASE__ ( __a , __a , __a , ...
327
import unittest from typing import Dict, List, Optional, Union 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,...
327
1
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( BertTokenizer, ViltConfig, ViltForImageAndTextRetrieval, ViltForImagesAndTextClassification, Vilt...
327
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration _SCREAMING_SNAKE_CASE = 50_00_00 _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = os.path.split(__file__) _SCREAMING_SNAKE_CASE ...
327
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available _SCREAMING_SNAKE_CASE = {"""tokenization_herbert""": ["""HerbertTokenizer"""]} try: if not is_tokenizers_available(): raise OptionalDependencyN...
327
from collections import namedtuple import requests from lxml import html # type: ignore _SCREAMING_SNAKE_CASE = namedtuple("""covid_data""", """cases deaths recovered""") def SCREAMING_SNAKE_CASE__ ( __a = "https://www.worldometers.info/coronavirus/" ): snake_case_ ...
327
1
import argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : Union[str, Any] = [ 'encoder.version', 'decoder.version', 'model.encod...
327
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer _SCREAMING_SNAKE_CASE = {"""vocab_file""": """vocab.txt""", """tokenizer_file""": ""...
327
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_gpt_neo""": ["""GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTNeoConfig""", """GPTNeoOnnxConfig"""], ...
327
def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): snake_case_ : int = f"""Input value of [number={number}] must be an integer""" raise TypeError(__a ) if number < 0: return False snake_case_ : Dict = number * number ...
327
1
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging _SCREAMING...
327
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_autoformer""": [ """AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", ""...
327
1
import sys _SCREAMING_SNAKE_CASE = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """6...
327
from typing import Dict from .base import GenericTensor, Pipeline class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def UpperCAmelCase_ ( self : str , _A : Optional[Any]=None , _A : List[str]=None , _A : Optional[Any]...
327
1
from __future__ import annotations from math import pi, sqrt def SCREAMING_SNAKE_CASE__ ( __a , __a ): if inductance <= 0: raise ValueError('Inductance cannot be 0 or negative' ) elif capacitance <= 0: raise ValueError('Capacitance cannot be 0 or negative...
327
from itertools import permutations def SCREAMING_SNAKE_CASE__ ( __a ): if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if num[5] % 5 != 0: return False snake_case_ : Any = [7, 11, 13, 17] for i, test in enumerate(_...
327
1
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable _SCREAMING_SNAKE_CASE = { """configuration_gpt_neox_japanese""": ["""GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTNeoXJapaneseC...
327
from __future__ import annotations from collections import namedtuple def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Any = namedtuple('result' , 'name value' ) if (voltage, current, power).count(0 ) != 1: rais...
327
1
def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): if len(__a ) != len(__a ): raise ValueError('The length of profit and weight must be same.' ) if max_weight <= 0: raise ValueError('max_weight must greater than zero.' ) if any(p < 0 for p in...
327
import re import string import numpy as np import datasets _SCREAMING_SNAKE_CASE = """ Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. """ _SCREAMING_SNAKE_CASE = """ ...
327
1
from __future__ import annotations from dataclasses import dataclass @dataclass class SCREAMING_SNAKE_CASE_ : __magic_name__: float __magic_name__: TreeNode | None = None __magic_name__: TreeNode | None = None def SCREAMING_SNAKE_CASE__ ( ...
327
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, ...
327
1
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar _SCREAMING_SNAKE_CASE = TypeVar("""T""") _SCREAMING_SNAKE_CASE = TypeVar("""U""") class SCREAMING_SNAKE_CASE_ ( Generic[T, U] ): def __init__( ...
327
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : list[list[int]] = [] snake_case_ : list[int] = [] snake_case_ : List[Any] = 0 snake_case_ : Union[str, Any] = sum(__a ) create_...
327
1
import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze, transpose, )...
327
def SCREAMING_SNAKE_CASE__ ( __a , __a ): if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) return (bulk_modulus / density) ** 0.5 if __name__ == "__main__": import...
327
1
import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..table import ar...
327
from math import pi def SCREAMING_SNAKE_CASE__ ( __a , __a ): return 2 * pi * radius * (angle / 3_60) if __name__ == "__main__": print(arc_length(90, 10))
327
1
from math import sqrt def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : Optional[int] = 0 for i in range(1 , int(sqrt(__a ) + 1 ) ): if n % i == 0 and i != sqrt(__a ): total += i + n // i elif i == sqrt(__a ): total += i ...
327
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STAN...
327
1
import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _SCREAMING_SNAKE_CASE = """\ @inproceedings{snover-etal-2006-study, title = \"A Study of Translation Edit Rate with Targeted Human Annotation\", author = \"Snover, Matthew and ...
327
import sys _SCREAMING_SNAKE_CASE = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """6...
327
1
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, ...
327
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqL...
327
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 logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name_...
327
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _SCREAMING_SNAKE_CASE = { """configuration_poolformer""": [ """POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PoolFormerConfig...
327
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 ...
327
import tempfile import unittest from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from transformers.testing_utils import ( is_torch_available, require_optimum, require_torch, slow, ) if is_torch_available(): import torch @require_torch @require_optimum @s...
327
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { """microsoft/markuplm-base""": """https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json""", ...
327
import numpy as np import torch from torch.utils.data import Dataset from utils import logger class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Union[str, Any] , _A : Any , _A : Dict ) -> Union[str, Any]...
327
1
def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): snake_case_ : int = f"""Input value of [number={number}] must be an integer""" raise TypeError(__a ) if number < 0: return False snake_case_ : Dict = number * number ...
327
def SCREAMING_SNAKE_CASE__ ( __a , __a ): while b: snake_case_ ,snake_case_ : Any = b, a % b return a def SCREAMING_SNAKE_CASE__ ( __a , __a ): return a if b == 0 else euclidean_gcd_recursive(__a , a % b ) def...
327
1
from collections import namedtuple import requests from lxml import html # type: ignore _SCREAMING_SNAKE_CASE = namedtuple("""covid_data""", """cases deaths recovered""") def SCREAMING_SNAKE_CASE__ ( __a = "https://www.worldometers.info/coronavirus/" ): snake_case_ ...
327
import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version(""">=""", FSDP_PYTORCH_VERSION): import torch.distributed.checkpoint as dist_cp from torch.dis...
327
1
def SCREAMING_SNAKE_CASE__ ( __a = 1_00_00_00 ): snake_case_ : Any = 1 snake_case_ : List[str] = 1 snake_case_ : Any = {1: 1} for inputa in range(2 , __a ): snake_case_ : Tuple = 0 snake_case_ : Tuple = inp...
327
import unittest from typing import Dict, List, Optional, Union 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,...
327
1
def SCREAMING_SNAKE_CASE__ ( __a , __a = False ): if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 10 not in (1, 3, 7, 9): # can quickly check last digit return False if n > 3_31_70_44_06_46_79_88_73_85_96_19_81 and not allow_probable: ...
327
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration _SCREAMING_SNAKE_CASE = 50_00_00 _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = os.path.split(__file__) _SCREAMING_SNAKE_CASE ...
327
1
import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffusers.utils.testing_utils ...
327
from collections import namedtuple import requests from lxml import html # type: ignore _SCREAMING_SNAKE_CASE = namedtuple("""covid_data""", """cases deaths recovered""") def SCREAMING_SNAKE_CASE__ ( __a = "https://www.worldometers.info/coronavirus/" ): snake_case_ ...
327
1
# Lint as: python3 import dataclasses import re from dataclasses import dataclass from functools import total_ordering from typing import Optional, Union _SCREAMING_SNAKE_CASE = re.compile(R"""^(?P<major>\d+)""" R"""\.(?P<minor>\d+)""" R"""\.(?P<patch>\d+)$""") @total_ordering @datacl...
327
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer _SCREAMING_SNAKE_CASE = {"""vocab_file""": """vocab.txt""", """tokenizer_file""": ""...
327
1
import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debug.metrics as met class SC...
327
def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): snake_case_ : int = f"""Input value of [number={number}] must be an integer""" raise TypeError(__a ) if number < 0: return False snake_case_ : Dict = number * number ...
327
1
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import SegformerImageProcessor, SwinConfig, UperNetConfig, UperNetForSemanticSegmentation def SCREAMING_SNAKE_CASE__ ( __a ): snake_cas...
327
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_autoformer""": [ """AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", ""...
327
1
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import KarrasVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class SCREAMING_SNAKE_CASE_ ( snake_case_ ): ...
327
from typing import Dict from .base import GenericTensor, Pipeline class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def UpperCAmelCase_ ( self : str , _A : Optional[Any]=None , _A : List[str]=None , _A : Optional[Any]...
327
1
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=snake_case_ ) class SCREAMING_SNAKE_CASE_ ( snake_case_ ): # `task` is not a ClassVar since we want it to be pa...
327
from itertools import permutations def SCREAMING_SNAKE_CASE__ ( __a ): if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if num[5] % 5 != 0: return False snake_case_ : Any = [7, 11, 13, 17] for i, test in enumerate(_...
327
1
import logging import os import quant_trainer import torch from torch.utils.data import DataLoader from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput _SCREAMING_SNAKE_CASE = logging.getLogger(__name__) if is_torch_tpu...
327
from __future__ import annotations from collections import namedtuple def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Any = namedtuple('result' , 'name value' ) if (voltage, current, power).count(0 ) != 1: rais...
327
1
def SCREAMING_SNAKE_CASE__ ( __a , __a ): _validate_point(__a ) _validate_point(__a ) if len(__a ) != len(__a ): raise ValueError('Both points must be in the same n-dimensional space' ) return float(sum(abs(a - b ) for a, b in zip(__a ...
327
import re import string import numpy as np import datasets _SCREAMING_SNAKE_CASE = """ Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. """ _SCREAMING_SNAKE_CASE = """ ...
327
1
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( __a , __a ): print(f"""Vertex\tShortest Distance from vertex {src}""" ) for i, d in enumerate(__a ): print(f"""{i}\t\t{d}""" ) def SCREAMING_SNAKE_CASE__ ( __a , __a...
327
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, ...
327
1
from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class SCREAMING_SNAKE_CASE_ ( snake_case_ ): ...
327
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : list[list[int]] = [] snake_case_ : list[int] = [] snake_case_ : List[Any] = 0 snake_case_ : Union[str, Any] = sum(__a ) create_...
327
1
from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { """snap-research/efficientformer-l1-300""": ( """https://huggingface.co/snap...
327
def SCREAMING_SNAKE_CASE__ ( __a , __a ): if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) return (bulk_modulus / density) ** 0.5 if __name__ == "__main__": import...
327
1
import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Any = AutoConfig.from_pretrained(__a ) snake_case_ : Dict = ...
327
from math import pi def SCREAMING_SNAKE_CASE__ ( __a , __a ): return 2 * pi * radius * (angle / 3_60) if __name__ == "__main__": print(arc_length(90, 10))
327
1
import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require_torchau...
327
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STAN...
327
1
import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils import i...
327
import sys _SCREAMING_SNAKE_CASE = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """6...
327
1
from __future__ import annotations class SCREAMING_SNAKE_CASE_ : def __init__( self : int , _A : int ) -> None: """simple docstring""" snake_case_ : Optional[int] = data snake_case_ : Node |...
327
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqL...
327
1
import inspect import unittest from transformers import ViTMSNConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester...
327
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _SCREAMING_SNAKE_CASE = { """configuration_poolformer""": [ """POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PoolFormerConfig...
327
1
from ..utils import DummyObject, requires_backends class SCREAMING_SNAKE_CASE_ ( metaclass=snake_case_ ): __magic_name__: Optional[Any] = ["note_seq"] def __init__( self : Optional[Any] , *_A : List[Any] , **_A : ...
327
import tempfile import unittest from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from transformers.testing_utils import ( is_torch_available, require_optimum, require_torch, slow, ) if is_torch_available(): import torch @require_torch @require_optimum @s...
327
1
def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): raise TypeError('only integers accepted as input' ) else: snake_case_ : Any = str(abs(__a ) ) snake_case_ : List[Any] = [list(__a ) for char in range(len...
327
import numpy as np import torch from torch.utils.data import Dataset from utils import logger class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Union[str, Any] , _A : Any , _A : Dict ) -> Union[str, Any]...
327
1
import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version(""">=""", FSDP_PYTORCH_VERSION): import torch.distributed.checkpoint as dist_cp from torch.dis...
327
def SCREAMING_SNAKE_CASE__ ( __a , __a ): while b: snake_case_ ,snake_case_ : Any = b, a % b return a def SCREAMING_SNAKE_CASE__ ( __a , __a ): return a if b == 0 else euclidean_gcd_recursive(__a , a % b ) def...
327
1
import math def SCREAMING_SNAKE_CASE__ ( __a , __a ): if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * math.logaa(__a ) else: if x == 0: # 0 raised to any number is 0 return 0 elif y == 0: return 1 # an...
327
import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version(""">=""", FSDP_PYTORCH_VERSION): import torch.distributed.checkpoint as dist_cp from torch.dis...
327
1
from math import pi def SCREAMING_SNAKE_CASE__ ( __a , __a ): return 2 * pi * radius * (angle / 3_60) if __name__ == "__main__": print(arc_length(90, 10))
327
import unittest from typing import Dict, List, Optional, Union 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,...
327
1
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( __a , __a = None , __a = None ): if start is None: snake_case_ : List[str] = 0 if end is None: snake_case_ : str = len(__a ) - 1 if start >= end: return ...
327
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration _SCREAMING_SNAKE_CASE = 50_00_00 _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = os.path.split(__file__) _SCREAMING_SNAKE_CASE ...
327
1
import requests def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : Dict = {'Content-Type': 'application/json'} snake_case_ : int = requests.post(__a , json={'text': message_body} , headers=__a ) if response.status_cod...
327
from collections import namedtuple import requests from lxml import html # type: ignore _SCREAMING_SNAKE_CASE = namedtuple("""covid_data""", """cases deaths recovered""") def SCREAMING_SNAKE_CASE__ ( __a = "https://www.worldometers.info/coronavirus/" ): snake_case_ ...
327
1
import json import os import shutil import tempfile import unittest from transformers import BatchEncoding, CanineTokenizer from transformers.testing_utils import require_tokenizers, require_torch from transformers.tokenization_utils import AddedToken from transformers.utils import cached_property...
327
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer _SCREAMING_SNAKE_CASE = {"""vocab_file""": """vocab.txt""", """tokenizer_file""": ""...
327
1
import unittest from transformers import GPTNeoXJapaneseConfig, is_torch_available from transformers.models.gpt_neox_japanese.tokenization_gpt_neox_japanese import GPTNeoXJapaneseTokenizer from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common impo...
327
def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): snake_case_ : int = f"""Input value of [number={number}] must be an integer""" raise TypeError(__a ) if number < 0: return False snake_case_ : Dict = number * number ...
327
1
from math import ceil, sqrt def SCREAMING_SNAKE_CASE__ ( __a = 1_00_00_00 ): snake_case_ : Union[str, Any] = 0 for outer_width in range(3 , (limit // 4) + 2 ): if outer_width**2 > limit: snake_case_ : Any = max(ceil(sqrt(outer_width**2 -...
327
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_autoformer""": [ """AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", ""...
327
1
import numpy as np def SCREAMING_SNAKE_CASE__ ( __a ): return 1 / (1 + np.exp(-vector )) def SCREAMING_SNAKE_CASE__ ( __a ): return vector * sigmoid(1.702 * vector ) if __name__ == "__main__": import doctest doctest.testmod()
327
from typing import Dict from .base import GenericTensor, Pipeline class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def UpperCAmelCase_ ( self : str , _A : Optional[Any]=None , _A : List[str]=None , _A : Optional[Any]...
327
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_longt5""": ["""LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LongT5Config""", """LongT5OnnxConfig"""], } ...
327
from itertools import permutations def SCREAMING_SNAKE_CASE__ ( __a ): if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if num[5] % 5 != 0: return False snake_case_ : Any = [7, 11, 13, 17] for i, test in enumerate(_...
327
1
import os def SCREAMING_SNAKE_CASE__ ( ): with open(os.path.dirname(__a ) + '/grid.txt' ) as f: snake_case_ : int = [] # noqa: E741 for _ in range(20 ): l.append([int(__a ) for x in f.readline().split()] ) snake_case_ : Dict = 0...
327
from __future__ import annotations from collections import namedtuple def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Any = namedtuple('result' , 'name value' ) if (voltage, current, power).count(0 ) != 1: rais...
327
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) _SCREAMING_SNAKE_CASE = {"""configuration_vit_mae""": ["""VIT_MAE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """V...
327
import re import string import numpy as np import datasets _SCREAMING_SNAKE_CASE = """ Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. """ _SCREAMING_SNAKE_CASE = """ ...
327
1
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( __a , __a , __a , __a , __a , ): snake_case_ : Optional[Any] = len(__a ) # If row is equal to the size of the board it means there are a queen in each r...
327
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, ...
327
1
import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) _SCREAMING_SNAKE_CASE = pytest.mark.integration @pytest.mark.parametrize(...
327
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : list[list[int]] = [] snake_case_ : list[int] = [] snake_case_ : List[Any] = 0 snake_case_ : Union[str, Any] = sum(__a ) create_...
327
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _SCREAMING_SNAKE_CASE = { """configuration_poolformer""": [ """POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PoolFormerConfig...
327
def SCREAMING_SNAKE_CASE__ ( __a , __a ): if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) return (bulk_modulus / density) ** 0.5 if __name__ == "__main__": import...
327
1
def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : str = 0 # if input_string is "aba" than new_input_string become "a|b|a" snake_case_ : List[str] = '' snake_case_ : List[str] = '' # append each character + "|" in new_string for range(0, length-1)...
327
from math import pi def SCREAMING_SNAKE_CASE__ ( __a , __a ): return 2 * pi * radius * (angle / 3_60) if __name__ == "__main__": print(arc_length(90, 10))
327
1
import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : Dict = [ 'encoder.version', 'decoder.version', 'model.encoder.version', 'm...
327
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STAN...
327
1
import re import string import numpy as np import datasets _SCREAMING_SNAKE_CASE = """ Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. """ _SCREAMING_SNAKE_CASE = """ ...
327
import sys _SCREAMING_SNAKE_CASE = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """6...
327
1
import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosity_info() _SCREAMING_SNAKE_CA...
327
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqL...
327
1
import inspect import re from hashlib import shaaaa from typing import Dict, List from .arrow import arrow from .audiofolder import audiofolder from .csv import csv from .imagefolder import imagefolder from .json import json from .pandas import pandas from .parquet import parquet from .sql impo...
327
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _SCREAMING_SNAKE_CASE = { """configuration_poolformer""": [ """POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PoolFormerConfig...
327
1
def SCREAMING_SNAKE_CASE__ ( __a , __a ): while b: snake_case_ ,snake_case_ : Any = b, a % b return a def SCREAMING_SNAKE_CASE__ ( __a , __a ): return a if b == 0 else euclidean_gcd_recursive(__a , a % b ) def...
327
import tempfile import unittest from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from transformers.testing_utils import ( is_torch_available, require_optimum, require_torch, slow, ) if is_torch_available(): import torch @require_torch @require_optimum @s...
327
1
def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): return round(float(moles / volume ) * nfactor ) def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): return round(float((moles * 0.0821 * temperature) / (volume) ) ...
327
import numpy as np import torch from torch.utils.data import Dataset from utils import logger class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self : Union[str, Any] , _A : Any , _A : Dict ) -> Union[str, Any]...
327
1
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 SCREAMING_SNAKE_CASE_ ( snake_case_ ): def __init__( self ...
327
def SCREAMING_SNAKE_CASE__ ( __a , __a ): while b: snake_case_ ,snake_case_ : Any = b, a % b return a def SCREAMING_SNAKE_CASE__ ( __a , __a ): return a if b == 0 else euclidean_gcd_recursive(__a , a % b ) def...
327
1
import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate fr...
327
import os import torch from ..logging import get_logger from .constants import FSDP_PYTORCH_VERSION, MODEL_NAME, OPTIMIZER_NAME from .versions import is_torch_version if is_torch_version(""">=""", FSDP_PYTORCH_VERSION): import torch.distributed.checkpoint as dist_cp from torch.dis...
327
1
from pathlib import PurePosixPath from typing import Optional import fsspec from fsspec import AbstractFileSystem from huggingface_hub.hf_api import DatasetInfo from ..utils.file_utils import get_authentication_headers_for_url from ..utils.hub import hf_hub_url class SCREAMING_SNAKE_CASE_ ( s...
327
import unittest from typing import Dict, List, Optional, Union 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,...
327
1
def SCREAMING_SNAKE_CASE__ ( __a ): if not grid or not grid[0]: raise TypeError('The grid does not contain the appropriate information' ) for cell_n in range(1 , len(grid[0] ) ): grid[0][cell_n] += grid[0][cell_n - 1] snake_case_ : List[Any] ...
327
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration _SCREAMING_SNAKE_CASE = 50_00_00 _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = os.path.split(__file__) _SCREAMING_SNAKE_CASE ...
327
1
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common impo...
327
from collections import namedtuple import requests from lxml import html # type: ignore _SCREAMING_SNAKE_CASE = namedtuple("""covid_data""", """cases deaths recovered""") def SCREAMING_SNAKE_CASE__ ( __a = "https://www.worldometers.info/coronavirus/" ): snake_case_ ...
327
1
_SCREAMING_SNAKE_CASE = { """a""": """AAAAA""", """b""": """AAAAB""", """c""": """AAABA""", """d""": """AAABB""", """e""": """AABAA""", """f""": """AABAB""", """g""": """AABBA""", """h""": """AABBB""", """i""": """ABAAA""", """j""": """BBBAA""", ...
327
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer _SCREAMING_SNAKE_CASE = {"""vocab_file""": """vocab.txt""", """tokenizer_file""": ""...
327
1
def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : Union[str, Any] = 1 for i in range(1 , num + 1 ): fact *= i return fact def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : int = 0 while number > 0: snake_case_ : Un...
327
def SCREAMING_SNAKE_CASE__ ( __a ): if not isinstance(__a , __a ): snake_case_ : int = f"""Input value of [number={number}] must be an integer""" raise TypeError(__a ) if number < 0: return False snake_case_ : Dict = number * number ...
327
1
import random from .binary_exp_mod import bin_exp_mod def SCREAMING_SNAKE_CASE__ ( __a , __a=10_00 ): if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd snake_case_ : List[Any] = n - 1 snake_case_ : str = 0 ...
327
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_autoformer""": [ """AUTOFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", ""...
327
1
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def SCREAMING_SNAKE_CASE__ ( __a , __a=None ): snake_case_ : str = None if token is not None: snake_case_ ...
327
from typing import Dict from .base import GenericTensor, Pipeline class SCREAMING_SNAKE_CASE_ ( snake_case_ ): def UpperCAmelCase_ ( self : str , _A : Optional[Any]=None , _A : List[str]=None , _A : Optional[Any]...
327
1
_SCREAMING_SNAKE_CASE = """Alexander Joslin""" import operator as op from .stack import Stack def SCREAMING_SNAKE_CASE__ ( __a ): snake_case_ : List[Any] = {'*': op.mul, '/': op.truediv, '+': op.add, '-': op.sub} snake_case_ : Stack[int] = Sta...
327
from itertools import permutations def SCREAMING_SNAKE_CASE__ ( __a ): if num[3] % 2 != 0: return False if (num[2] + num[3] + num[4]) % 3 != 0: return False if num[5] % 5 != 0: return False snake_case_ : Any = [7, 11, 13, 17] for i, test in enumerate(_...
327
1
from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=snake_case_ ) class SCREAMING_SNAKE_CASE_ ( snake_case_ ): __magic_name__: str = field(default="language-mo...
327
from __future__ import annotations from collections import namedtuple def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Any = namedtuple('result' , 'name value' ) if (voltage, current, power).count(0 ) != 1: rais...
327
1
from .glue import GlueDataset, GlueDataTrainingArguments from .language_modeling import ( LineByLineTextDataset, LineByLineWithRefDataset, LineByLineWithSOPTextDataset, TextDataset, TextDatasetForNextSentencePrediction, ) from .squad import SquadDataset, SquadDataTrainingArgument...
327
import re import string import numpy as np import datasets _SCREAMING_SNAKE_CASE = """ Returns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list. """ _SCREAMING_SNAKE_CASE = """ ...
327
1
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_ena...
327
from __future__ import annotations import copy import inspect import json import math import os import tempfile import unittest from importlib import import_module import numpy as np from transformers import ViTMAEConfig from transformers.file_utils import cached_property, is_tf_available, ...
327
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { """configuration_swinv2""": ["""SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Swinv2Config"""], } try: if not is_torch_available(...
327
from __future__ import annotations def SCREAMING_SNAKE_CASE__ ( __a , __a ): snake_case_ : list[list[int]] = [] snake_case_ : list[int] = [] snake_case_ : List[Any] = 0 snake_case_ : Union[str, Any] = sum(__a ) create_...
327
1
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation _SCR...
327
def SCREAMING_SNAKE_CASE__ ( __a , __a ): if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) return (bulk_modulus / density) ** 0.5 if __name__ == "__main__": import...
327
1
from __future__ import annotations class SCREAMING_SNAKE_CASE_ : def __init__( self : Dict , _A : int = 0 ) -> str: """simple docstring""" snake_case_ : Union[str, Any] = key def Upper...
327
from math import pi def SCREAMING_SNAKE_CASE__ ( __a , __a ): return 2 * pi * radius * (angle / 3_60) if __name__ == "__main__": print(arc_length(90, 10))
327
1
import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class SCREAMING_SNAKE_CASE_ ( snake_case_ , unittest.TestCase ): __magic_name__: List[str] ...
327
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STAN...
327
1
import random def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Dict = a[left_index] snake_case_ : int = left_index + 1 for j in range(left_index + 1 , __a ): if a[j] < pivot: snake_case_ ,snake_case_ ...
327
import sys _SCREAMING_SNAKE_CASE = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """6...
327
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { """facebook/timesformer""": """https://huggingface.co/facebook/timesformer/resolve/main/config.json""", } clas...
327
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqL...
327
1
from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge _SCREAMING_SNAKE_CASE = [ """Prosecutor: \"No videos were used in the crash investigation\" German papers say they saw a ...
327
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _SCREAMING_SNAKE_CASE = { """configuration_poolformer""": [ """POOLFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """PoolFormerConfig...
327
1