code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' from typing import Any def snake_case__ ( UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,) -> list: _validation( UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,UpperCamel...
683
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> list: _UpperCamelCase : Any = False while is_sorted is False: # Until all the indices are traversed keep looping _UpperCamelCase : List[str] = True for i in range(0 ,len(UpperCamelCase ...
683
1
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionPa...
683
'''simple docstring''' import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae_att...
683
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.pipelines.conversational import Conversa...
683
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase ( a_ ): """simple docstring""" A__ : str = ['image_processor', 'tokenizer'] A__ : Dict = 'CLIPImageProcessor...
683
1
'''simple docstring''' _UpperCAmelCase : str = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : str = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : List[str] = { 0: """Sunday""", 1: """Monday""", 2: """Tuesday""", 3: """Wednesday""", 4: """Thursday""", 5:...
683
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters _UpperCAmelCase : Union[str, Any] = (720, 1280) # Height, Width _UpperCAmelCase : str = (0.4, 0.6) # if height or width lower than this scale, drop it. ...
683
1
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters _UpperCAmelCase : Union[str, Any] = (720, 1280) # Height, Width _UpperCAmelCase : str = (0.4, 0.6) # if height or width lower than this scale, drop it. ...
683
'''simple docstring''' from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class UpperCA...
683
1
'''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 ImageProcessingSavingTestMixin, prepare_...
683
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
683
1
'''simple docstring''' import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, s...
683
'''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_transform from transforme...
683
1
'''simple docstring''' _UpperCAmelCase : Any = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100000)] def snake_case__ ( UpperCamelCase ) -> int: _UpperCamelCase : Any = 0 while number: # Increased Speed Slightly by checking every 5 digits together....
683
'''simple docstring''' _UpperCAmelCase : Any = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100000)] def snake_case__ ( UpperCamelCase ) -> int: _UpperCamelCase : Any = 0 while number: # Increased Speed Slightly by checking every 5 digits together....
683
1
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase ( a_ ): """simple docstring""" A__ : str = ['image_processor', 'tokenizer'] A__ : Dict = 'CLIPImageProcessor...
683
'''simple docstring''' _UpperCAmelCase : str = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : str = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : List[str] = { 0: """Sunday""", 1: """Monday""", 2: """Tuesday""", 3: """Wednesday""", 4: """Thursday""", 5:...
683
1
'''simple docstring''' # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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 # # Unle...
683
'''simple docstring''' import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, s...
683
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : int = logging.get_logger(__name__) _UpperCAmelCase : int = { """facebook/timesformer""": """https://huggingface.co/facebook/timesformer/resolve/main/config.json""", } class...
683
'''simple docstring''' # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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 # # Unle...
683
1
'''simple docstring''' import argparse import collections import json import os import re import string import sys import numpy as np _UpperCAmelCase : Optional[Any] = re.compile(R"""\b(a|an|the)\b""", re.UNICODE) _UpperCAmelCase : Tuple = None def snake_case__ ( ) -> Any: ...
683
'''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 ...
683
1
'''simple docstring''' import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...ut...
683
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil _UpperCAmelCase : int = 100 _UpperCAmelCase : List[Any] = set(range(3, NUM_PRIMES, 2)) primes.add(2) _UpperCAmelCase : int for prime in range(3, ceil(NUM_PRIMES**0.5), 2): if prime no...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> str: if isinstance(UpperCamelCase ,UpperCamelCase ): raise TypeError('''\'float\' object cannot be interpreted as an integer''' ) if isinstance(UpperCamelCase ,UpperCamelCase ): raise TypeError('''\...
683
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformer...
683
1
'''simple docstring''' import argparse import os from pathlib import Path import torch from bark.generation import _load_model as _bark_load_model from huggingface_hub import hf_hub_download from transformers import EncodecConfig, EncodecModel, set_seed from transformers.models.bark.configuration_bark import ( ...
683
'''simple docstring''' from collections.abc import Iterable from typing import Any class UpperCAmelCase : """simple docstring""" def __init__( self , _snake_case = None ) -> Optional[int]: _UpperCamelCase : int = value _UpperCamelCase : Node | ...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ,UpperCamelCase ) -> float: return base * power(UpperCamelCase ,(exponent - 1) ) if exponent else 1 if __name__ == "__main__": print("""Raise base to the power of exponent using recursion...""") _UpperCAmelCase : str ...
683
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast from ...utils import logging if TYPE_CHECKING: from ...feature_extraction_utils i...
683
1
'''simple docstring''' import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin from .feature_extraction_wavaveca import WavaVecaFeatureExtractor from .tokenization_wavaveca import WavaVecaCTCTokenizer class UpperCAmelCase ( a_ ): """simple docstr...
683
'''simple docstring''' import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": _UpperCAmelCase : Tuple = argparse.ArgumentParser( description=( """Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transf...
683
1
'''simple docstring''' import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class UpperCAmelCase ( unittest.TestCase ): ""...
683
'''simple docstring''' import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( Fla...
683
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, r...
683
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) _UpperCAmelCase : Optional[int] = pytest.mark.integration @pytest.mark.para...
683
1
'''simple docstring''' from __future__ import annotations _UpperCAmelCase : Optional[int] = list[tuple[int, int]] _UpperCAmelCase : Optional[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...
683
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device fr...
683
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : List[str] = logging.get_logger(__name__) _UpperCAmelCase : Dict = {"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/config.json"""} class UpperCAmelCas...
683
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available _UpperCAmelCase : Tuple = { """configuration_longt5""": ["""LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LongT5Config""", """LongT5OnnxConfig"""...
683
1
'''simple docstring''' import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": _UpperCAmelCase : Tuple = argparse.ArgumentParser( description=( """Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transf...
683
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer _UpperCAmelCase : Optional[int] = logging.get_...
683
1
'''simple docstring''' from __future__ import annotations from dataclasses import dataclass @dataclass class UpperCAmelCase : """simple docstring""" A__ : float A__ : TreeNode | None = None A__ : TreeNode | None = None def snake_case__ ( UpperCamelCase ...
683
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> list: _UpperCamelCase : Any = False while is_sorted is False: # Until all the indices are traversed keep looping _UpperCamelCase : List[str] = True for i in range(0 ,len(UpperCamelCase ...
683
1
'''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, ) _UpperCAmelCase : str = { """configurati...
683
'''simple docstring''' import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae_att...
683
1
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
683
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase ( a_ ): """simple docstring""" A__ : str = ['image_processor', 'tokenizer'] A__ : Dict = 'CLIPImageProcessor...
683
1
'''simple docstring''' import argparse import logging import os import time import timeit import datasets import numpy as np import pycuda.autoinit # noqa: F401 import pycuda.driver as cuda import tensorrt as trt import torch from absl import logging as absl_logging from accelerate import Accelerator from datasets ...
683
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters _UpperCAmelCase : Union[str, Any] = (720, 1280) # Height, Width _UpperCAmelCase : str = (0.4, 0.6) # if height or width lower than this scale, drop it. ...
683
1
'''simple docstring''' import torch from diffusers import EulerDiscreteScheduler from diffusers.utils import torch_device from .test_schedulers import SchedulerCommonTest class UpperCAmelCase ( a_ ): """simple docstring""" A__ : Union[str, Any] = (EulerDiscreteScheduler,) A...
683
'''simple docstring''' from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class UpperCA...
683
1
'''simple docstring''' # tests directory-specific settings - this file is run automatically # by pytest before any tests are run import doctest import sys import warnings from os.path import abspath, dirname, join import _pytest from transformers.testing_utils import HfDoctestModule, HfDocTestParser # allow havi...
683
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ,UpperCamelCase ) -> int: _UpperCamelCase : Tuple = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): _UpperCamelCase : List[str] = n - k # Calculate C(n,k) for i in ...
683
'''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_transform from transforme...
683
1
'''simple docstring''' from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration _UpperCAmelCase : List[Any] = HfArgumentParser(InitializationArguments) _UpperCAmelCase : Tuple = parser.parse_args() # Lo...
683
'''simple docstring''' _UpperCAmelCase : Any = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100000)] def snake_case__ ( UpperCamelCase ) -> int: _UpperCamelCase : Any = 0 while number: # Increased Speed Slightly by checking every 5 digits together....
683
1
'''simple docstring''' import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ...test_modeling_fla...
683
'''simple docstring''' _UpperCAmelCase : str = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : str = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : List[str] = { 0: """Sunday""", 1: """Monday""", 2: """Tuesday""", 3: """Wednesday""", 4: """Thursday""", 5:...
683
1
'''simple docstring''' import argparse import logging import sys from unittest.mock import patch import run_glue_deebert from transformers.testing_utils import TestCasePlus, get_gpu_count, require_torch_non_multi_gpu, slow logging.basicConfig(level=logging.DEBUG) _UpperCAmelCase : Optional[Any] = logging...
683
'''simple docstring''' import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, s...
683
1
'''simple docstring''' import json import os import re import unittest from transformers import CodeGenTokenizer, CodeGenTokenizerFast from transformers.models.codegen.tokenization_codegen import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common impor...
683
'''simple docstring''' # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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 # # Unle...
683
1
'''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_transform from transforme...
683
'''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 ...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase = 1_00_00_00 ) -> int: _UpperCamelCase : int = [i - 1 for i in range(limit + 1 )] for i in range(2 ,limit + 1 ): if phi[i] == i - 1: for j in range(2 * i ,limit + 1 ,UpperCamelCase )...
683
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil _UpperCAmelCase : int = 100 _UpperCAmelCase : List[Any] = set(range(3, NUM_PRIMES, 2)) primes.add(2) _UpperCAmelCase : int for prime in range(3, ceil(NUM_PRIMES**0.5), 2): if prime no...
683
1
'''simple docstring''' from __future__ import annotations _UpperCAmelCase : Union[str, Any] = [True] * 1000001 _UpperCAmelCase : Optional[Any] = 2 while i * i <= 1000000: if seive[i]: for j in range(i * i, 1000001, i): _UpperCAmelCase : List[Any] = False i += 1 def snake_cas...
683
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformer...
683
1
'''simple docstring''' from math import pi, sqrt, tan def snake_case__ ( UpperCamelCase ) -> float: if side_length < 0: raise ValueError('''surface_area_cube() only accepts non-negative values''' ) return 6 * side_length**2 def snake_case__ ( UpperCamelCase ...
683
'''simple docstring''' from collections.abc import Iterable from typing import Any class UpperCAmelCase : """simple docstring""" def __init__( self , _snake_case = None ) -> Optional[int]: _UpperCamelCase : int = value _UpperCamelCase : Node | ...
683
1
'''simple docstring''' # Copyright 2022 The HuggingFace Team and The OpenBMB 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...
683
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast from ...utils import logging if TYPE_CHECKING: from ...feature_extraction_utils i...
683
1
'''simple docstring''' import json import sys def snake_case__ ( UpperCamelCase ,UpperCamelCase ) -> Any: with open(UpperCamelCase ,encoding='''utf-8''' ) as f: _UpperCamelCase : Tuple = json.load(UpperCamelCase ) _UpperCamelCase : Optional...
683
'''simple docstring''' import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": _UpperCAmelCase : Tuple = argparse.ArgumentParser( description=( """Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transf...
683
1
'''simple docstring''' import math def snake_case__ ( 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, all even numbers, all multiples of 3 are not primes return False...
683
'''simple docstring''' import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( Fla...
683
1
'''simple docstring''' import argparse from transformers import BigBirdConfig, BigBirdForPreTraining, BigBirdForQuestionAnswering, load_tf_weights_in_big_bird from transformers.utils import logging logging.set_verbosity_info() def snake_case__ ( UpperCamelCase ,UpperCamelCase ,UpperCame...
683
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) _UpperCAmelCase : Optional[int] = pytest.mark.integration @pytest.mark.para...
683
1
'''simple docstring''' import math def snake_case__ ( 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, all even numbers, all multiples of 3 are not primes return False...
683
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device fr...
683
1
'''simple docstring''' import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class UpperCAmelCase ( unittest.TestCase ): """simple docstring""" def _lowercase ( self ) -> Union[str, A...
683
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available _UpperCAmelCase : Tuple = { """configuration_longt5""": ["""LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LongT5Config""", """LongT5OnnxConfig"""...
683
1
'''simple docstring''' import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from transformers.generation import DisjunctiveConstraint @require_torch class UpperCAmelCase ( unittest.TestCase ): ...
683
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer _UpperCAmelCase : Optional[int] = logging.get_...
683
1
'''simple docstring''' import importlib.metadata from typing import Union from packaging.version import Version, parse from .constants import STR_OPERATION_TO_FUNC _UpperCAmelCase : List[str] = parse(importlib.metadata.version("""torch""")) def snake_case__ ( UpperCamelCase ,UpperCa...
683
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> list: _UpperCamelCase : Any = False while is_sorted is False: # Until all the indices are traversed keep looping _UpperCamelCase : List[str] = True for i in range(0 ,len(UpperCamelCase ...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> Dict: _UpperCamelCase : str = [] _UpperCamelCase : List[Any] = [] _UpperCamelCase : str = { '''^''': 3, '''*''': 2, '''/''': 2, '''%''': 2, '''+''': 1, ...
683
'''simple docstring''' import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae_att...
683
1
'''simple docstring''' import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.transfo_xl.tokenization_trans...
683
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase ( a_ ): """simple docstring""" A__ : str = ['image_processor', 'tokenizer'] A__ : Dict = 'CLIPImageProcessor...
683
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) _UpperCAmelCase : List[str] = { """microsoft/trocr-base-handwritten""": ( """https://huggingface.co/microsoft/trocr-ba...
683
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters _UpperCAmelCase : Union[str, Any] = (720, 1280) # Height, Width _UpperCAmelCase : str = (0.4, 0.6) # if height or width lower than this scale, drop it. ...
683
1
'''simple docstring''' import copy import re class UpperCAmelCase : """simple docstring""" A__ : List[Any] = 'hp' A__ : List[Any] = {} A__ : Any = None @classmethod def _lowercase ( cls , _snake_case , _snake_case ) -> List[str]: _Uppe...
683
'''simple docstring''' from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class UpperCA...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> int: return 1 if digit in (0, 1) else (digit * factorial(digit - 1 )) def snake_case__ ( UpperCamelCase ) -> bool: _UpperCamelCase : int = 0 _UpperCamelCase : int = numbe...
683
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
683
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase : int = logging.get_logger(__name__) _UpperCAmelCase : Any = { """bert-base-unca...
683
'''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_transform from transforme...
683
1
'''simple docstring''' from ..utils import is_flax_available, is_torch_available if is_torch_available(): from .autoencoder_kl import AutoencoderKL from .controlnet import ControlNetModel from .dual_transformer_ad import DualTransformeraDModel from .modeling_utils import ModelMixin from .prior_transformer impo...
683
'''simple docstring''' _UpperCAmelCase : Any = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100000)] def snake_case__ ( UpperCamelCase ) -> int: _UpperCamelCase : Any = 0 while number: # Increased Speed Slightly by checking every 5 digits together....
683
1
'''simple docstring''' from __future__ import annotations import math def snake_case__ ( UpperCamelCase ,UpperCamelCase ) -> float: _UpperCamelCase : Optional[Any] = u for i in range(1 ,UpperCamelCase ): _UpperCamelCase : Optional[int] = t...
683
'''simple docstring''' _UpperCAmelCase : str = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : str = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : List[str] = { 0: """Sunday""", 1: """Monday""", 2: """Tuesday""", 3: """Wednesday""", 4: """Thursday""", 5:...
683
1
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import is_flaky, 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_to...
683
'''simple docstring''' import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, s...
683
1
'''simple docstring''' import unittest from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available from transformers.pipelines import pipeline from transformers.pipelines.document_question_answering import apply_tesseract from transformers.testing_utils import ( is_...
683
'''simple docstring''' # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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 # # Unle...
683
1
'''simple docstring''' from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class UpperCAmelCase ( a_ ): ...
683
'''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 ...
683
1
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast from ...utils import logging if TYPE_CHECKING: from ...feature_extraction_utils i...
683
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil _UpperCAmelCase : int = 100 _UpperCAmelCase : List[Any] = set(range(3, NUM_PRIMES, 2)) primes.add(2) _UpperCAmelCase : int for prime in range(3, ceil(NUM_PRIMES**0.5), 2): if prime no...
683
1
'''simple docstring''' import copy from typing import Dict, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING from ..detr import DetrConfig from ..swin import SwinConfig _UpperCAmelCase : Union[str, Any] = { """facebook/maskforme...
683
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformer...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> bool: _UpperCamelCase : Optional[Any] = [int(UpperCamelCase ) for i in ip_va_address.split('''.''' ) if i.isdigit()] return len(UpperCamelCase ) == 4 and all(0 <= int(UpperCamelCase ) <= 2_54 for oc...
683
'''simple docstring''' from collections.abc import Iterable from typing import Any class UpperCAmelCase : """simple docstring""" def __init__( self , _snake_case = None ) -> Optional[int]: _UpperCamelCase : int = value _UpperCamelCase : Node | ...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase = "The quick brown fox jumps over the lazy dog" ,) -> bool: _UpperCamelCase : Any = set() # Replace all the whitespace in our sentence _UpperCamelCase : str = input_str.replace(''' ''' ,'''''' ) ...
683
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast from ...utils import logging if TYPE_CHECKING: from ...feature_extraction_utils i...
683
1
'''simple docstring''' from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class UpperCAmelCase : """simple docstring""" A__ : int A__ : TreeNode | None = None A__ : TreeNode | None = None _UpperCAmelCase...
683
'''simple docstring''' import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": _UpperCAmelCase : Tuple = argparse.ArgumentParser( description=( """Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transf...
683
1
'''simple docstring''' from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def snake_case__ ( ) -> Dict: _UpperCamelCase : int = HfArgumentParser(UpperCamelCase ) _UpperCamelCase : Dict = parser.parse_args_into_datacla...
683
'''simple docstring''' import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( Fla...
683
1
'''simple docstring''' from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=a_ ) class UpperCAmelCase ( a_ ): """simple docstring""" A__ : str = field(default='langu...
683
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) _UpperCAmelCase : Optional[int] = pytest.mark.integration @pytest.mark.para...
683
1
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig _UpperCAmelCase : int = logging.get_logger(__name__) _UpperCAmelCase : Optional[Any] = { """Intel/dpt-large""": """https://huggingface.co/Intel/dpt-la...
683
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device fr...
683
1
'''simple docstring''' _UpperCAmelCase : Any = { """a""": """AAAAA""", """b""": """AAAAB""", """c""": """AAABA""", """d""": """AAABB""", """e""": """AABAA""", """f""": """AABAB""", """g""": """AABBA""", """h""": """AABBB""", """i""": """ABAAA""", """j""": """BBBAA""", ...
683
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available _UpperCAmelCase : Tuple = { """configuration_longt5""": ["""LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LongT5Config""", """LongT5OnnxConfig"""...
683
1
'''simple docstring''' from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def snake_case__ ( UpperCamelCase = True ,*UpperCamelCase ,**UpperCamelCase ) -> List[str]: if not is_tqdm_available(): ...
683
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer _UpperCAmelCase : Optional[int] = logging.get_...
683
1
'''simple docstring''' import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase : Optional[int] = logging.get_logger(__name__) _UpperCAmelCase :...
683
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> list: _UpperCamelCase : Any = False while is_sorted is False: # Until all the indices are traversed keep looping _UpperCamelCase : List[str] = True for i in range(0 ,len(UpperCamelCase ...
683
1
'''simple docstring''' import numpy as np def snake_case__ ( UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,UpperCamelCase ) -> Optional[Any]: _UpperCamelCase : Optional[int] = int(np.ceil((x_end - xa) / h ) ) _UpperCamelCase ...
683
'''simple docstring''' import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae_att...
683
1
'''simple docstring''' _UpperCAmelCase : dict[str, float] = { "joule": 1.0, "kilojoule": 1000, "megajoule": 1000000, "gigajoule": 1000000000, "wattsecond": 1.0, "watthour": 3600, "kilowatthour": 3600000, "newtonmeter": 1.0, "calorie_nutr": 4186.8, "kilocalorie_nutr": 41...
683
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase ( a_ ): """simple docstring""" A__ : str = ['image_processor', 'tokenizer'] A__ : Dict = 'CLIPImageProcessor...
683
1
'''simple docstring''' import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger _UpperCAmelCase : Optional[Any] = get_logger(__name__) class UpperCAmelCase ( enum.Enum ): """simple docstring""" A__ : ...
683
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters _UpperCAmelCase : Union[str, Any] = (720, 1280) # Height, Width _UpperCAmelCase : str = (0.4, 0.6) # if height or width lower than this scale, drop it. ...
683
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_funnel import FunnelTokenizer _UpperCAmelCase : Optional[Any] = logging.get_logger(_...
683
'''simple docstring''' from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class UpperCA...
683
1
'''simple docstring''' import argparse from collections import OrderedDict from pathlib import Path import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision.transforms import functional as F from transformers import DetrImageProcessor, TableTransformerConfig, TableTransformerF...
683
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
683
1
'''simple docstring''' from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..im...
683
'''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_transform from transforme...
683
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _UpperCAmelCase : Optional[Any] = { """configuration_blip""": [ """BLIP_PRETRAINED_CONFIG_A...
683
'''simple docstring''' _UpperCAmelCase : Any = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100000)] def snake_case__ ( UpperCamelCase ) -> int: _UpperCamelCase : Any = 0 while number: # Increased Speed Slightly by checking every 5 digits together....
683
1
'''simple docstring''' import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from tr...
683
'''simple docstring''' _UpperCAmelCase : str = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : str = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : List[str] = { 0: """Sunday""", 1: """Monday""", 2: """Tuesday""", 3: """Wednesday""", 4: """Thursday""", 5:...
683
1
'''simple docstring''' import qiskit def snake_case__ ( UpperCamelCase ,UpperCamelCase ) -> qiskit.result.counts.Counts: _UpperCamelCase : Tuple = qiskit.Aer.get_backend('''aer_simulator''' ) # Create a Quantum Circuit acting on the q register _UpperCamelCase ...
683
'''simple docstring''' import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, s...
683
1
'''simple docstring''' from __future__ import annotations from decimal import Decimal from numpy import array def snake_case__ ( UpperCamelCase ) -> list[list[float]]: _UpperCamelCase : Any = Decimal # Check if the provided matrix has 2 rows and 2 columns # since this...
683
'''simple docstring''' # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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 # # Unle...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> list[list[float]]: _UpperCamelCase : list[list[float]] = [] for data in source_data: for i, el in enumerate(UpperCamelCase ): if len(UpperCamelCase ) < i + 1: data_lists.append([] ) ...
683
'''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 ...
683
1
'''simple docstring''' import logging import os from typing import Dict, List, Optional, Union import torch import torch.nn as nn from accelerate.utils.imports import ( is_abit_bnb_available, is_abit_bnb_available, is_bnb_available, ) from ..big_modeling import dispatch_model, init_empty_weights from ....
683
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil _UpperCAmelCase : int = 100 _UpperCAmelCase : List[Any] = set(range(3, NUM_PRIMES, 2)) primes.add(2) _UpperCAmelCase : int for prime in range(3, ceil(NUM_PRIMES**0.5), 2): if prime no...
683
1
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING _UpperCAmelCase : Optional[Any] = logging.get_logger(__name__) class UpperCAmelCase ( a_ ): """simple docstring"...
683
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformer...
683
1
'''simple docstring''' import copy 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 ..auto import CONFIG_MAPPING _UpperCAmelCase : List[str] = lo...
683
'''simple docstring''' from collections.abc import Iterable from typing import Any class UpperCAmelCase : """simple docstring""" def __init__( self , _snake_case = None ) -> Optional[int]: _UpperCamelCase : int = value _UpperCamelCase : Node | ...
683
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase : int = logging.get_logger(__name__) _UpperCAmelCase : int = { """tanreinama/GPTSAN-2.8B-spout_is_uniform""": ( """https://huggingface.co/tanreinama/GPTSAN-2.8B-spout_...
683
'''simple docstring''' from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast from ...utils import logging if TYPE_CHECKING: from ...feature_extraction_utils i...
683
1
'''simple docstring''' _UpperCAmelCase : Any = [0, 2, 4, 6, 8] _UpperCAmelCase : Optional[int] = [1, 3, 5, 7, 9] def snake_case__ ( UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,UpperCamelCase ) -> int: if remaining_length == 0: if digits[0] == 0 or di...
683
'''simple docstring''' import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": _UpperCAmelCase : Tuple = argparse.ArgumentParser( description=( """Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transf...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ,UpperCamelCase ) -> float: return price * (1 + tax_rate) if __name__ == "__main__": print(f"""{price_plus_tax(100, 0.25) = }""") print(f"""{price_plus_tax(125.50, 0.05) = }""")
683
'''simple docstring''' import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( Fla...
683
1
'''simple docstring''' import json import os from typing import Dict, List, Optional, Tuple from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase : Any = logging.get_logger(__name__) _UpperCAmelCase : int = { """vocab_file""": """vocab.json""", ...
683
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) _UpperCAmelCase : Optional[int] = pytest.mark.integration @pytest.mark.para...
683
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _UpperCAmelCase : List[Any] = logging.get_logger(__name__) _UpperCAmelCase : List[str] = { ...
683
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device fr...
683
1
'''simple docstring''' from typing import List, Optional, Union import numpy as np import tensorflow as tf from .utils import logging _UpperCAmelCase : Optional[Any] = logging.get_logger(__name__) def snake_case__ ( UpperCamelCase ) -> List[int]: if isinstance(UpperCamelCase ...
683
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available _UpperCAmelCase : Tuple = { """configuration_longt5""": ["""LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LongT5Config""", """LongT5OnnxConfig"""...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase = 10_00 ) -> int: return sum(2 * a * ((a - 1) // 2) for a in range(3 ,n + 1 ) ) if __name__ == "__main__": print(solution())
683
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer _UpperCAmelCase : Optional[int] = logging.get_...
683
1
'''simple docstring''' from datetime import datetime as dt import os from github import Github _UpperCAmelCase : List[str] = [ """good first issue""", """good second issue""", """good difficult issue""", """feature request""", """new model""", """wip""", ] def snake_case_...
683
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> list: _UpperCamelCase : Any = False while is_sorted is False: # Until all the indices are traversed keep looping _UpperCamelCase : List[str] = True for i in range(0 ,len(UpperCamelCase ...
683
1
'''simple docstring''' from multiprocessing import Lock, Pipe, Process # lock used to ensure that two processes do not access a pipe at the same time _UpperCAmelCase : List[Any] = Lock() def snake_case__ ( UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,U...
683
'''simple docstring''' import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae_att...
683
1
'''simple docstring''' def snake_case__ ( ) -> Tuple: _UpperCamelCase : Optional[Any] = [] _UpperCamelCase : str = 1 while len(UpperCamelCase ) < 1e6: constant.append(str(UpperCamelCase ) ) i += 1 _UpperCamelCase : Optional[Any] =...
683
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase ( a_ ): """simple docstring""" A__ : str = ['image_processor', 'tokenizer'] A__ : Dict = 'CLIPImageProcessor...
683
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mvp import Mvp...
683
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters _UpperCAmelCase : Union[str, Any] = (720, 1280) # Height, Width _UpperCAmelCase : str = (0.4, 0.6) # if height or width lower than this scale, drop it. ...
683
1
'''simple docstring''' from __future__ import annotations import typing from collections import Counter def snake_case__ ( UpperCamelCase ) -> typing.Counter[int]: _UpperCamelCase : typing.Counter[int] = Counter() for base in range(1 ,max_perimeter + 1 ): fo...
683
'''simple docstring''' from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class UpperCA...
683
1
'''simple docstring''' from __future__ import annotations from random import random class UpperCAmelCase : """simple docstring""" def __init__( self , _snake_case = None ) -> Optional[Any]: _UpperCamelCase : Dict = value _UpperCamelCase : Dict...
683
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unl...
683
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _UpperCAmelCase : Union[str, Any] = { """configuration_mobilevit""": ["""MOBILEVIT_PRETRAINED_CONFI...
683
'''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_transform from transforme...
683
1
'''simple docstring''' _UpperCAmelCase : str = range(2, 20 + 1) _UpperCAmelCase : Dict = [10**k for k in range(ks[-1] + 1)] _UpperCAmelCase : dict[int, dict[int, list[list[int]]]] = {} def snake_case__ ( UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,UpperCame...
683
'''simple docstring''' _UpperCAmelCase : Any = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100000)] def snake_case__ ( UpperCamelCase ) -> int: _UpperCamelCase : Any = 0 while number: # Increased Speed Slightly by checking every 5 digits together....
683
1
'''simple docstring''' import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae_att...
683
'''simple docstring''' _UpperCAmelCase : str = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : str = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : List[str] = { 0: """Sunday""", 1: """Monday""", 2: """Tuesday""", 3: """Wednesday""", 4: """Thursday""", 5:...
683
1
'''simple docstring''' import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging _UpperCAmelCase : Optional[int] = logging.get_logger(__name__) def snake_case__ ( UpperCamelCase ,UpperCamelCase ) -> ...
683
'''simple docstring''' import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, s...
683
1
'''simple docstring''' import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _UpperCAmelCase : Optional[int] = logging.get_logger(__name__) _UpperCAmelCase : Optional[Any] = { """vocab_fil...
683
'''simple docstring''' # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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 # # Unle...
683
1
'''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 ...
683
'''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 ...
683
1