code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' pass class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' pass class UpperCAmelCase : '''simple docstring''' def __init__( self : ...
366
from typing import TYPE_CHECKING from ..utils import _LazyModule UpperCAmelCase__ : Tuple = { 'config': [ 'EXTERNAL_DATA_FORMAT_SIZE_LIMIT', 'OnnxConfig', 'OnnxConfigWithPast', 'OnnxSeq2SeqConfigWithPast', 'PatchingSpec', ], 'convert': ['export',...
301
0
import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput def lowerCamelCase__ ...
367
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' __UpperCamelCase : Any = (DDPMParallelScheduler,) def __magic_name__ ( self : ...
301
0
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 TokenizerTesterMixi...
368
import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokeni...
301
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase__ : Optional[int] = { 'configuration_bigbird_pegasus': [ 'BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BigBirdPegasusConfig', 'BigBir...
369
def lowerCamelCase__ ( a = 10**9 ) -> int: _A: Dict = 1 _A: Union[str, Any] = 2 _A: List[str] = 0 _A: List[Any] = 0 _A: int = 0 while perimeter <= max_perimeter: perimeters_sum += perimeter prev_value += 2 * value value +...
301
0
import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu, calculate_rouge, chunks, pars...
370
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase__ : Union[str, Any] = { 'configuration_roc_bert': ['ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'RoCBertConfig'], 'tokenization_roc_ber...
301
0
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingStrategy, logging from .tokenization_realm import RealmTok...
371
import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput def lowerCamelCase__ ...
301
0
"""simple docstring""" import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorTy...
350
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, Features, Value from .base import TaskTemplate @dataclass(frozen=SCREAMING_SNAKE_CASE__ ) class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' ...
301
0
"""simple docstring""" import unittest import numpy as np from transformers import MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING, TF_MODEL_FOR_AUDIO_CLASSIFICATION_MAPPING from transformers.pipelines import AudioClassificationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_s...
351
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 transformers from transformers impo...
301
0
"""simple docstring""" import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin UpperCAmelCase__ : Any = ...
352
from __future__ import annotations UpperCAmelCase__ : List[str] = list[list[int]] # assigning initial values to the grid UpperCAmelCase__ : Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0]...
301
0
class UpperCAmelCase : # Public class to implement a graph '''simple docstring''' def __init__( self : int , lowerCAmelCase_ : int , lowerCAmelCase_ : int , lowerCAmelCase_ : list[list[bool]] ): """simple docstring""" ...
353
# This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for tests from os.path import join ...
301
0
import argparse from collections import defaultdict def lowerCamelCase__ ( a , a , a , a , a ) -> Union[str, Any]: _A: Union[str, Any] = f"""{file}_{class_name}_{test_name}""" done_test[_id] += 1 with open(a , '''r''' ) as f: _A: List[Any] = f.read...
354
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_flax_common import FlaxMode...
301
0
import inspect import os import unittest from dataclasses import dataclass import torch from accelerate import Accelerator, DistributedDataParallelKwargs, GradScalerKwargs from accelerate.state import AcceleratorState from accelerate.test_utils import execute_subprocess_async, require_cuda, require_multi_gpu from ac...
355
from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' def __lt__( self : Dict , lowerCAmelCase_ :...
301
0
from __future__ import annotations import unittest from transformers import LEDConfig, 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 from ...test_pipeline_mixin impor...
356
import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu, calculate_rouge, chunks, pars...
301
0
import os def lowerCamelCase__ ( a = "matrix.txt" ) -> int: with open(os.path.join(os.path.dirname(a ) , a ) ) as in_file: _A: List[str] = in_file.read() _A: Dict = [[int(a ) for cell in row.split(''',''' )] for row in data.strip().splitlines()] ...
357
import math import random from typing import Any from .hill_climbing import SearchProblem def lowerCamelCase__ ( a , a = True , a = math.inf , a = -math.inf , a = math.inf , a = -math.inf , a = False , a = 1_00 , a = 0.01 , a = 1 , ) -> Any: _A: Optional[Any] = Fa...
301
0
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, Stabl...
358
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : Union[str, Any] = logging.get_logger(__name__) UpperCAmelCase__ : List[Any] = { 'vo...
301
0
from timeit import timeit UpperCAmelCase__ : Optional[Any] = { 'MALAYALAM': True, 'String': False, 'rotor': True, 'level': True, 'A': True, 'BB': True, 'ABC': False, 'amanaplanacanalpanama': True, # "a man a plan a canal panama" } # Ensure our test data is valid asse...
359
import os from pathlib import Path def lowerCamelCase__ ( ) -> Optional[Any]: from torch.utils.cpp_extension import load _A: str = Path(a ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' _A: Tuple = [ root / filename for filename...
301
0
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DiffusionPipeline, EulerDiscreteScheduler, StableDiffusionXLImgaImgPipeline, UNetaDCond...
360
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class UpperCAmelCase ( ...
301
0
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ : List[str] = logging.get_logger(__name__) UpperCAmelCase__ : Union[str, Any] = { 'facebook/dpr-ctx_encoder-single-nq-base': ( 'https://huggingface.co/facebook/dpr-ctx_en...
361
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__ : Tuple = logging.get_logger(__name__) UpperCAmelCase__ : Union[str, ...
301
0
def lowerCamelCase__ ( a = 10_00 ) -> int: _A: Tuple = -1 _A: Optional[Any] = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c _A: str = (n * n - 2 * a * n) // (2 * n - 2 * a) _A: str ...
362
import argparse import json import os from tensorflow.core.protobuf.saved_model_pba import SavedModel # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py UpperCAmelCase__ : Any = '.' # Internal TensorFlow ops tha...
301
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ : List[Any] = logging.get_logger(__name__) UpperCAmelCase__ : Optional[int] = { 'tiiuae/falcon-40b': 'https://huggingface.co/tiiuae/falcon-40b/resolve/...
363
import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : int = logging.get_logger(__name__) UpperCAmelCase__ : Union[str, Any] = { 'vocab_file': 'vocab.j...
301
0
from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: from ...utils.dumm...
364
def lowerCamelCase__ ( a = 10 ) -> str: if not isinstance(a , a ) or n < 0: raise ValueError('''Invalid input''' ) _A: int = 10**n _A: List[Any] = 2_84_33 * (pow(2 , 7_83_04_57 , a )) + 1 return str(number % modulus ) if __name__ == "__main__": ...
301
0
from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def lowerCamelCase__ ( a ) -> Optional[Any]: return getitem, k def lowerCamelCase__ ( a , a ) -> int: return setitem, k, v def lowerCam...
365
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ConfigTes...
301
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings UpperCAmelCase__ : Tuple = R'\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n can be used to control the model ...
366
from typing import TYPE_CHECKING from ..utils import _LazyModule UpperCAmelCase__ : Tuple = { 'config': [ 'EXTERNAL_DATA_FORMAT_SIZE_LIMIT', 'OnnxConfig', 'OnnxConfigWithPast', 'OnnxSeq2SeqConfigWithPast', 'PatchingSpec', ], 'convert': ['export',...
301
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase__ : List[str] = logging.get_logger(__name__) UpperCAmelCase__ : str = { 'microsoft/wavlm-base': 'https://huggingface.co/microsoft/wavlm-base/resol...
367
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' __UpperCamelCase : Any = (DDPMParallelScheduler,) def __magic_name__ ( self : ...
301
0
import enum import warnings from .. import MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING from ..utils import add_end_docstrings, is_tf_available from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf class UpperCAmelCase ( enum.Enum ): ...
368
import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokeni...
301
0
import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import sklearn # noqa: F401 # Here to have...
369
def lowerCamelCase__ ( a = 10**9 ) -> int: _A: Dict = 1 _A: Union[str, Any] = 2 _A: List[str] = 0 _A: List[Any] = 0 _A: int = 0 while perimeter <= max_perimeter: perimeters_sum += perimeter prev_value += 2 * value value +...
301
0
# This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for tests from os.path import join ...
370
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase__ : Union[str, Any] = { 'configuration_roc_bert': ['ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'RoCBertConfig'], 'tokenization_roc_ber...
301
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 ConfigTester fr...
371
import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput def lowerCamelCase__ ...
301
0
"""simple docstring""" import json import multiprocessing as mp import re from collections import defaultdict from functools import partial from typing import Dict, List, Optional, Set, Tuple, Type from datasets import Dataset from datasketch import MinHash, MinHashLSH from dpu_utils.utils.iterators import Thread...
350
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, Features, Value from .base import TaskTemplate @dataclass(frozen=SCREAMING_SNAKE_CASE__ ) class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' ...
301
0
"""simple docstring""" import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def lowerCamelCase__ ( a , a , a ) -> Union[str, Any]: _A: Any = AutoConfig.from_pretrained(a ) _A: Dict = FlaxAutoModelForSeqaS...
351
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 transformers from transformers impo...
301
0
"""simple docstring""" import argparse import logging import os import re import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, DataCollatorForLanguageModeling, PushToHubCallback, TFAutoModelForMaskedLM, create_optimizer, ) UpperCAmelCase__ : Dict ...
352
from __future__ import annotations UpperCAmelCase__ : List[str] = list[list[int]] # assigning initial values to the grid UpperCAmelCase__ : Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0]...
301
0
import os import posixpath import uuid from dataclasses import dataclass from typing import TYPE_CHECKING, Iterable, List, Optional, Tuple, Union import numpy as np import pyarrow as pa import datasets from datasets.arrow_writer import ArrowWriter, ParquetWriter from datasets.config import MAX_SHARD_SIZE from datase...
353
# This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for tests from os.path import join ...
301
0
import itertools import random import unittest import numpy as np from transformers import WAV_2_VEC_2_PRETRAINED_MODEL_ARCHIVE_LIST, WavaVecaConfig, WavaVecaFeatureExtractor from transformers.testing_utils import require_torch, slow from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTe...
354
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_flax_common import FlaxMode...
301
0
def lowerCamelCase__ ( a ) -> int: _A: List[str] = hex_num.strip() if not hex_num: raise ValueError('''No value was passed to the function''' ) _A: Any = hex_num[0] == '''-''' if is_negative: _A: Tuple = hex_num[1:] try: _A: Union[str, ...
355
from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' def __lt__( self : Dict , lowerCAmelCase_ :...
301
0
import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel UpperCAmelCase__ : Optional[int] = loggi...
356
import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu, calculate_rouge, chunks, pars...
301
0
def lowerCamelCase__ ( a = 50 ) -> int: _A: int = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length + 1 ): ways_number[row_length] += ways_number[ ...
357
import math import random from typing import Any from .hill_climbing import SearchProblem def lowerCamelCase__ ( a , a = True , a = math.inf , a = -math.inf , a = math.inf , a = -math.inf , a = False , a = 1_00 , a = 0.01 , a = 1 , ) -> Any: _A: Optional[Any] = Fa...
301
0
import numpy as np import pandas as pd from sklearn.preprocessing import Normalizer from sklearn.svm import SVR from statsmodels.tsa.statespace.sarimax import SARIMAX def lowerCamelCase__ ( a , a , a , a , a ) -> float: _A: Union[str, Any] = np.array([[1, item, train_mtch[i...
358
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : Union[str, Any] = logging.get_logger(__name__) UpperCAmelCase__ : List[Any] = { 'vo...
301
0
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 ( BarkCoarseConfig, Ba...
359
import os from pathlib import Path def lowerCamelCase__ ( ) -> Optional[Any]: from torch.utils.cpp_extension import load _A: str = Path(a ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' _A: Tuple = [ root / filename for filename...
301
0
import collections import inspect import unittest from transformers import SwinvaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTeste...
360
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class UpperCAmelCase ( ...
301
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase__ : Tuple = {'configuration_plbart': ['PLBART_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PLBartCo...
361
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__ : Tuple = logging.get_logger(__name__) UpperCAmelCase__ : Union[str, ...
301
0
def lowerCamelCase__ ( a ) -> bool: return str(a ) == str(a )[::-1] def lowerCamelCase__ ( a ) -> int: return int(a ) + int(str(a )[::-1] ) def lowerCamelCase__ ( a = 1_00_00 ) -> int: _A: Tuple = ...
362
import argparse import json import os from tensorflow.core.protobuf.saved_model_pba import SavedModel # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py UpperCAmelCase__ : Any = '.' # Internal TensorFlow ops tha...
301
0
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import OPTConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common i...
363
import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : int = logging.get_logger(__name__) UpperCAmelCase__ : Union[str, Any] = { 'vocab_file': 'vocab.j...
301
0
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer import diffusers from diffusers import ( AutoencoderKL, EulerDiscreteScheduler, StableDiffusionLatentUpscalePipeline, StableDiffusionPipeline, UNetaDConditi...
364
def lowerCamelCase__ ( a = 10 ) -> str: if not isinstance(a , a ) or n < 0: raise ValueError('''Invalid input''' ) _A: int = 10**n _A: List[Any] = 2_84_33 * (pow(2 , 7_83_04_57 , a )) + 1 return str(number % modulus ) if __name__ == "__main__": ...
301
0
from __future__ import annotations UpperCAmelCase__ : List[Any] = 'Muhammad Umer Farooq' UpperCAmelCase__ : str = 'MIT' UpperCAmelCase__ : Optional[int] = '1.0.0' UpperCAmelCase__ : Any = 'Muhammad Umer Farooq' UpperCAmelCase__ : Optional[An...
365
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ConfigTes...
301
0
import gc import threading import time import psutil import torch class UpperCAmelCase : '''simple docstring''' def __init__( self : Union[str, Any] ): """simple docstring""" _A: Dict = psutil.Process() _A: Optional[Any] = False def ...
366
from typing import TYPE_CHECKING from ..utils import _LazyModule UpperCAmelCase__ : Tuple = { 'config': [ 'EXTERNAL_DATA_FORMAT_SIZE_LIMIT', 'OnnxConfig', 'OnnxConfigWithPast', 'OnnxSeq2SeqConfigWithPast', 'PatchingSpec', ], 'convert': ['export',...
301
0
import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast UpperCAmelCase__ : List[Any] = datasets.utils.logging.get_logger(__name__) @dataclass class UpperCAmel...
367
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' __UpperCamelCase : Any = (DDPMParallelScheduler,) def __magic_name__ ( self : ...
301
0
from math import isqrt, loga def lowerCamelCase__ ( a ) -> list[int]: _A: Union[str, Any] = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , a , a ): _A: Optional[int] = F...
368
import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokeni...
301
0
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, ...
369
def lowerCamelCase__ ( a = 10**9 ) -> int: _A: Dict = 1 _A: Union[str, Any] = 2 _A: List[str] = 0 _A: List[Any] = 0 _A: int = 0 while perimeter <= max_perimeter: perimeters_sum += perimeter prev_value += 2 * value value +...
301
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : Any = logging.get_logger(__name__) UpperCAmelCase__...
370
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase__ : Union[str, Any] = { 'configuration_roc_bert': ['ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'RoCBertConfig'], 'tokenization_roc_ber...
301
0
"""simple docstring""" import sys def lowerCamelCase__ ( a ) -> Any: _A: Optional[Any] = len(a ) _A: Union[str, Any] = [[0 for x in range(a )] for x in range(a )] _A: int = [[0 for x in range(a )] for x in range(a )] for chain_length in ...
371
import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput def lowerCamelCase__ ...
301
0
"""simple docstring""" from typing import Dict, List, Optional, Tuple, Union import torch from ...models import AutoencoderKL, TransformeraDModel from ...schedulers import KarrasDiffusionSchedulers from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class U...
350
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, Features, Value from .base import TaskTemplate @dataclass(frozen=SCREAMING_SNAKE_CASE__ ) class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' ...
301
0
"""simple docstring""" def lowerCamelCase__ ( a , a , a ) -> float: if principal <= 0: raise Exception('''Principal borrowed must be > 0''' ) if rate_per_annum < 0: raise Exception('''Rate of interest must be >= 0''' ) if years_to_repay <= 0 or not isinstance(a ,...
351
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 transformers from transformers impo...
301
0
"""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_...
352
from __future__ import annotations UpperCAmelCase__ : List[str] = list[list[int]] # assigning initial values to the grid UpperCAmelCase__ : Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0]...
301
0
UpperCAmelCase__ : List[str] = 9.8_0665 def lowerCamelCase__ ( a , a , a = g ) -> float: if fluid_density <= 0: raise ValueError('''Impossible fluid density''' ) if volume < 0: raise ValueError('''Impossible Object volume''' ) if gravity <= 0:...
353
# This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for tests from os.path import join ...
301
0
def lowerCamelCase__ ( a = 4_00_00_00 ) -> int: _A: Union[str, Any] = [] _A: Dict = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(a ) _A: Any = b, a + b return sum(a ) if __name__ == "__main__": print(F"""{solution() = }"""...
354
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_flax_common import FlaxMode...
301
0
import webbrowser from sys import argv from urllib.parse import parse_qs, quote import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": UpperCAmelCase__ : List[Any] = '%20'.join(argv[1:]) if len(argv) > 1 else quote(str(input('Search: '))) ...
355
from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' def __lt__( self : Dict , lowerCAmelCase_ :...
301
0
import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configuration_pegasus import DEFAULTS, task_specific_params ...
356
import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu, calculate_rouge, chunks, pars...
301
0
from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOutput from diffusers.schedulers.scheduling_ddpm i...
357
import math import random from typing import Any from .hill_climbing import SearchProblem def lowerCamelCase__ ( a , a = True , a = math.inf , a = -math.inf , a = math.inf , a = -math.inf , a = False , a = 1_00 , a = 0.01 , a = 1 , ) -> Any: _A: Optional[Any] = Fa...
301
0
def lowerCamelCase__ ( a , a ) -> float: def get_matched_characters(a , a ) -> str: _A: Any = [] _A: List[Any] = min(len(_stra ) , len(_stra ) ) // 2 for i, l in enumerate(_stra ): _A: List[Any] = int(max(0 , i - limit ...
358
import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : Union[str, Any] = logging.get_logger(__name__) UpperCAmelCase__ : List[Any] = { 'vo...
301
0
from collections import UserDict 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 ...
359
import os from pathlib import Path def lowerCamelCase__ ( ) -> Optional[Any]: from torch.utils.cpp_extension import load _A: str = Path(a ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' _A: Tuple = [ root / filename for filename...
301
0
import argparse from pathlib import Path import torch from transformers import OPTConfig, OPTModel from transformers.utils import logging logging.set_verbosity_info() UpperCAmelCase__ : List[Any] = logging.get_logger(__name__) def lowerCamelCase__ ( a ) -> Any: _A: L...
360
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class UpperCAmelCase ( ...
301
0
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class UpperCAmelCase : '''simple docstring''' __UpperCamelCase : int __UpperCamelCase : TreeNode | None = None __UpperCamelCase : TreeNode | None = N...
361
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__ : Tuple = logging.get_logger(__name__) UpperCAmelCase__ : Union[str, ...
301
0
import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' def __magic_name__ ( self : Optional[int] , lowerCAmelCase...
362
import argparse import json import os from tensorflow.core.protobuf.saved_model_pba import SavedModel # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py UpperCAmelCase__ : Any = '.' # Internal TensorFlow ops tha...
301
0
"""simple docstring""" import importlib.util import json import os import warnings from dataclasses import dataclass, field import torch from ..training_args import TrainingArguments from ..utils import cached_property, is_sagemaker_dp_enabled, logging UpperCAmelCase__ : str = logging.get_log...
363
import json import os from typing import Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : int = logging.get_logger(__name__) UpperCAmelCase__ : Union[str, Any] = { 'vocab_file': 'vocab.j...
301
0
# Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar UpperCAmelCase__ : int = TypeVar('T') class UpperCAmelCase ( Generic[T] ): ...
364
def lowerCamelCase__ ( a = 10 ) -> str: if not isinstance(a , a ) or n < 0: raise ValueError('''Invalid input''' ) _A: int = 10**n _A: List[Any] = 2_84_33 * (pow(2 , 7_83_04_57 , a )) + 1 return str(number % modulus ) if __name__ == "__main__": ...
301
0
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 MvpTokenizer UpperCAmelCa...
365
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ConfigTes...
301
0
from __future__ import annotations def lowerCamelCase__ ( a , a ) -> int: # Checks if the entire collection has been sorted if len(a ) <= 1 or n <= 1: return insert_next(a , n - 1 ) rec_insertion_sort(a , n - 1 ) def lowerCamelCase__ ( a , ...
366
from typing import TYPE_CHECKING from ..utils import _LazyModule UpperCAmelCase__ : Tuple = { 'config': [ 'EXTERNAL_DATA_FORMAT_SIZE_LIMIT', 'OnnxConfig', 'OnnxConfigWithPast', 'OnnxSeq2SeqConfigWithPast', 'PatchingSpec', ], 'convert': ['export',...
301
0
from statistics import mean, stdev def lowerCamelCase__ ( a , a = 3 ) -> list: _A: Union[str, Any] = min(a ) _A: Tuple = max(a ) # normalize data return [round((x - x_min) / (x_max - x_min) , a ) for x in data] def lowerCamelCase__ ( a ,...
367
import torch from diffusers import DDPMParallelScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' __UpperCamelCase : Any = (DDPMParallelScheduler,) def __magic_name__ ( self : ...
301
0
import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_available, is_tf_available, is_torch_available ...
368
import json import os import unittest from transformers.models.gptsan_japanese.tokenization_gptsan_japanese import ( VOCAB_FILES_NAMES, GPTSanJapaneseTokenizer, ) from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokeni...
301
0
def lowerCamelCase__ ( a = 1_00_00_00 ) -> int: _A: Optional[Any] = [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 , a ): phi[j] -= phi[j] // i return sum(phi[2 : li...
369
def lowerCamelCase__ ( a = 10**9 ) -> int: _A: Dict = 1 _A: Union[str, Any] = 2 _A: List[str] = 0 _A: List[Any] = 0 _A: int = 0 while perimeter <= max_perimeter: perimeters_sum += perimeter prev_value += 2 * value value +...
301
0
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' __UpperCamelCase : int = ['''image_processor''', '''tokenizer'''] __UpperCamelCase...
370
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCAmelCase__ : Union[str, Any] = { 'configuration_roc_bert': ['ROC_BERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'RoCBertConfig'], 'tokenization_roc_ber...
301
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase__ : Optional[Any] = { 'configuration_upernet': ['UperNetConfig'], } try: if not is_torch_available(): raise OptionalDependen...
371
import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput def lowerCamelCase__ ...
301
0
"""simple docstring""" from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from ..image_utils import load_ima...
302
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score f...
302
1
"""simple docstring""" import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def __UpperCAmelCase ( __lowerCamelCase , __lowerCamelCase , __l...
302
"""simple docstring""" import argparse import os # New Code # 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_sched...
302
1
"""simple docstring""" def __UpperCAmelCase ( __lowerCamelCase , __lowerCamelCase ) -> int: return int((input_a, input_a).count(0 ) != 0 ) def __UpperCAmelCase ( ) -> None: assert nand_gate(0 , 0 ) == 1 assert...
302
"""simple docstring""" import tempfile import unittest from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from transformers.testing_utils import ( is_torch_available, require_optimum, require_torch, slow, ) if is_torch_available(): import torch @...
302
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor lowerCAmelCase_ = logging.get_logger(__name__) class __A ( A_ ): '''simple docstring''' def __init__( se...
302
"""simple docstring""" import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .u...
302
1
"""simple docstring""" import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def __UpperCAmelCase ( __lowerCamelCase ) -> Any: lowercase_...
302
"""simple docstring""" import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class __A ( A_ ): '''simpl...
302
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCAmelCase_ = {'configuration_yolos': ['YOLOS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'YolosConfig', 'YolosOnnxCo...
302
"""simple docstring""" import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early...
302
1
"""simple docstring""" import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def __...
302
"""simple docstring""" import math def __UpperCAmelCase ( __lowerCamelCase ) -> str: lowercase__ : Tuple = 0 lowercase__ : Tuple = 0 while num > 0: lowercase__ : int = num % 8 lowercase__ : Tu...
302
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = {} class __A ( A_ ): '''simple docstring''' l...
302
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...util...
302
1
"""simple docstring""" import math import sys import cva import numpy as np def __UpperCAmelCase ( __lowerCamelCase , __lowerCamelCase ) -> np.ndarray: # For applying gaussian function for each element in matrix. lowercase__ : Optional[Any...
302
"""simple docstring""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(...
302
1
"""simple docstring""" import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets lowerCAmelCase_ = '\\n@inproceedings{popovic-2015-chrf,\n title = "chr{F}: character n-gram {F}-score for automatic {MT} evaluation",\n author ...
302
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available lowerCAmelCase_ = { 'configuration_pix2struct': [ 'PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
302
1
"""simple docstring""" 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__) lowerCAmelCase_ ...
302
"""simple docstring""" import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import...
302
1
"""simple docstring""" def __UpperCAmelCase ( __lowerCamelCase ) -> list[int]: if length <= 0 or not isinstance(__lowerCamelCase , __lowerCamelCase ): raise ValueError('''Length must be a positive integer.''' ) return [n * (2 * n - 1) for n in ...
302
"""simple docstring""" from __future__ import annotations lowerCAmelCase_ = '#' class __A : '''simple docstring''' def __init__( self : str ) -> None: """simple docstring""" lowercase__ : dict...
302
1
"""simple docstring""" import argparse import json import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( VideoMAEConfig, VideoMAEForPreTraining, VideoMAEForVideoClassification, VideoMAEImageProcessor, ) ...
302
"""simple docstring""" from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_...
302
1
"""simple docstring""" # HF Trainer benchmarking tool # # This tool can be used to run and compare multiple dimensions of the HF Trainers args. # # It then prints a report once in github format with all the information that needs to be shared # with others and second time in a console-friend...
302
"""simple docstring""" from __future__ import annotations lowerCAmelCase_ = 1.6021E-19 # units = C def __UpperCAmelCase ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase , ) -> tuple[str, float]: if (conductivity...
302
1
"""simple docstring""" # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/l...
302
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale...
302
1
"""simple docstring""" import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...te...
302
"""simple docstring""" # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/l...
302
1
"""simple docstring""" import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_fil...
302
"""simple docstring""" from typing import Union import fire import torch from tqdm import tqdm def __UpperCAmelCase ( __lowerCamelCase , __lowerCamelCase = "cpu" , __lowerCamelCase = None ) -> None: lowercase__ : List[str] = ...
302
1
"""simple docstring""" import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset f...
302
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class __A ( A_ ...
302
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common im...
302
"""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 lowerCAmelCase_ = { ...
302
1
"""simple docstring""" from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image ...
302
"""simple docstring""" import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision import transforms from transformers import BitImageProcessor, FocalNetConfig, FocalNetForImageClassification from transfor...
302
1
"""simple docstring""" import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import...
302
"""simple docstring""" import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __A ( A_ ): '''simple docstring''' lowerCAmelCase : List[Any] = ["image_processor", "tokeni...
302
1
"""simple docstring""" from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...modeling_outputs import ( BackboneOutput, Base...
302
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase_ = { 'configu...
302
1
"""simple docstring""" def __UpperCAmelCase ( __lowerCamelCase ) -> list: lowercase__ : Tuple = [0] * len(__lowerCamelCase ) for i in range(1 , len(__lowerCamelCase ) ): # use last results for better performance - dynamic pr...
302
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score f...
302
1
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES, BertTokenizer from transformers.testing_utils import requi...
302
"""simple docstring""" import argparse import os # New Code # 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_sched...
302
1
"""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 lowerCAmelCase_ = {'vocab_file': 'vocab.t...
302
"""simple docstring""" import tempfile import unittest from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from transformers.testing_utils import ( is_torch_available, require_optimum, require_torch, slow, ) if is_torch_available(): import torch @...
302
1
"""simple docstring""" from collections import namedtuple lowerCAmelCase_ = namedtuple('from_to', 'from_ to') lowerCAmelCase_ = { 'cubicmeter': from_to(1, 1), 'litre': from_to(0.0_0_1, 1_000), 'kilolitre': from_to(1, 1), 'gallon': from...
302
"""simple docstring""" import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .u...
302
1
"""simple docstring""" def __UpperCAmelCase ( __lowerCamelCase , __lowerCamelCase ) -> List[Any]: # "extended trapezoidal rule" # int(f) = dx/2 * (f1 + 2f2 + ... + fn) lowercase__ : Optional[Any] = (boundary[1] - boundary[0]) / steps low...
302
"""simple docstring""" import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class __A ( A_ ): '''simpl...
302
1
"""simple docstring""" from __future__ import annotations import matplotlib.pyplot as plt # type: ignore import numpy # initial triangle of Koch snowflake lowerCAmelCase_ = numpy.array([0, 0]) lowerCAmelCase_ = numpy.array([0.5, 0.8_6_6_0_2_5_4]) low...
302
"""simple docstring""" import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early...
302
1