code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' import collections import json import os import re from typing import TYPE_CHECKING, List, Optional, Tuple import numpy as np from ...tokenization_utils_fast import PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipeline...
35
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> tuple[float, list[float]]: UpperCamelCase = list(range(len(__UpperCamelCase ) ) ) UpperCame...
35
1
'''simple docstring''' from math import sqrt def lowercase__ ( __UpperCamelCase )-> bool: 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, ...
35
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = { 'SenseTime/deformable-detr...
35
1
'''simple docstring''' import gc import random import unittest import torch from diffusers import ( IFImgaImgPipeline, IFImgaImgSuperResolutionPipeline, IFInpaintingPipeline, IFInpaintingSuperResolutionPipeline, IFPipeline, IFSuperResolutionPipeline, ) from diffu...
35
'''simple docstring''' import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def lowercase__ ( __UpperCamelCase )-> Any: UpperCamelCase = [ """encoder.version""", ...
35
1
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase )-> None: create_state_space_tree(__UpperCamelCase , [] , 0 , [0 for i in range(len(__UpperCamelCase ) )] ) def lowercase__ ( __Upp...
35
'''simple docstring''' import inspect import unittest from transformers import MobileNetVaConfig 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_configu...
35
1
'''simple docstring''' import argparse import os import re import packaging.version SCREAMING_SNAKE_CASE__ = 'examples/' SCREAMING_SNAKE_CASE__ = { 'examples': (re.compile(R'^check_min_version\("[^"]+"\)\s*$', re.MULTILINE), 'check_min_version("VERSION")\n'),...
35
'''simple docstring''' from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDM...
35
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/li...
35
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule SCREAMING_SNAKE_CASE__ = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer ...
35
1
'''simple docstring''' import random def lowercase__ ( __UpperCamelCase )-> bool: UpperCamelCase = num - 1 UpperCamelCase = 0 while s % 2 == 0: UpperCamelCase = s // 2 t +...
35
'''simple docstring''' SCREAMING_SNAKE_CASE__ = 8.31_44_62 # Unit - J mol-1 K-1 def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> float: if moles < 0 or kelvin < 0 or volume < 0: raise ValueError("""Invalid ...
35
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/li...
35
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set...
35
1
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent SCREAMING_SNAKE_CASE__ = {'UserAgent': UserAgent().random} def lowercase__ ( __UpperCamelCase )-...
35
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_availab...
35
1
'''simple docstring''' import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available from . import BaseDiffusersCLICommand ...
35
'''simple docstring''' 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_availab...
35
1
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class a_ ( lowerCamelCase ): def _...
35
'''simple docstring''' from math import factorial def lowercase__ ( __UpperCamelCase = 20 )-> int: UpperCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... UpperCamelCase ...
35
1
'''simple docstring''' import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ASTConfig from transformers.testing_utils import require_torch, require_torchaudio, slow, torch_device from transformers.utils import cached_property, is_torch_available, ...
35
'''simple docstring''' from math import sqrt def lowercase__ ( __UpperCamelCase )-> int: UpperCamelCase = 0 for i in range(1 , int(sqrt(__UpperCamelCase ) + 1 ) ): if n % i == 0 and i != sqrt(__UpperCamelCase )...
35
1
'''simple docstring''' from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class a_ : lowercase = 42 lower...
35
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) SCREAMING_SNAKE_CASE__ = { 'configuration_swiftformer': [ 'SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
35
1
'''simple docstring''' from collections import namedtuple import requests from lxml import html # type: ignore SCREAMING_SNAKE_CASE__ = namedtuple('covid_data', 'cases deaths recovered') def lowercase__ ( __UpperCamelCase = "https://www.worldometers.info/c...
35
'''simple docstring''' def lowercase__ ( __UpperCamelCase )-> str: if not all(char in """01""" for char in bin_string ): raise ValueError("""Non-binary value was passed to the function""" ) if not bin_string: raise ValueError("""Empty str...
35
1
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.a...
35
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/license...
35
1
'''simple docstring''' 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 ...
35
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> str: if not isinstance(__UpperCamelCase , __UpperCamelCase ): raise ValueError("""iterations must be defined as integers""" ) if not isinstance(__UpperCamelCase , __Up...
35
1
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils imp...
35
'''simple docstring''' import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def lowercase__ ( __UpperCamelCase , __UpperCamelCase=1 )-> Tuple: if n_shave_prefix_segments >= 0: return "...
35
1
'''simple docstring''' class a_ : def __init__( self ) -> Tuple: """simple docstring""" UpperCamelCase = """""" UpperCamelCase = """""" UpperCamelCase = [] def A__...
35
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> dict[str, float]: if (voltage, current, resistance).count(0 ) != 1: raise ValueError("""One and only one argum...
35
1
'''simple docstring''' import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel SCREAMING_SNAKE_CASE__ = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', ...
35
'''simple docstring''' # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keep...
35
1
'''simple docstring''' from __future__ import annotations class a_ : def __init__( self , _SCREAMING_SNAKE_CASE = 0 ) -> Tuple: """simple docstring""" UpperCamelCase = key def A__ ( self , _SCR...
700
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser() parse...
35
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf ...
701
'''simple docstring''' from __future__ import annotations from typing import Any class a_ : def __init__( self , _SCREAMING_SNAKE_CASE = 6 ) -> None: """simple docstring""" UpperCamelCase = None Upp...
35
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from diffusers import ( DDIMScheduler, KandinskyVaaControlnetPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor...
702
'''simple docstring''' import fire from utils import calculate_rouge, save_json def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase=None , **__UpperCamelCase )-> int: UpperCamelCase = [x.strip() for x in open(__UpperCame...
35
0
import itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin if is_speech_av...
703
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> tuple[float, list[float]]: UpperCamelCase = list(range(len(__UpperCamelCase ) ) ) UpperCame...
35
0
'''simple docstring''' import argparse import math import os import torch from neural_compressor.utils.pytorch import load from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, StableDiffusionPipeline, UNetaDConditionModel ...
704
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = { 'SenseTime/deformable-detr...
35
0
'''simple docstring''' import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import ClassLabel, Features, Value from .base import TaskTemplate @dataclass(frozen=lowercase__ ) class a_ ( lowercase__ ): lowerca...
705
'''simple docstring''' import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def lowercase__ ( __UpperCamelCase )-> Any: UpperCamelCase = [ """encoder.version""", ...
35
0
'''simple docstring''' import warnings from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class...
706
'''simple docstring''' import inspect import unittest from transformers import MobileNetVaConfig 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_configu...
35
0
'''simple docstring''' import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets...
707
'''simple docstring''' from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDM...
35
0
'''simple docstring''' SCREAMING_SNAKE_CASE__ = 'Alexander Joslin' import operator as op from .stack import Stack def lowercase__ ( __UpperCamelCase )-> int: UpperCamelCase = {'''*''': op.mul, '''/''': op.truediv, '''+''': op.a...
708
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule SCREAMING_SNAKE_CASE__ = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer ...
35
0
'''simple docstring''' def lowercase__ ( )-> Optional[Any]: return [ a * b * (1000 - a - b) for a in range(1 , 999 ) for b in range(__lowerCAmelCase , 999 ) if (a * a + b * b == (1000 - a - b) ** 2) ][0] if __name__ =...
709
'''simple docstring''' SCREAMING_SNAKE_CASE__ = 8.31_44_62 # Unit - J mol-1 K-1 def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> float: if moles < 0 or kelvin < 0 or volume < 0: raise ValueError("""Invalid ...
35
0
'''simple docstring''' import logging import os from .state import PartialState class a_ ( logging.LoggerAdapter ): @staticmethod def A__ ( _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" UpperCamelCa...
710
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set...
35
0
'''simple docstring''' from __future__ import annotations class a_ : def __init__( self , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> str: """simple docstring""" UpperCamelCase = text, pattern Uppe...
711
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_availab...
35
0
'''simple docstring''' from __future__ import annotations SCREAMING_SNAKE_CASE__ = list[list[int]] # assigning initial values to the grid SCREAMING_SNAKE_CASE__ = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1...
712
'''simple docstring''' 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_availab...
35
0
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class a_ ( _snake_case ): lowercase = ['image_processor', 'tokenizer'] lowercase = 'CLIPImageProcessor' lowercase = ('CLIPT...
713
'''simple docstring''' from math import factorial def lowercase__ ( __UpperCamelCase = 20 )-> int: UpperCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... UpperCamelCase ...
35
0
'''simple docstring''' import argparse import re from flax.traverse_util import flatten_dict, unflatten_dict from tax import checkpoints from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration from transformers.modeling_flax_pytorch_utils import load_flax_...
714
'''simple docstring''' from math import sqrt def lowercase__ ( __UpperCamelCase )-> int: UpperCamelCase = 0 for i in range(1 , int(sqrt(__UpperCamelCase ) + 1 ) ): if n % i == 0 and i != sqrt(__UpperCamelCase )...
35
0
'''simple docstring''' import warnings from .generation import TFGenerationMixin class a_ ( __lowerCAmelCase ): warnings.warn( """Importing `TFGenerationMixin` from `src/transformers/generation_tf_utils.py` is deprecated and will """ """be removed in Tr...
715
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) SCREAMING_SNAKE_CASE__ = { 'configuration_swiftformer': [ 'SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
35
0
'''simple docstring''' import argparse import json from typing import List from ltp import LTP from transformers import BertTokenizer def lowercase__ ( __UpperCamelCase )-> Any: if ( (cp >= 0X4E00 and cp <= 0X9FFF) or (cp >= 0X3400 and cp <= 0X4DBF) # ...
716
'''simple docstring''' def lowercase__ ( __UpperCamelCase )-> str: if not all(char in """01""" for char in bin_string ): raise ValueError("""Non-binary value was passed to the function""" ) if not bin_string: raise ValueError("""Empty str...
35
0
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> Any: print("""\nThe shortest path matrix using Floyd Warshall algorithm\n""" ) for i in range(_lowerCamelCase ): for j in range(_lowerCamelCase ): ...
717
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/license...
35
0
'''simple docstring''' import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def lowercase__ ( __UpperCamelCase )-> Any: UpperCamelCase = [ '''decod...
718
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> str: if not isinstance(__UpperCamelCase , __UpperCamelCase ): raise ValueError("""iterations must be defined as integers""" ) if not isinstance(__UpperCamelCase , __Up...
35
0
from __future__ import annotations def lowercase__ ( __UpperCamelCase )-> None: create_state_space_tree(_A , [] , 0 , [0 for i in range(len(_A ) )] ) def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , ...
719
'''simple docstring''' import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def lowercase__ ( __UpperCamelCase , __UpperCamelCase=1 )-> Tuple: if n_shave_prefix_segments >= 0: return "...
35
0
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, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, ...
720
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> dict[str, float]: if (voltage, current, resistance).count(0 ) != 1: raise ValueError("""One and only one argum...
35
0
'''simple docstring''' import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size ...
721
'''simple docstring''' # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keep...
35
0
'''simple docstring''' import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from t...
700
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser() parse...
35
0
'''simple docstring''' from bisect import bisect from itertools import accumulate def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> Optional[Any]: UpperCamelCase = sorted(zip(__SCREAMING_SNAKE_CASE...
701
'''simple docstring''' from __future__ import annotations from typing import Any class a_ : def __init__( self , _SCREAMING_SNAKE_CASE = 6 ) -> None: """simple docstring""" UpperCamelCase = None Upp...
35
0
'''simple docstring''' import argparse import json import os import sys import tempfile import unittest from argparse import Namespace from dataclasses import dataclass, field from enum import Enum from pathlib import Path from typing import List, Literal, Optional import yaml from tran...
702
'''simple docstring''' import fire from utils import calculate_rouge, save_json def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase=None , **__UpperCamelCase )-> int: UpperCamelCase = [x.strip() for x in open(__UpperCame...
35
0
from __future__ import annotations from collections.abc import Callable SCREAMING_SNAKE_CASE__ = list[list[float | int]] def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> List[Any]: UpperCamelCase = len(snake_case_ ) ...
703
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> tuple[float, list[float]]: UpperCamelCase = list(range(len(__UpperCamelCase ) ) ) UpperCame...
35
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ ...
704
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = { 'SenseTime/deformable-detr...
35
0
'''simple docstring''' import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformers...
705
'''simple docstring''' import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def lowercase__ ( __UpperCamelCase )-> Any: UpperCamelCase = [ """encoder.version""", ...
35
0
'''simple docstring''' 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_tok...
706
'''simple docstring''' import inspect import unittest from transformers import MobileNetVaConfig 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_configu...
35
0
'''simple docstring''' 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...
707
'''simple docstring''' from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDM...
35
0
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> int: while a != 0: UpperCamelCase = b % a, a return b def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> int: if ...
708
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule SCREAMING_SNAKE_CASE__ = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer ...
35
0
'''simple docstring''' from __future__ import annotations class a_ : def __init__( self , _SCREAMING_SNAKE_CASE ) -> None: """simple docstring""" UpperCamelCase = data UpperCamelCase = ...
709
'''simple docstring''' SCREAMING_SNAKE_CASE__ = 8.31_44_62 # Unit - J mol-1 K-1 def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> float: if moles < 0 or kelvin < 0 or volume < 0: raise ValueError("""Invalid ...
35
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_alig...
710
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set...
35
0
'''simple docstring''' from typing import Optional import pyspark from .. import Features, NamedSplit from ..download import DownloadMode from ..packaged_modules.spark.spark import Spark from .abc import AbstractDatasetReader class a_ ( __UpperCAmelCase ): def __in...
711
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_availab...
35
0
'''simple docstring''' import random def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> str: UpperCamelCase = [], [], [] for element in data: if element < pivot: less.append(_lowercase ) elif element > piv...
712
'''simple docstring''' 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_availab...
35
0
'''simple docstring''' import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, ByTaTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_co...
713
'''simple docstring''' from math import factorial def lowercase__ ( __UpperCamelCase = 20 )-> int: UpperCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... UpperCamelCase ...
35
0
'''simple docstring''' import argparse import os from . import ( ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BART_PRETRAINED_MODEL_ARCHIVE_LIST, BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, DISTILBERT_PRETRA...
714
'''simple docstring''' from math import sqrt def lowercase__ ( __UpperCamelCase )-> int: UpperCamelCase = 0 for i in range(1 , int(sqrt(__UpperCamelCase ) + 1 ) ): if n % i == 0 and i != sqrt(__UpperCamelCase )...
35
0
'''simple docstring''' import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logg...
715
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) SCREAMING_SNAKE_CASE__ = { 'configuration_swiftformer': [ 'SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
35
0
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = { '''ut/deta''': '''https://huggingface.co/ut/d...
716
'''simple docstring''' def lowercase__ ( __UpperCamelCase )-> str: if not all(char in """01""" for char in bin_string ): raise ValueError("""Non-binary value was passed to the function""" ) if not bin_string: raise ValueError("""Empty str...
35
0
'''simple docstring''' SCREAMING_SNAKE_CASE__ = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] SCREAMING_SNAKE_CASE__ = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] SCREAMING_SNAKE_CASE__ = { 0: 'Sunday', 1: 'Monday', 2: 'Tuesday', 3: 'Wednesday', 4: '...
717
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/license...
35
0
'''simple docstring''' from typing import Any import numpy as np def lowercase__ ( __UpperCamelCase )-> Dict: return np.array_equal(lowercase__ , matrix.conjugate().T ) def lowercase__ ( __UpperCamelCase , __UpperCamelCase )->...
718
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> str: if not isinstance(__UpperCamelCase , __UpperCamelCase ): raise ValueError("""iterations must be defined as integers""" ) if not isinstance(__UpperCamelCase , __Up...
35
0
import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () SCREAMING_SNAKE_CASE__ = np.linspace(start=0, stop=7_5, num=7_5, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membe...
719
'''simple docstring''' import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def lowercase__ ( __UpperCamelCase , __UpperCamelCase=1 )-> Tuple: if n_shave_prefix_segments >= 0: return "...
35
0
from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = { "uw-madison/mra-base-512-4": "https://huggingface.co/uw-madison/mra-base-512-4/resolve/main/config.jso...
720
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> dict[str, float]: if (voltage, current, resistance).count(0 ) != 1: raise ValueError("""One and only one argum...
35
0
'''simple docstring''' 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, ViltForImagesAndTextClass...
721
'''simple docstring''' # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keep...
35
0
'''simple docstring''' import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class a_ ( lowerCamelCase ): lowercase = (PNDMScheduler,) lowercase = (('num_inference_steps', 50),) def ...
700
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser() parse...
35
0
'''simple docstring''' from math import sqrt def lowercase__ ( __UpperCamelCase = 1000000 )-> Union[str, Any]: UpperCamelCase = 0 UpperCamelCase = 0 UpperCamelCase = 42 while num_cuboids <= ...
701
'''simple docstring''' from __future__ import annotations from typing import Any class a_ : def __init__( self , _SCREAMING_SNAKE_CASE = 6 ) -> None: """simple docstring""" UpperCamelCase = None Upp...
35
0
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> str: UpperCamelCase = '''''' for i in table: res += inp[i - 1] return res def lowercase__ ( __UpperCamelCase )-> int: ...
702
'''simple docstring''' import fire from utils import calculate_rouge, save_json def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase=None , **__UpperCamelCase )-> int: UpperCamelCase = [x.strip() for x in open(__UpperCame...
35
0
import builtins import sys from ...utils.imports import _is_package_available from . import cursor, input from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor from .keymap import KEYMAP SCREAMING_SNAKE_CASE__ = False try: ...
703
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> tuple[float, list[float]]: UpperCamelCase = list(range(len(__UpperCamelCase ) ) ) UpperCame...
35
0
'''simple docstring''' from pathlib import Path import numpy as np from PIL import Image def lowercase__ ( __UpperCamelCase )-> Dict: UpperCamelCase = rgb[:, :, 0], rgb[:, :, 1], rgb[:, :, 2] return 0.2_989 * r + 0.5_870 * g + 0.1_140 *...
704
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = { 'SenseTime/deformable-detr...
35
0
'''simple docstring''' 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_configuratio...
705
'''simple docstring''' import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def lowercase__ ( __UpperCamelCase )-> Any: UpperCamelCase = [ """encoder.version""", ...
35
0
'''simple docstring''' from __future__ import annotations import math SCREAMING_SNAKE_CASE__ = '2020.9.26' SCREAMING_SNAKE_CASE__ = 'xcodz-dot, cclaus, dhruvmanila' def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase , ...
706
'''simple docstring''' import inspect import unittest from transformers import MobileNetVaConfig 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_configu...
35
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) SCREAMING_SNAKE_CASE__ = { 'configuration_efficientformer': [ ...
707
'''simple docstring''' from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDM...
35
0
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_...
708
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule SCREAMING_SNAKE_CASE__ = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer ...
35
0
'''simple docstring''' import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device SCREAMING_SNAKE_CASE__ = False class ...
709
'''simple docstring''' SCREAMING_SNAKE_CASE__ = 8.31_44_62 # Unit - J mol-1 K-1 def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> float: if moles < 0 or kelvin < 0 or volume < 0: raise ValueError("""Invalid ...
35
0
'''simple docstring''' 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 ...
710
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set...
35
0
'''simple docstring''' import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin, SchedulerOutput ...
711
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_availab...
35
0
'''simple docstring''' import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import CLIPMo...
712
'''simple docstring''' 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_availab...
35
0
'''simple docstring''' import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class a_ ( __lowercase ): def __init...
713
'''simple docstring''' from math import factorial def lowercase__ ( __UpperCamelCase = 20 )-> int: UpperCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... UpperCamelCase ...
35
0
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE__ = ...
714
'''simple docstring''' from math import sqrt def lowercase__ ( __UpperCamelCase )-> int: UpperCamelCase = 0 for i in range(1 , int(sqrt(__UpperCamelCase ) + 1 ) ): if n % i == 0 and i != sqrt(__UpperCamelCase )...
35
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE__ ...
715
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) SCREAMING_SNAKE_CASE__ = { 'configuration_swiftformer': [ 'SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
35
0
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/facebook/musicgen-smal...
716
'''simple docstring''' def lowercase__ ( __UpperCamelCase )-> str: if not all(char in """01""" for char in bin_string ): raise ValueError("""Non-binary value was passed to the function""" ) if not bin_string: raise ValueError("""Empty str...
35
0
'''simple docstring''' import argparse import os import re import packaging.version SCREAMING_SNAKE_CASE__ = 'examples/' SCREAMING_SNAKE_CASE__ = { 'examples': (re.compile(R'^check_min_version\("[^"]+"\)\s*$', re.MULTILINE), 'check_min_version("VERSION")\n'),...
717
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/license...
35
0
'''simple docstring''' import unittest import numpy as np from transformers import RobertaConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if...
718
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase )-> str: if not isinstance(__UpperCamelCase , __UpperCamelCase ): raise ValueError("""iterations must be defined as integers""" ) if not isinstance(__UpperCamelCase , __Up...
35
0
import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller SCREAMING_SNAKE_CASE__ = 3 def lowercase__ ( __UpperCamelCase )-> int: print("""Generating primitive root of p""" ) while Tru...
719
'''simple docstring''' import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def lowercase__ ( __UpperCamelCase , __UpperCamelCase=1 )-> Tuple: if n_shave_prefix_segments >= 0: return "...
35
0
import warnings from ..trainer import Trainer from ..utils import logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) class a_ ( __SCREAMING_SNAKE_CASE ): def __init__( self , _SCREAMING_SNAKE_CASE=None , **_SCREAMING_SNAKE_CASE ...
720
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> dict[str, float]: if (voltage, current, resistance).count(0 ) != 1: raise ValueError("""One and only one argum...
35
0
'''simple docstring''' class a_ : def __init__( self , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) -> int: """simple docstring""" UpperCamelCase = name UpperCamelCase = va...
721
'''simple docstring''' # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keep...
35
0
'''simple docstring''' import re def lowercase__ ( __UpperCamelCase )-> int: UpperCamelCase = re.compile( R"""^(?:0|94|\+94|0{2}94)""" R"""7(0|1|2|4|5|6|7|8)""" R"""(-| |)""" R"""\d{7}$""" ) return bool(re.search(__UpperCam...
700
'''simple docstring''' import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser() parse...
35
0
'''simple docstring''' 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 DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from ...
701
'''simple docstring''' from __future__ import annotations from typing import Any class a_ : def __init__( self , _SCREAMING_SNAKE_CASE = 6 ) -> None: """simple docstring""" UpperCamelCase = None Upp...
35
0
'''simple docstring''' 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 Pa...
702
'''simple docstring''' import fire from utils import calculate_rouge, save_json def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase=None , **__UpperCamelCase )-> int: UpperCamelCase = [x.strip() for x in open(__UpperCame...
35
0
from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common impor...
703
'''simple docstring''' from __future__ import annotations def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> tuple[float, list[float]]: UpperCamelCase = list(range(len(__UpperCamelCase ) ) ) UpperCame...
35
0
'''simple docstring''' from typing import Optional from torch import nn from .transformer_ad import TransformeraDModel, TransformeraDModelOutput class a_ ( nn.Module ): def __init__( self , _SCREAMING_SNAKE_CASE = 16 , _SCREAMING_SNAKE_CASE = 88 , _SC...
704
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = { 'SenseTime/deformable-detr...
35
0
'''simple docstring''' import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @r...
705
'''simple docstring''' import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def lowercase__ ( __UpperCamelCase )-> Any: UpperCamelCase = [ """encoder.version""", ...
35
0
'''simple docstring''' import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger SCREAMING_SNAKE_CASE__ = get_logger(__name__) SCREAMING_SNAKE_CASE__ = R'\n Ar...
706
'''simple docstring''' import inspect import unittest from transformers import MobileNetVaConfig 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_configu...
35
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = { 'uw-madison/mra-base-512-4': 'https://huggingface.co/uw-madison/mra-base-512...
707
'''simple docstring''' from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDM...
35
0
'''simple docstring''' from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstr...
708
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule SCREAMING_SNAKE_CASE__ = {'tokenization_wav2vec2_phoneme': ['Wav2Vec2PhonemeCTCTokenizer']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer ...
35
0
'''simple docstring''' import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer SCREAMING_SNAKE_CASE__...
709
'''simple docstring''' SCREAMING_SNAKE_CASE__ = 8.31_44_62 # Unit - J mol-1 K-1 def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> float: if moles < 0 or kelvin < 0 or volume < 0: raise ValueError("""Invalid ...
35
0
'''simple docstring''' def lowercase__ ( __UpperCamelCase )-> int: UpperCamelCase = [] UpperCamelCase = [] UpperCamelCase = { '^': 3, '*': 2, '/': 2, '%': 2, '...
710
'''simple docstring''' import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set...
35
0
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from timm import create_model from timm.data import resolve_data_config from timm.data.transforms_factory import create_transfo...
711
'''simple docstring''' import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_availab...
35
0
'''simple docstring''' def lowercase__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase )-> Any: UpperCamelCase = (num_of_terms / 2) * (2 * first_term + (num_of_terms - 1) * common_diff) # formula for sum of series return total def lowerc...
712
'''simple docstring''' 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_availab...
35
0
'''simple docstring''' import os import sys import warnings from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manage...
713
'''simple docstring''' from math import factorial def lowercase__ ( __UpperCamelCase = 20 )-> int: UpperCamelCase = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... UpperCamelCase ...
35
0
'''simple docstring''' 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 ImageProcessingS...
714
'''simple docstring''' from math import sqrt def lowercase__ ( __UpperCamelCase )-> int: UpperCamelCase = 0 for i in range(1 , int(sqrt(__UpperCamelCase ) + 1 ) ): if n % i == 0 and i != sqrt(__UpperCamelCase )...
35
0