code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
'''simple docstring''' from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def snake_case ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase = None )-> int: """simple docs...
161
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available SCREAMING_SNAKE_CASE__:List[str] = { """configuration_longt5""": ["""LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LongT5Config""", """Lon...
261
0
'''simple docstring''' import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope='''session''' ) def...
93
"""simple docstring""" 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 _lowerCamelCase( a ...
261
0
'''simple docstring''' from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class __A ( snake_case_ , snake_case_ ): @register_to_config def __init__(self...
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler, ...
261
0
'''simple docstring''' from itertools import count def snake_case_ ( SCREAMING_SNAKE_CASE__ = 50 ): """simple docstring""" _SCREAMING_SNAKE_CASE : Optional[Any] = [1] * min_block_length for n in count(SCREAMING_SNAKE_CASE__ ): fill_count_functi...
200
"""simple docstring""" import random def _lowerCamelCase( a , a , a ): __a = a[left_index] __a = left_index + 1 for j in range(left_index + 1 , a ): if a[j] < pivot: __a , __a = a[i], a[j] ...
261
0
'''simple docstring''' import json import os import re import unicodedata from json.encoder import INFINITY from typing import Any, Dict, List, Optional, Tuple, Union import numpy as np import regex from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchE...
112
"""simple docstring""" from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def _lowerCamelCase( a ): return getitem, k def _lowerCamelCase( a , a ): return setitem, k, v def _lowerCamelCase(...
261
0
"""simple docstring""" from .imports import is_rich_available if is_rich_available(): from rich.traceback import install install(show_locals=False) else: raise ModuleNotFoundError("To use the rich extension, install rich with `pip install rich`")
132
"""simple docstring""" import copy import re class snake_case__ : _snake_case : Dict = """hp""" _snake_case : List[str] = {} _snake_case : int = None @classmethod def a__ ( cls , lowerCamelCase , lowerCamelCase ): __a = prefix ...
261
0
"""simple docstring""" from __future__ import annotations from dataclasses import dataclass @dataclass class lowerCamelCase : lowerCamelCase__ : float lowerCamelCase__ : TreeNode | None = None lowerCamelCase__ : TreeNode | None ...
165
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE__:int = logging.get_logger(__name__) class snake_case__ ( snake_case_ ): _snake_case : O...
261
0
from __future__ import annotations import os from typing import Any import requests __lowerCAmelCase = """https://api.github.com""" # https://docs.github.com/en/free-pro-team@latest/rest/reference/users#get-the-authenticated-user __lowerCAmelCase = BASE_URL + """/user""" ...
196
"""simple docstring""" def _lowerCamelCase( a = 1_0_0_0 ): __a = 3 __a = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 1_5 == 0: result -= a a += 1 return re...
261
0
"""simple docstring""" import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def ...
74
"""simple docstring""" import operator def _lowerCamelCase( a , a = False , a = None ): __a = operator.lt if reverse else operator.gt __a = solution or [] if not arr: return solution __a = [arr.pop(0 )] for i, i...
261
0
"""simple docstring""" import unittest from typing import Tuple import torch from diffusers.utils import floats_tensor, randn_tensor, torch_all_close, torch_device from diffusers.utils.testing_utils import require_torch @require_torch class SCREAMING_SNAKE_CASE__ : @property ...
136
"""simple docstring""" import unittest from transformers import BertGenerationConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_co...
261
0
'''simple docstring''' import random def lowerCamelCase ( lowerCAmelCase : Tuple , lowerCAmelCase : int ): """simple docstring""" __magic_name__ , __magic_name__ , __magic_name__ : List[Any] = [], [], [] for element in data: if element < pivot: less.appe...
331
"""simple docstring""" # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controlnet.p...
261
0
'''simple docstring''' from __future__ import annotations from typing import Any class UpperCamelCase__ : def __init__( self :List[str] , _A :str , _A :Optional[int] , _A :Optional[Any] = 0 ) -> Optional[Any]: '''simple docstring''' ...
161
"""simple docstring""" import argparse import fairseq import torch from torch import nn from transformers import ( MBartaaTokenizer, MBartConfig, MBartForCausalLM, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaModel, log...
261
0
'''simple docstring''' import os def snake_case_ ( __SCREAMING_SNAKE_CASE : Dict = "matrix.txt" ): """simple docstring""" with open(os.path.join(os.path.dirname(__SCREAMING_SNAKE_CASE ) , __SCREAMING_SNAKE_CASE ) ) as in_file...
93
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) SCREAMING_SNAKE_CASE__:str = { """configuration_trocr""": ["""TROCR_PRETRAINED_CO...
261
0
'''simple docstring''' from __future__ import annotations def lowerCAmelCase_ ( snake_case_ : Optional[Any] , snake_case_ : int ) -> str: '''simple docstring''' if len(snake_case_ ) <= 1 or n <= 1: return insert_next(snake_case_ , n...
1
"""simple docstring""" import json import logging import os import socket import git import numpy as np import torch logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO, ) SCREAMING_SNAKE_CASE__...
261
0
'''simple docstring''' import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () UpperCAmelCase_ : str = np.linspace(start=0, stop=75, num=75, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membe...
200
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available SCREAMING_SNAKE_CASE__:List[str] = {"""configuration_van""": ["""VAN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """VanConfig"""]} try: if not...
261
0
'''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.alt_diffusion.mode...
112
"""simple docstring""" from __future__ import annotations from typing import Any class snake_case__ : def __init__( self , lowerCamelCase , lowerCamelCase , lowerCamelCase = 0 ): __a , __a = row, column __a = [[default_value for c in rang...
261
0
"""simple docstring""" def _lowercase ( __lowerCAmelCase ) -> Union[str, Any]: SCREAMING_SNAKE_CASE__ : int = [[0 for _ in range(__lowerCAmelCase )] for _ in range(m + 1 )] for i in range(m + 1 ): SCREAMING_SNAKE_CASE__ : An...
132
"""simple docstring""" import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data im...
261
0
"""simple docstring""" from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controlnet.pipeline_controlnet import StableDiffusionControlNetPipeline # noqa: F401 deprecate( "stable diffusion controlnet", "0.22.0", "Importing...
165
"""simple docstring""" from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionProcessor, AttnP...
261
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowerCAmelCase = {"""configuration_sew""": ["""SEW_PRETRAINED_CONFIG_ARCHIVE_MAP""", """SEWConfig"""]} try: if not is_torch_available(): raise OptionalDependencyNot...
196
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy SCREAMING_SNAKE_CASE__:List[Any] = log...
261
0
"""simple docstring""" import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def _snake_case ( ): with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT ): wit...
74
"""simple docstring""" from collections import Counter from timeit import timeit def _lowerCamelCase( a = "" , ): return sum(c % 2 for c in Counter(input_str.replace(" " , "" ).lower() ).values() ) < 2 def _lowerCamelCase( a = "" ): if len(a ...
261
0
"""simple docstring""" from typing import Any def _SCREAMING_SNAKE_CASE (__lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase , ) -> str: '''simple docstring''' _validation( __...
136
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_com...
261
0
'''simple docstring''' import argparse import json import os from collections import OrderedDict import torch from transformers import LukeConfig, LukeForMaskedLM, MLukeTokenizer, XLMRobertaTokenizer from transformers.tokenization_utils_base import AddedToken @torch.no_grad() def lowerCamelCase ( lowerCA...
331
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class snake_case__ ( snake_case_, snake_case_ ): @register_to_config def __init__( ...
261
0
'''simple docstring''' def snake_case ( UpperCAmelCase )-> str: """simple docstring""" if length <= 0 or not isinstance(UpperCAmelCase , UpperCAmelCase ): raise ValueError('Length must be a positive integer.' ) return [n * (2 * n -...
161
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available SCREAMING_SNAKE_CASE__:List[str] = { """configuration_longt5""": ["""LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LongT5Config""", """Lon...
261
0
'''simple docstring''' from manim import * class lowerCAmelCase__ ( snake_case_ ): def _snake_case ( self ): """simple docstring""" lowercase_ : List[str] = Rectangle(height=0.5 , width=0....
93
"""simple docstring""" 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 _lowerCamelCase( a ...
261
0
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class __A ( snake_case_ ): a__ ...
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler, ...
261
0
'''simple docstring''' import numpy as np def snake_case_ ( SCREAMING_SNAKE_CASE__ ): """simple docstring""" return 1 / (1 + np.exp(-vector )) def snake_case_ ( SCREAMING_SNAKE_CASE__ ): """simple docstring""" return vector * sigmoid(1.7...
200
"""simple docstring""" import random def _lowerCamelCase( a , a , a ): __a = a[left_index] __a = left_index + 1 for j in range(left_index + 1 , a ): if a[j] < pivot: __a , __a = a[i], a[j] ...
261
0
'''simple docstring''' def lowerCAmelCase_ ( _lowerCamelCase: Optional[int] , _lowerCamelCase: Tuple ): __SCREAMING_SNAKE_CASE : Optional[Any] = len(_lowerCamelCase ) + 1 __SCREAMING_SNAKE_CASE : List[str] = len(_lowerCamelCase ) + 1 # ...
112
"""simple docstring""" from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def _lowerCamelCase( a ): return getitem, k def _lowerCamelCase( a , a ): return setitem, k, v def _lowerCamelCase(...
261
0
"""simple docstring""" from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass a :Union[str, Any] = (3, 9, -11, 0, 7, 5, 1, -1) a :List[Any] = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class __a : '''simple docstrin...
132
"""simple docstring""" import copy import re class snake_case__ : _snake_case : Dict = """hp""" _snake_case : List[str] = {} _snake_case : int = None @classmethod def a__ ( cls , lowerCamelCase , lowerCamelCase ): __a = prefix ...
261
0
"""simple docstring""" import copy import re class lowerCamelCase : lowerCamelCase__ : Dict = """hp""" lowerCamelCase__ : List[str] = {} lowerCamelCase__ : int = None @classmethod def SCR...
165
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE__:int = logging.get_logger(__name__) class snake_case__ ( snake_case_ ): _snake_case : O...
261
0
import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.numpy as jnp ...
196
"""simple docstring""" def _lowerCamelCase( a = 1_0_0_0 ): __a = 3 __a = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 1_5 == 0: result -= a a += 1 return re...
261
0
"""simple docstring""" import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclas...
74
"""simple docstring""" import operator def _lowerCamelCase( a , a = False , a = None ): __a = operator.lt if reverse else operator.gt __a = solution or [] if not arr: return solution __a = [arr.pop(0 )] for i, i...
261
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) UpperCAmelCase : str = { """configuration_trocr""": ["""TROCR_PRE...
136
"""simple docstring""" import unittest from transformers import BertGenerationConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_co...
261
0
'''simple docstring''' import pytest from datasets.utils.sharding import _distribute_shards, _number_of_shards_in_gen_kwargs, _split_gen_kwargs @pytest.mark.parametrize( 'kwargs, expected' , [ ({'num_shards': 0, 'max_num_jobs': 1}, []), ({'num_shards': 10, 'max_num_jobs': 1}, [range(10 ...
331
"""simple docstring""" # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controlnet.p...
261
0
'''simple docstring''' from datetime import datetime import matplotlib.pyplot as plt import torch def snake_case ( UpperCAmelCase )-> Tuple: """simple docstring""" for param in module.parameters(): __A = False def s...
161
"""simple docstring""" import argparse import fairseq import torch from torch import nn from transformers import ( MBartaaTokenizer, MBartConfig, MBartForCausalLM, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaModel, log...
261
0
'''simple docstring''' from __future__ import annotations from collections.abc import Iterator class lowerCAmelCase__ : def __init__( self , __SCREAMING_SNAKE_CASE ): """simple docstring""" lowercase_ : Union[str...
93
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) SCREAMING_SNAKE_CASE__:str = { """configuration_trocr""": ["""TROCR_PRETRAINED_CO...
261
0
'''simple docstring''' import unittest from transformers import DebertaVaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTe...
1
"""simple docstring""" import json import logging import os import socket import git import numpy as np import torch logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO, ) SCREAMING_SNAKE_CASE__...
261
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase_ : Optional[int] = { """configuration_clipseg""": [ """CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CLIPSegConfig""", ...
200
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available SCREAMING_SNAKE_CASE__:List[str] = {"""configuration_van""": ["""VAN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """VanConfig"""]} try: if not...
261
0
'''simple docstring''' def lowerCAmelCase_ ( _lowerCamelCase: Dict , _lowerCamelCase: Optional[int] ): __SCREAMING_SNAKE_CASE : Optional[Any] = len(_lowerCamelCase ) __SCREAMING_SNAKE_CASE : int = len(_lowerCamelCase ) __SCREAMING_SNAKE_...
112
"""simple docstring""" from __future__ import annotations from typing import Any class snake_case__ : def __init__( self , lowerCamelCase , lowerCamelCase , lowerCamelCase = 0 ): __a , __a = row, column __a = [[default_value for c in rang...
261
0
"""simple docstring""" import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class __a (snake_case_): '''simple docstring''' _SCREAMING_SNAKE_CASE :Tuple = (EulerDiscreteScheduler,) ...
132
"""simple docstring""" import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data im...
261
0
"""simple docstring""" import inspect import unittest from transformers import DecisionTransformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ...
165
"""simple docstring""" from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionProcessor, AttnP...
261
0
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __lowerCAmelCase = logging.get_logger(__name__) class __a ( snake_case_ , snake_ca...
196
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy SCREAMING_SNAKE_CASE__:List[Any] = log...
261
0
"""simple docstring""" import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp_g...
74
"""simple docstring""" from collections import Counter from timeit import timeit def _lowerCamelCase( a = "" , ): return sum(c % 2 for c in Counter(input_str.replace(" " , "" ).lower() ).values() ) < 2 def _lowerCamelCase( a = "" ): if len(a ...
261
0
"""simple docstring""" import os import unittest from transformers.models.cpmant.tokenization_cpmant import VOCAB_FILES_NAMES, CpmAntTokenizer from transformers.testing_utils import require_jieba, tooslow from ...test_tokenization_common import TokenizerTesterMixin @require_jieba class SCRE...
136
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_com...
261
0
'''simple docstring''' import importlib import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Union import torch from ..utils import BaseOutput lowerCAmelCase :Optional[Any] = """scheduler_config.json""" class _lowerCamelCase ( snake_case...
331
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class snake_case__ ( snake_case_, snake_case_ ): @register_to_config def __init__( ...
261
0
'''simple docstring''' import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device a__ : Optional[Any] = False ...
161
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available SCREAMING_SNAKE_CASE__:List[str] = { """configuration_longt5""": ["""LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LongT5Config""", """Lon...
261
0
'''simple docstring''' import math class lowerCAmelCase__ : def __init__( self , __SCREAMING_SNAKE_CASE=0 ): # a graph with Node 0,1,...,N-1 """simple docstring""" lowercase_ : Union[str, Any] = n...
93
"""simple docstring""" 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 _lowerCamelCase( a ...
261
0
'''simple docstring''' from __future__ import annotations def lowerCAmelCase_ ( snake_case_ : List[str] ) -> str: '''simple docstring''' UpperCAmelCase_ = [True] * limit UpperCAmelCase_ = False UpperCAmelCase_ = False U...
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler, ...
261
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ : int = logging.get_logger(__name__) UpperCAmelCase_ : Optional[int] = { """studio-ousia/luke-base""": """https://huggingface.co/studio-ousia/luke-base/resolve/ma...
200
"""simple docstring""" import random def _lowerCamelCase( a , a , a ): __a = a[left_index] __a = left_index + 1 for j in range(left_index + 1 , a ): if a[j] < pivot: __a , __a = a[i], a[j] ...
261
0
'''simple docstring''' import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create simlink # import clas...
112
"""simple docstring""" from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def _lowerCamelCase( a ): return getitem, k def _lowerCamelCase( a , a ): return setitem, k, v def _lowerCamelCase(...
261
0
"""simple docstring""" import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging a :str = logging.get_logger(__name__) a :Any = { """RUCAIBox/mvp""": """https://huggingface.co/RUCAIBox/mvp/resolve/main/config.json""", } class __a (snake_...
132
"""simple docstring""" import copy import re class snake_case__ : _snake_case : Dict = """hp""" _snake_case : List[str] = {} _snake_case : int = None @classmethod def a__ ( cls , lowerCamelCase , lowerCamelCase ): __a = prefix ...
261
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A_ : List[Any] = {"""configuration_fnet""": ["""FNET_PRET...
165
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE__:int = logging.get_logger(__name__) class snake_case__ ( snake_case_ ): _snake_case : O...
261
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_came...
196
"""simple docstring""" def _lowerCamelCase( a = 1_0_0_0 ): __a = 3 __a = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 1_5 == 0: result -= a a += 1 return re...
261
0
"""simple docstring""" import pytest import datasets.config from datasets.utils.info_utils import is_small_dataset @pytest.mark.parametrize('dataset_size' , [None, 400 * 2**20, 600 * 2**20] ) @pytest.mark.parametrize('input_in_memory_max_size' , ['default', 0, 100 * 2**20, 900 * 2**20] ) def ...
74
"""simple docstring""" import operator def _lowerCamelCase( a , a = False , a = None ): __a = operator.lt if reverse else operator.gt __a = solution or [] if not arr: return solution __a = [arr.pop(0 )] for i, i...
261
0
"""simple docstring""" import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCAmelCase : Tuple = logging.get_logger(__name__...
136
"""simple docstring""" import unittest from transformers import BertGenerationConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_co...
261
0
'''simple docstring''' def lowerCamelCase ( ): """simple docstring""" __magic_name__ : Tuple = 0 for i in range(1 , 1001 ): total += i**i return str(lowerCAmelCase )[-10:] if __name__ == "__main__": print(solution())
331
"""simple docstring""" # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controlnet.p...
261
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a__ : Union[str, Any] = { """configuration_roc_bert""": ["""ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """RoC...
161
"""simple docstring""" import argparse import fairseq import torch from torch import nn from transformers import ( MBartaaTokenizer, MBartConfig, MBartForCausalLM, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaModel, log...
261
0
'''simple docstring''' import math def snake_case_ ( __SCREAMING_SNAKE_CASE : Tuple , __SCREAMING_SNAKE_CASE : List[Any] ): """simple docstring""" if ( not isinstance(__SCREAMING_SNAKE_CASE , (int, float) ) ...
93
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) SCREAMING_SNAKE_CASE__:str = { """configuration_trocr""": ["""TROCR_PRETRAINED_CO...
261
0
'''simple docstring''' SCREAMING_SNAKE_CASE_: List[Any] ="""Input must be a string of 8 numbers plus letter""" SCREAMING_SNAKE_CASE_: Any ="""TRWAGMYFPDXBNJZSQVHLCKE""" def lowerCAmelCase_ ( snake_case_ : List[Any] ) -> List[str]: '''simple docstring''' if not...
1
"""simple docstring""" import json import logging import os import socket import git import numpy as np import torch logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO, ) SCREAMING_SNAKE_CASE__...
261
0
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase_ : Union[str, Any] = logging.get_logger(__name__) UpperCAmelCase_ : str = { """SenseTime/deformable-detr""": """http...
200
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available SCREAMING_SNAKE_CASE__:List[str] = {"""configuration_van""": ["""VAN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """VanConfig"""]} try: if not...
261
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 UpperCamelCase__ : str = logging.get_logger(__name__) UpperCamelCase__...
112
"""simple docstring""" from __future__ import annotations from typing import Any class snake_case__ : def __init__( self , lowerCamelCase , lowerCamelCase , lowerCamelCase = 0 ): __a , __a = row, column __a = [[default_value for c in rang...
261
0
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available a :List[str] = {"""configuration_van""": ["""VAN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """VanConfig"""]} try: if not is_torch_available(): ...
132
"""simple docstring""" import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data im...
261
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A_ : Optional[int] = { """configuration_swinv2""": ["""SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Swinv2Config"""], } try: ...
165
"""simple docstring""" from dataclasses import dataclass from typing import Dict, Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .attention_processor import AttentionProcessor, AttnP...
261
0
import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def snake_case_ ( snake_case ) -> Optional[Any]: lowercase__: Optional[Any] = {} low...
196
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy SCREAMING_SNAKE_CASE__:List[Any] = log...
261
0
"""simple docstring""" import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def _snake_case ( ): print('Making key files...' ) make_key_files('rsa' , 1024 ) print('Key files generation succe...
74
"""simple docstring""" from collections import Counter from timeit import timeit def _lowerCamelCase( a = "" , ): return sum(c % 2 for c in Counter(input_str.replace(" " , "" ).lower() ).values() ) < 2 def _lowerCamelCase( a = "" ): if len(a ...
261
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE (__lowerCAmelCase ) -> int: '''simple docstring''' lowercase_ = n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(27)) print(perfect_cube(4))
136
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_com...
261
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCAmelCase :Optional[Any] = {"""configuration_yolos""": ["""YOLOS_PRETRAINED_CONFIG_ARCHIVE_MAP""", """YolosConfig""", """YolosOnnxConfi...
331
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class snake_case__ ( snake_case_, snake_case_ ): @register_to_config def __init__( ...
261
0
'''simple docstring''' import unittest from parameterized import parameterized from transformers import AutoTokenizer, GPTNeoXConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin f...
161
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available SCREAMING_SNAKE_CASE__:List[str] = { """configuration_longt5""": ["""LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LongT5Config""", """Lon...
261
0
'''simple docstring''' import json import logging import math import os import sys from dataclasses import dataclass, field from typing import Optional from datasets import Dataset, load_dataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_FOR_MASKED_LM_MA...
93
"""simple docstring""" 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 _lowerCamelCase( a ...
261
0
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer SCREAMING_SNAKE_CASE_: int ={"""vocab_file""": """vocab.txt""", """tokenizer_file...
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler, ...
261
0
'''simple docstring''' import torch from diffusers import DiffusionPipeline class lowercase__ ( snake_case_ ): '''simple docstring''' def __init__( self , __snake_case , __snake_case ): super().__init__() self.register_modules(unet=_...
200
"""simple docstring""" import random def _lowerCamelCase( a , a , a ): __a = a[left_index] __a = left_index + 1 for j in range(left_index + 1 , a ): if a[j] < pivot: __a , __a = a[i], a[j] ...
261
0
'''simple docstring''' import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def lowerCAmelCase_ ( _lowerCamelCase: Any , _lowerCamelCase: Tuple=None ): __SCREAMING_SNAKE_CASE : Tuple ...
112
"""simple docstring""" from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def _lowerCamelCase( a ): return getitem, k def _lowerCamelCase( a , a ): return setitem, k, v def _lowerCamelCase(...
261
0
"""simple docstring""" import random def _lowercase ( __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ) -> Union[str, Any]: SCREAMING_SNAKE_CASE__ : Optional[Any] = a[left_index] SCREAMING_SNAKE_CASE__ : List[Any] = le...
132
"""simple docstring""" import copy import re class snake_case__ : _snake_case : Dict = """hp""" _snake_case : List[str] = {} _snake_case : int = None @classmethod def a__ ( cls , lowerCamelCase , lowerCamelCase ): __a = prefix ...
261
0
"""simple docstring""" from argparse import ArgumentParser from . import BaseTransformersCLICommand def A ( snake_case__ ): '''simple docstring''' return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) class ...
165
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE__:int = logging.get_logger(__name__) class snake_case__ ( snake_case_ ): _snake_case : O...
261
0
from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_images, to_numpy_arra...
196
"""simple docstring""" def _lowerCamelCase( a = 1_0_0_0 ): __a = 3 __a = 0 while a < n: if a % 3 == 0 or a % 5 == 0: result += a elif a % 1_5 == 0: result -= a a += 1 return re...
261
0
"""simple docstring""" import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING fr...
74
"""simple docstring""" import operator def _lowerCamelCase( a , a = False , a = None ): __a = operator.lt if reverse else operator.gt __a = solution or [] if not arr: return solution __a = [arr.pop(0 )] for i, i...
261
0
"""simple docstring""" from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge UpperCAmelCase : int = [ """Prosecutor: \"No videos were used in the crash investigation\" German pa...
136
"""simple docstring""" import unittest from transformers import BertGenerationConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_co...
261
0
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin if is_torch_available(): import...
331
"""simple docstring""" # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from ...utils import deprecate from ..controlnet.multicontrolnet import MultiControlNetModel # noqa: F401 from ..controlnet.p...
261
0
'''simple docstring''' 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 ...
161
"""simple docstring""" import argparse import fairseq import torch from torch import nn from transformers import ( MBartaaTokenizer, MBartConfig, MBartForCausalLM, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaModel, log...
261
0
'''simple docstring''' def snake_case_ ( __SCREAMING_SNAKE_CASE : Optional[Any] , __SCREAMING_SNAKE_CASE : Optional[Any] , __SCREAMING_SNAKE_CASE : List[Any] ): """simple docstring""" lowercase_ : List[Any] = ...
93
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) SCREAMING_SNAKE_CASE__:str = { """configuration_trocr""": ["""TROCR_PRETRAINED_CO...
261
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Dict =logging.get_logger(__name__) _UpperCAmelCase : Any ={ """MIT/ast-finetuned-audioset-10-10-0.4593""": ( """https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/con...
262
import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Literal, NewType, Optio...
262
1
from datetime import datetime import requests def lowerCAmelCase ( lowerCAmelCase_ )-> bytes: lowerCAmelCase_ : Optional[Any] = '''https://downloadgram.net/wp-json/wppress/video-downloader/video?url=''' lowerCAmelCase_ : Union[str, Any] = requests.get(bas...
262
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 def lowerCAmelCase ( lowerCAmelCase...
262
1
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import enable_full_determin...
262
import unittest from transformers import JukeboxTokenizer from transformers.testing_utils import require_torch class snake_case__( unittest.TestCase ): '''simple docstring''' SCREAMING_SNAKE_CASE__ : Tuple = JukeboxTokenizer SCREAMING_SNAKE_CASE__ ...
262
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Tuple =logging.get_logger(__name__) _UpperCAmelCase : Union[str, Any] ={ """microsoft/markuplm-base""": """https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json""", """microsoft...
262
from __future__ import annotations import requests def lowerCAmelCase ( lowerCAmelCase_ )-> dict: lowerCAmelCase_ : List[Any] = f"""https://hacker-news.firebaseio.com/v0/item/{story_id}.json?print=pretty""" return requests.get(lowerCAmelCase_ ).json() def lo...
262
1
from __future__ import annotations _UpperCAmelCase : Union[str, Any] =list[tuple[int, int]] _UpperCAmelCase : Any =[ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0], [0...
262
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ) fro...
262
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : List[Any] =logging.get_logger(__name__) _UpperCAmelCase : List[str] ={ """funnel-transformer/small""": """https://huggingface.co/funnel-transformer/small/resolve/main/config.json""", """funnel-tr...
262
from typing import Union import fire import torch from tqdm import tqdm def lowerCAmelCase ( lowerCAmelCase_ , lowerCAmelCase_ = "cpu" , lowerCAmelCase_ = None )-> None: lowerCAmelCase_ : str = torch.load(lowerCAmelCase_ , map_location=low...
262
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCAmelCase : Any ={ """configuration_xlm_roberta_xl""": [ """XLM_ROBERTA_XL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMRobertaXLConfig""", """XLMRobertaXLOnnxCo...
262
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available() and is_transformers_version(""">=""", """4.25.0""")): raise OptionalDependencyNotAvail...
262
1
def lowerCAmelCase ( lowerCAmelCase_ = 100 )-> int: lowerCAmelCase_ : Any = n * (n + 1) * (2 * n + 1) / 6 lowerCAmelCase_ : Any = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__main__": print(f"""{soluti...
262
from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Optional[Any] =logging.get_logger(__name__) _UpperCAmelCase : str ={ """facebook/vit-mae-base""": """https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json""", # See all ViT MAE mo...
262
1
from __future__ import annotations import math def lowerCAmelCase ( lowerCAmelCase_ , lowerCAmelCase_ )-> float: lowerCAmelCase_ : Dict = u for i in range(1 , lowerCAmelCase_ ): lowerCAmelCase_ : Union[str, Any] = temp ...
262
def lowerCAmelCase ( lowerCAmelCase_ = 10**9 )-> int: lowerCAmelCase_ : List[Any] = 1 lowerCAmelCase_ : Optional[int] = 2 lowerCAmelCase_ : Any = 0 lowerCAmelCase_ : str = 0 lowerCAmelCase_ : str = 0 whi...
262
1
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Accelerator, Di...
262
import inspect import unittest class snake_case__( unittest.TestCase ): '''simple docstring''' def lowercase_ ( self ) -> int: try: import diffusers # noqa: F401 except ImportError: assert False d...
262
1
import warnings from transformers import AutoTokenizer from transformers.utils import is_torch_available from transformers.utils.generic import ExplicitEnum from ...processing_utils import ProcessorMixin if is_torch_available(): import torch class snake_case__( UpperCAmelCase__ ): ...
262
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor _UpperCAmelCase : Any =logging.get_logger(__name__) class snake_case__( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *__lowerc...
262
1
def lowerCAmelCase ( lowerCAmelCase_ = 10 , lowerCAmelCase_ = 1_000 , lowerCAmelCase_ = True )-> int: assert ( isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) and isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) ...
262
def lowerCAmelCase ( lowerCAmelCase_ )-> set: lowerCAmelCase_ : Optional[int] = set() # edges = list of graph's edges lowerCAmelCase_ : List[str] = get_edges(lowerCAmelCase_ ) # While there are still elements in edges list, take an arbitrary ed...
262
1
from __future__ import annotations import math class snake_case__: '''simple docstring''' def __init__( self , __lowercase ) -> None: lowerCAmelCase_ : str = size # approximate the overall size of segment tree with given value ...
262
from math import sqrt def lowerCAmelCase ( lowerCAmelCase_ )-> bool: assert isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) and ( number >= 0 ), "'number' must been an int and positive" lowerCAmelCase_ : List[Any] = True # 0 and 1 are ...
262
1
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor _UpperCAmelCase : Any =logging.get_logger(__name__) class snake_case__( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *__lowercase...
262
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 import TokenizerTesterMi...
262
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _UpperCAmelCase : Dict ={"""configuration_mbart""": ["""MBART_PRETRA...
262
import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY if is_...
262
1
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 snake_case__: '''simple docstring''' SCREAMING_SNAKE_CASE__ : ...
262
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassifica...
262
1
import math def lowerCAmelCase ( lowerCAmelCase_ )-> 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, all even numbers, all multiples of 3 are not primes return False...
262
from __future__ import annotations from typing import Dict from ...configuration_utils import PretrainedConfig _UpperCAmelCase : Dict ={ """susnato/ernie-m-base_pytorch""": """https://huggingface.co/susnato/ernie-m-base_pytorch/blob/main/config.json""", """susnato/ernie-m-large_pytorch""": """https...
262
1
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
262
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import to...
262
1
import json import os import shutil import tempfile from unittest import TestCase from transformers import BartTokenizer, BartTokenizerFast, DPRQuestionEncoderTokenizer, DPRQuestionEncoderTokenizerFast from transformers.models.bart.configuration_bart import BartConfig from transformers.models.bert.tokenization_bert...
262
from __future__ import annotations import math class snake_case__: '''simple docstring''' def __init__( self , __lowercase ) -> None: lowerCAmelCase_ : str = size # approximate the overall size of segment tree with given value ...
262
1
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() def lowerCAmelCase ...
262
import argparse import collections import os import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_table.py _UpperCAmelCase : Optional[int] ="""src/transformers""" _Up...
262
1
import os def lowerCAmelCase ( lowerCAmelCase_ = "input.txt" )-> int: with open(os.path.join(os.path.dirname(lowerCAmelCase_ ) , lowerCAmelCase_ ) ) as input_file: lowerCAmelCase_ : Union[str, Any] = [ [int(lowerCAmelCase_ ...
262
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFCommand from...
262
1