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
from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def lowerCamelCase__ ( a , a , a , a , a ) -> np.ndarray: _A: Dict = cva.getAffineTransform(a , a ) return cva.warpAffine(a , a , (rows, cols) ) if __name__ == "__m...
301
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
1
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() UpperCAmelCase__ : int = [ 'word_embeddings_layernor...
301
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
1
import tensorflow as tf from ...tf_utils import shape_list class UpperCAmelCase ( tf.keras.layers.Layer ): '''simple docstring''' def __init__( self : List[Any] , lowerCAmelCase_ : Dict , lowerCAmelCase_ : Dict , lowerCAme...
301
from typing import TYPE_CHECKING from ..utils import _LazyModule UpperCAmelCase__ : Tuple = { 'config': [ 'EXTERNAL_DATA_FORMAT_SIZE_LIMIT', 'OnnxConfig', 'OnnxConfigWithPast', 'OnnxSeq2SeqConfigWithPast', 'PatchingSpec', ], 'convert': ['export',...
301
1
import argparse import collections import os import re import tempfile import pandas as pd from datasets import Dataset from huggingface_hub import hf_hub_download, upload_folder from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root o...
301
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
1
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, ...
301
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
1
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 = FlaxAutoModelForSeqaSeqLM.from_config(config=a ...
301
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
1
import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, r...
301
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
1
import re def lowerCamelCase__ ( a ) -> str: if len(re.findall('''[ATCG]''' , a ) ) != len(a ): raise ValueError('''Invalid Strand''' ) return dna.translate(dna.maketrans('''ATCG''' , '''TAGC''' ) ) if __name__ == "__main__": import doctest doctest...
301
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
1
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ...
301
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
1
import math 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 SchedulerMixin, SchedulerOutput class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE...
301
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
1
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 require_tokenizers, require_vision from transformers.utils i...
301
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
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase__ : Tuple = { 'configuration_roberta': ['ROBERTA_PRETRAINED_CONFIG_ARCH...
301
# 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
1
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...
301
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
1
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...
301
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
1
import itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin if is_speech_available(): from transf...
301
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
1
import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_image, load_numpy, slow, torch...
301
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
1
UpperCAmelCase__ : Tuple = '0.21.0' from .accelerator import Accelerator from .big_modeling import ( cpu_offload, cpu_offload_with_hook, disk_offload, dispatch_model, init_empty_weights, init_on_device, load_checkpoint_and_dispatch, ) from .data_loader import skip_first_b...
301
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
1
import unittest from parameterized import parameterized from transformers import AutoTokenizer, GPTNeoXConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import Con...
301
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
1
class UpperCAmelCase : '''simple docstring''' def __init__( self : Tuple ): """simple docstring""" _A: Tuple = '''''' _A: List[Any] = '''''' _A: Optional[int] = [] def __magic_name__ ( self : str , lowerCAm...
301
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
1
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 from ...test_modeling_common ...
301
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
1
from collections import namedtuple import requests from lxml import html # type: ignore UpperCAmelCase__ : Union[str, Any] = namedtuple('covid_data', 'cases deaths recovered') def lowerCamelCase__ ( a = "https://www.worldometers.info/coronavirus/" ) -> covid_data: _A: ...
301
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
1
class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' pass class UpperCAmelCase ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' pass class UpperCAmelCase : '''simple docstring''' def __init__( self : T...
301
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
1
class UpperCAmelCase : # Public class to implement a graph '''simple docstring''' def __init__( self : int , lowerCAmelCase_ : int , lowerCAmelCase_ : int , lowerCAmelCase_ : list[list[bool]] ): """simple docstring""" ...
301
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
1
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 = [] for num in r...
301
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
1
from __future__ import annotations from math import pi def lowerCamelCase__ ( a , a , a ) -> dict[str, float]: if (inductance, frequency, reactance).count(0 ) != 1: raise ValueError('''One and only one argument must be 0''' ) if inductance < 0: raise ValueError('...
301
from typing import TYPE_CHECKING from ..utils import _LazyModule UpperCAmelCase__ : Tuple = { 'config': [ 'EXTERNAL_DATA_FORMAT_SIZE_LIMIT', 'OnnxConfig', 'OnnxConfigWithPast', 'OnnxSeq2SeqConfigWithPast', 'PatchingSpec', ], 'convert': ['export',...
301
1
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
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
1
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
301
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
1
def lowerCamelCase__ ( a ) -> int: if divisor % 5 == 0 or divisor % 2 == 0: return 0 _A: Tuple = 1 _A: List[Any] = 1 while repunit: _A: Union[str, Any] = (10 * repunit + 1) % divisor repunit_index += 1 return repunit_index def lowerCa...
301
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
1
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
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
1
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 TensorType class UpperCAmelCa...
301
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
1
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 ...
301
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
1
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 import TokenizerTesterMixin ...
301
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
1
def lowerCamelCase__ ( a , a ) -> Any: _A: Tuple = '''''' for i in table: res += inp[i - 1] return res def lowerCamelCase__ ( a ) -> Tuple: return data[1:] + data[0] def lowerCamelCase__ ( a , a ) -> Union[str, Any]: ...
301
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
1
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
# 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
1
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandinsky.text_encoder import MC...
301
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
1
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 ThreadedIterator from tqdm import...
301
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
1
import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCamelCase__ ( a , a , a ) -> Tuple: # Construct model if gpta_config_file ...
301
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
1
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mobilebert import MobileBertTokenizer UpperCAmelCase__ : List[str] = logging.get_logger(__name__) ...
301
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
1
import math def lowerCamelCase__ ( a ) -> list[int]: _A: Dict = [] _A: int = 2 _A: Any = int(math.sqrt(a ) ) # Size of every segment _A: int = [True] * (end + 1) _A: Any = [] while start <= end: if temp[start] is True: ...
301
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
1
from PIL import Image def lowerCamelCase__ ( a , a ) -> Image: def brightness(a ) -> float: return 1_28 + level + (c - 1_28) if not -255.0 <= level <= 255.0: raise ValueError('''level must be between -255.0 (black) and 255.0 (white)''' ) return img.point(a ) ...
301
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
1
def lowerCamelCase__ ( a , a ) -> list[int]: _A: Any = int(a ) # Initialize Result _A: Union[str, Any] = [] # Traverse through all denomination for denomination in reversed(a ): # Find denominations while int(a ) >= int(a ): total_...
301
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
1
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 ...
301
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
1
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...
301
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
1
def lowerCamelCase__ ( a ) -> list: if len(a ) < 2: return collection def circle_sort_util(a , a , a ) -> bool: _A: Tuple = False if low == high: return swapped _A: Dict = low _A: int = high while left < right...
301
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
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) UpperCAmelCase__ : Optional[Any] = { 'configuration_swiftformer': [ 'SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SwiftFormerConfig', '...
301
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
1
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...
301
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
1
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
from typing import TYPE_CHECKING from ..utils import _LazyModule UpperCAmelCase__ : Tuple = { 'config': [ 'EXTERNAL_DATA_FORMAT_SIZE_LIMIT', 'OnnxConfig', 'OnnxConfigWithPast', 'OnnxSeq2SeqConfigWithPast', 'PatchingSpec', ], 'convert': ['export',...
301
1
import inspect import tempfile import unittest from huggingface_hub import hf_hub_download from transformers import is_torch_available from transformers.testing_utils import is_flaky, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTes...
301
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
1
import argparse import os from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_task_guides.py UpperCAmelCase__ : List[str] = 'src/transformers' UpperCAmelCase__ : ...
301
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
1
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...
301
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
1
import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() UpperCAmelCase__ : Optional[int] = logging.get_logger(__name__) UpperCAmelCase__ : str = {name: getattr(transforme...
301
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
1
import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet import VOCAB_FILES_NAMES, Prophe...
301
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
1
"""simple docstring""" from datetime import datetime as dt import os from github import Github UpperCAmelCase__ : Union[str, Any] = [ '''good first issue''', '''good second issue''', '''good difficult issue''', '''feature request''', '''new model''', '''wip''', ] ...
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 os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, loggi...
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 operator as op def lowerCamelCase__ ( a ) -> Optional[Any]: _A: str = [] _A: List[str] = lambda a , a : int(x / y ) # noqa: E731 integer division operation _A: Optional[int] = { '''^''': op.pow, '''*''':...
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 argparse import torch from huggingface_hub import hf_hub_download from transformers import AutoTokenizer, RobertaPreLayerNormConfig, RobertaPreLayerNormForMaskedLM from transformers.utils import logging logging.set_verbosity_info() UpperCAmelCase__ : List[str] = logging.get_logger(__name__...
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 import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowerCamelCase__ ( a , a , a ) -> int: # Initialise PyTorch model _A: int = AlbertConfig.from_json_file(...
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
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCAmelCase__ : int = logging.get_logger(__name__) class UpperCAmelCase ( lowercase__ , ...
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 torch from ..models.auto import AutoModelForSequenceClassification, AutoTokenizer from .base import PipelineTool class UpperCAmelCase ( lowerCamelCase__ ): '''simple docstring''' __UpperCamelCase : Tuple = 'facebook/bart-large-mnli' __UpperCamelCase : Tuple ...
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 from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : Union[str, Any] = logging.get_logger(__name__) UpperCAmelCase__ ...
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
from __future__ import annotations UpperCAmelCase__ : Tuple = 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], ...
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
class SCREAMING_SNAKE_CASE__ : '''simple docstring''' def __init__( self : Dict , lowerCAmelCase_ : List[Any] ): """simple docstring""" _A: int = len(__lowercase ) _A: str = [0] * len_array if len_array > 0: _A:...
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 CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import f...
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
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''' ...
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 gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load...
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 math def lowerCamelCase__ ( a ) -> 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 F...
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 copy import deepcopy class UpperCAmelCase : '''simple docstring''' def __init__( self : Dict , lowerCAmelCase_ : int = None , lowerCAmelCase_ : str = None ): """simple docstring""" if arr is None and size is not None: ...
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 importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from ...image_pr...
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 json import os import pickle import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers import is_faiss_available from transformers.models.bart.configuration_bart import BartConfig from transformers.models.ba...
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 __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, random_attention_mask fro...
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 factorial, pi def lowerCamelCase__ ( a , a = 30 ) -> float: if not isinstance(_UpperCamelCase , (int, float) ): raise ValueError('''maclaurin_sin() requires either an int or float for theta''' ) if not isinstance(_UpperCamelCase , _UpperCamelCase ...
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 os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase__ : Optional[int] = logging.get_logger(__name__) UpperCAmelCase__ : int = ...
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
from string import ascii_lowercase, ascii_uppercase def lowerCamelCase__ ( a ) -> List[str]: if not sentence: return "" _A: str = dict(zip(__SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ) ) return lower_to_upper.get(sentence[0] , sentence[0] ) + sentence[1...
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 torch def lowerCamelCase__ ( ) -> List[str]: if torch.cuda.is_available(): _A: Any = torch.cuda.device_count() else: _A: Any = 0 print(f"""Successfully ran on {num_gpus} GPUs""" ) if __name__ == "__main__": main()
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 unittest from transformers import is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device if is_torch_available(): import torch from transformers import AutoModelForImageClassification if is_vision_ava...
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 inspect import unittest from transformers import ConvNextVaConfig from transformers.models.auto import get_values from transformers.models.auto.modeling_auto import MODEL_FOR_BACKBONE_MAPPING_NAMES, MODEL_MAPPING_NAMES from transformers.testing_utils import require_torch, require_vis...
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 tensorflow as tf import torch from transformers import BertConfig, BertForMaskedLM from transformers.models.bert.modeling_bert import ( BertIntermediate, BertLayer, BertOutput, BertPooler, BertSelfAttention, BertSelfOutput, ) from transformers...
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
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase__ : Union[str, Any] = { """configurat...
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 = 60_08_51_47_51_43 ) -> int: try: _A: List[Any] = int(a ) except (TypeError, ValueError): raise TypeError('''Parameter n must be int or castable to int.''' ) if n <= 0: raise ValueError('''Parameter n must be greater than or equal ...
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 , a , a , a ) -> List[str]: global f # a global dp table for knapsack if f[i][j] < 0: if j < wt[i - 1]: _A: str = mf_knapsack(i - 1 , snake_case_ , snake_case_ , snake_case_ ) else: _A: Union[str, Any] = ma...
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 class UpperCAmelCase : '''simple docstring''' def __init__( self : List[str] , lowerCAmelCase_ : str , lowerCAmelCase_ : str ): """simple docstring""" _A: List[Any] = text, pattern ...
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 import tempfile import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from torch import nn from transformers import ( Adafactor, AdamW, get_constant_schedule, get_constant...
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 ) -> Dict: if not isinstance(a , a ): raise TypeError('''Input value must be an \'int\' type''' ) _A: List[str] = 0 while number: position += 1 number >>= 1 return position if __name__ == "__main__": import doctest do...
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 os import sys UpperCAmelCase__ : Optional[Any] = os.path.join(os.path.dirname(__file__), 'src') sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSequenceC...
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 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_bart import BartTokenizer UpperCAmel...
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
# Lint as: python3 import dataclasses import re from dataclasses import dataclass from functools import total_ordering from typing import Optional, Union UpperCAmelCase__ : Dict = re.compile(R'^(?P<major>\d+)' R'\.(?P<minor>\d+)' R'\.(?P<patch>\d+)$') @total_ordering @dataclass class UpperCAm...
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 os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py UpperCAmelCase__ : str = '.' if __name__ == "__main__": UpperCAmelCase__ : Optional[int] = os.path.join(REPO_PATH...
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 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 __magic_name__ ( self : Op...
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 unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import TransformeraDModel, VQDiffusionPipeline, VQDiffusionScheduler, VQModel from diffusers.pipelines.vq_diffusion.pipeline_vq_diffusion import LearnedClassifierFreeSamplingE...
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 argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Accelerator, Dist...
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 UpperCAmelCase__ : str = tuple[int, int, int] UpperCAmelCase__ : Any = tuple[str, str, str] # used alphabet -------------------------- # from string.ascii_uppercase UpperCAmelCase__ : int = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' # --...
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 collections import defaultdict from typing import Optional from ..image_utils import load_image from ..utils import ( add_end_docstrings, is_torch_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_torch_available(): import torch from ....
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 os import time import pytest from datasets.utils.filelock import FileLock, Timeout def lowerCamelCase__ ( a ) -> Any: _A: str = FileLock(str(tmpdir / '''foo.lock''' ) ) _A: Optional[int] = FileLock(str(tmpdir / '''foo.lock''' ) ) _A: Any =...
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 argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging UpperCAmelCase__ : Tuple = ...
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 random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampler, SkipDataLoader, sk...
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 logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever UpperCAmelCase__ : List[str] = logging.getLogger(__name__) class UpperCAmelCase ( ...
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""" def lowerCamelCase__ ( a = 50 ) -> int: _A: Optional[int] = [1] * (length + 1) for row_length in range(3 , length + 1 ): for block_length in range(3 , row_length + 1 ): for block_start in range(row_length - block_length ): ...
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 ) -> int: return int((input_a, input_a).count(1 ) != 0 ) def lowerCamelCase__ ( ) -> None: assert or_gate(0 , 0 ) == 0 assert or_gate(0 , 1 ) == 1 assert or_gate(1 , 0 ) == 1 assert ...
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""" def lowerCamelCase__ ( a = 1_00 ) -> int: _A: List[str] = n * (n + 1) * (2 * n + 1) / 6 _A: Optional[Any] = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__main__": print(F"""{solution() = }""")
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
from __future__ import annotations from collections import namedtuple def lowerCamelCase__ ( a , a , a ) -> Tuple: _A: Optional[int] = namedtuple('''result''' , '''name value''' ) if (voltage, current, power).count(0 ) != 1: raise ValueError('''Only one argume...
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