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
import torch from diffusers import StableDiffusionPipeline UpperCamelCase_ = '''path-to-your-trained-model''' UpperCamelCase_ = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.floataa).to('''cuda''') UpperCamelCase_ = '''A photo of sks dog in a bucket''' UpperCamel...
59
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase_ = TypeVar('''T''') UpperCamelCase_ = TypeVar('''U''') class _snake_case ( Generic[T, U] ): '''simple docstring''' def __init__( ...
59
1
def lowerCamelCase_ ( _a : List[str] ): '''simple docstring''' UpperCAmelCase_ : Optional[Any] = len(_a ) while cur > 1: # Find the maximum number in arr UpperCAmelCase_ : Tuple = arr.index(max(arr[0:cur] ) ) # R...
59
from sklearn.metrics import matthews_corrcoef import datasets UpperCamelCase_ = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classifications. It takes into account true and fa...
59
1
def lowerCamelCase_ ( _a : list ): '''simple docstring''' if any(not isinstance(_a , _a ) or x < 0 for x in sequence ): raise TypeError("""Sequence must be list of non-negative integers""" ) for _ in range(len(_a ) ): for i, (rod_upper, rod_lower) in enum...
59
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() UpperCamelCase_ = logging.get_logger('''transformers.models.speecht5''') def lowerCamelCase_ ( _a : str , _a : int , _...
59
1
import argparse import json import os import time import zipfile from get_ci_error_statistics import download_artifact, get_artifacts_links from transformers import logging UpperCamelCase_ = logging.get_logger(__name__) def lowerCamelCase_ ( _a : Any , _a : str ): ...
59
import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format='''%(message)s''') def lowerCamelCase_ ( _a : np.ndarray ): '''simple docstring''' return input_array.reshape((input_array.size, 1) ) def ...
59
1
import warnings from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dimens...
59
import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_ti...
59
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available UpperCamelCase_ = { '''configuration_biogpt''': ['''BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''BioGptConfig'''], '''tokenization_biogpt''': ['''BioGptTo...
59
import os def lowerCamelCase_ ( _a : str = "input.txt" ): '''simple docstring''' with open(os.path.join(os.path.dirname(_a ) , _a ) ) as input_file: UpperCAmelCase_ : Dict = [ [int(_a ) for element in line.split(""",""" )] ...
59
1
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 import TFModelTesterMixin...
59
# 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/licenses/LICENSE-2.0 # # Unless required by appli...
59
1
from typing import Optional, Tuple import jax import jax.numpy as jnp from flax import linen as nn from flax.core.frozen_dict import FrozenDict from transformers import CLIPConfig, FlaxPreTrainedModel from transformers.models.clip.modeling_flax_clip import FlaxCLIPVisionModule def lowerCamelCase_ ...
59
def lowerCamelCase_ ( _a : int , _a : list[int] , _a : int ): '''simple docstring''' def count_of_possible_combinations(_a : int ) -> int: if target < 0: return 0 if target == 0: return 1 return sum(count_of_possible_...
59
1
class _snake_case : '''simple docstring''' def __init__( self: int ,lowerCamelCase_: str ) -> str: UpperCAmelCase_ : Optional[int] = val UpperCAmelCase_ : Optional[Any] = None UpperCAmelCase_ ...
59
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { '''junnyu/roformer_chinese_small''': '''https://...
59
1
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import HeunDiscreteScheduler from ...
59
import argparse import dataclasses import json import logging import os import shutil from typing import List, Optional import datasets from accelerate import Accelerator from datasets import load_dataset from finetuning import finetune from tqdm.auto import tqdm import transformers from transformers import AutoC...
59
1
from __future__ import annotations def lowerCamelCase_ ( _a : list[int] ): '''simple docstring''' return len(set(_a ) ) == len(_a ) if __name__ == "__main__": import doctest doctest.testmod()
59
from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDiffusionScheduler from ...utils...
59
1
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTimestepEmbedding, Fl...
59
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, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_channel_di...
59
1
from typing import Dict, List, Optional from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { '''nielsr/canine-s''': 2048, } # Unicode defines 1,114,112 total “codepoints” UpperCam...
59
import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate import Accelerator from accelerate.t...
59
1
import argparse import os import sys from unittest.mock import patch import pytorch_lightning as pl import timeout_decorator import torch from distillation import SummarizationDistiller, distill_main from finetune import SummarizationModule, main from transformers import MarianMTModel from transformers.file_utils...
59
from scipy.stats import spearmanr import datasets UpperCamelCase_ = ''' The Spearman rank-order correlation coefficient is a measure of the relationship between two datasets. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Positive correlations impl...
59
1
import qiskit def lowerCamelCase_ ( _a : int , _a : int ): '''simple docstring''' UpperCAmelCase_ : Any = qiskit.Aer.get_backend("""aer_simulator""" ) # Create a Quantum Circuit acting on the q register UpperCAmelCase_ : Tuple ...
59
def lowerCamelCase_ ( _a : int = 50 ): '''simple docstring''' UpperCAmelCase_ : Dict = [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 ...
59
1
import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate import Accelerator from accelerate.t...
59
def lowerCamelCase_ ( _a : int ): '''simple docstring''' if a < 0: raise ValueError("""Input value must be a positive integer""" ) elif isinstance(_a , _a ): raise TypeError("""Input value must be a 'int' type""" ) return bin(_a ).count("""1""" ) if...
59
1
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, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_channel_di...
59
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, resize, to_channel_dimension_format, ) fr...
59
1
from __future__ import annotations import collections import pprint from pathlib import Path def lowerCamelCase_ ( _a : str ): '''simple docstring''' return "".join(sorted(_a ) ) def lowerCamelCase_ ( _a : str ): '''simple docstring''' r...
59
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { '''shi-labs/dinat-mini-in1k-224''': '''http...
59
1
from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def lowerCamelCase_ ( _a : Optional[int] , _a : str ): '''simple docstring''' UpperCAmelCase_ : Lis...
59
import random from typing import Any def lowerCamelCase_ ( _a : list ): '''simple docstring''' for _ in range(len(_a ) ): UpperCAmelCase_ : List[str] = random.randint(0 , len(_a ) - 1 ) UpperCAmelCase_ : Any = r...
59
1
import gc import unittest import numpy as np import torch from torch.backends.cuda import sdp_kernel from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) from diffusers.utils import randn_tensor, slow, torch_device from diffusers.utils.testing_utils import e...
59
# A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and v to U. We can also say that ...
59
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_ = logging.get_logger(__name__) UpperCamelCase_ ...
59
import argparse import os import torch from transformers.utils import WEIGHTS_NAME UpperCamelCase_ = ['''small''', '''medium''', '''large'''] UpperCamelCase_ = '''lm_head.decoder.weight''' UpperCamelCase_ = '''lm_head.weight''' def lowerCamelCase_ ( _a : str , ...
59
1
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, RegNetYaagf, RegNetYaa...
59
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, RegNetYaagf, RegNetYaa...
59
1
from ..utils import DummyObject, requires_backends class _snake_case ( metaclass=__snake_case ): '''simple docstring''' A__ : List[Any] = ["keras_nlp"] def __init__( self: int ,*lowerCamelCase_: Optional[int] ,**lowerCamelCase_: ...
59
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase_ = TypeVar('''T''') UpperCamelCase_ = TypeVar('''U''') class _snake_case ( Generic[T, U] ): '''simple docstring''' def __init__( ...
59
1
import io import json import unittest from parameterized import parameterized from transformers import FSMTForConditionalGeneration, FSMTTokenizer from transformers.testing_utils import get_tests_dir, require_torch, slow, torch_device from utils import calculate_bleu UpperCamelCase_ = get_tests_dir() +...
59
from sklearn.metrics import matthews_corrcoef import datasets UpperCamelCase_ = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classifications. It takes into account true and fa...
59
1
import numpy as np import torch from torch.utils.data import Dataset from utils import logger class _snake_case ( __snake_case ): '''simple docstring''' def __init__( self: Optional[int] ,lowerCamelCase_: List[str] ,lowerCamelCase_: Tuple )...
59
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() UpperCamelCase_ = logging.get_logger('''transformers.models.speecht5''') def lowerCamelCase_ ( _a : str , _a : int , _...
59
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available, ) UpperCamelCase_ = { '''configuration_speecht5''': [ '''SPEECHT5_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''SPEECHT5_PRETRAI...
59
import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format='''%(message)s''') def lowerCamelCase_ ( _a : np.ndarray ): '''simple docstring''' return input_array.reshape((input_array.size, 1) ) def ...
59
1
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ( BitConfig, ViTHybri...
59
import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_ti...
59
1
import requests UpperCamelCase_ = '''https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=''' def lowerCamelCase_ ( _a : str ): '''simple docstring''' UpperCAmelCase_ : int = requests.get(_NEWS_API + bbc_news_api_key ).json() # e...
59
import os def lowerCamelCase_ ( _a : str = "input.txt" ): '''simple docstring''' with open(os.path.join(os.path.dirname(_a ) , _a ) ) as input_file: UpperCAmelCase_ : Dict = [ [int(_a ) for element in line.split(""",""" )] ...
59
1
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import SegformerImageProcessor, SwinConfig, UperNetConfig, UperNetForSemanticSegmentation def lowerCamelCase_ ( _a : Union[str, Any] ): '''simp...
59
# 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/licenses/LICENSE-2.0 # # Unless required by appli...
59
1
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, resize, to_channel_dimension_format, ) fr...
59
def lowerCamelCase_ ( _a : int , _a : list[int] , _a : int ): '''simple docstring''' def count_of_possible_combinations(_a : int ) -> int: if target < 0: return 0 if target == 0: return 1 return sum(count_of_possible_...
59
1
import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoFeatureExtractor, WavaVecaFeatureExtractor from transformers.testing_utils import TOKEN, USER, g...
59
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { '''junnyu/roformer_chinese_small''': '''https://...
59
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { '''distilbert-base-uncased''': '''https://huggin...
59
import argparse import dataclasses import json import logging import os import shutil from typing import List, Optional import datasets from accelerate import Accelerator from datasets import load_dataset from finetuning import finetune from tqdm.auto import tqdm import transformers from transformers import AutoC...
59
1
from collections import OrderedDict from typing import TYPE_CHECKING, Any, List, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import TensorType, logging if TYPE_CHECKING: from ...onnx.config import PatchingSpec from ...token...
59
from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDiffusionScheduler from ...utils...
59
1
import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel UpperCamelCase_ = HfApi() UpperCamelCase_ = {} # fmt: off UpperCamelCase_ = torch.tensor([ -0.7_5_1_5, -1.6_8_8_3, 0.2_4_2_0, 0.0_3_0_0, 0.6_3_4_7, 1.3_4_3_3, -1.1_7_4_3, -3.7_4_6_7, ...
59
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, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_channel_di...
59
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert } class _snake_case ( __snake_case ): ...
59
import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate import Accelerator from accelerate.t...
59
1
import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available(): import onnxruntime as ort UpperCamelCas...
59
from scipy.stats import spearmanr import datasets UpperCamelCase_ = ''' The Spearman rank-order correlation coefficient is a measure of the relationship between two datasets. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Positive correlations impl...
59
1
from __future__ import annotations from dataclasses import dataclass @dataclass class _snake_case : '''simple docstring''' A__ : float A__ : TreeNode | None = None A__ : TreeNode | None = None def lowerCamelCase_ ( _a : Tree...
59
def lowerCamelCase_ ( _a : int = 50 ): '''simple docstring''' UpperCAmelCase_ : Dict = [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 ...
59
1
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, logging if is_sentencepiece...
59
def lowerCamelCase_ ( _a : int ): '''simple docstring''' if a < 0: raise ValueError("""Input value must be a positive integer""" ) elif isinstance(_a , _a ): raise TypeError("""Input value must be a 'int' type""" ) return bin(_a ).count("""1""" ) if...
59
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) UpperCamelCase_ = {'''configuration_xglm''': ['''XGLM_PRETRAINED...
59
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, resize, to_channel_dimension_format, ) fr...
59
1
import unittest from transformers import XLMConfig, 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 import ModelTesterMixin, ids...
59
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { '''shi-labs/dinat-mini-in1k-224''': '''http...
59
1
import argparse from collections import defaultdict import yaml UpperCamelCase_ = '''docs/source/en/_toctree.yml''' def lowerCamelCase_ ( _a : List[str] ): '''simple docstring''' UpperCAmelCase_ : Optional[Any] = defaultdict(_a ) for doc in...
59
import random from typing import Any def lowerCamelCase_ ( _a : list ): '''simple docstring''' for _ in range(len(_a ) ): UpperCAmelCase_ : List[str] = random.randint(0 , len(_a ) - 1 ) UpperCAmelCase_ : Any = r...
59
1
def lowerCamelCase_ ( _a : int = 1000 ): '''simple docstring''' UpperCAmelCase_ : int = 2**power UpperCAmelCase_ : str = 0 while n: UpperCAmelCase_ , UpperCAmelCase_ : Tuple = r + n % 10, n // 10 ...
59
# A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and v to U. We can also say that ...
59
1
import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from ...test_p...
59
import argparse import os import torch from transformers.utils import WEIGHTS_NAME UpperCamelCase_ = ['''small''', '''medium''', '''large'''] UpperCamelCase_ = '''lm_head.decoder.weight''' UpperCamelCase_ = '''lm_head.weight''' def lowerCamelCase_ ( _a : str , ...
59
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCamelCase_ = { '''configuration_instructblip''': [ '''INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''InstructBlipConfig''', '''InstructBlipQFormerConf...
59
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, RegNetYaagf, RegNetYaa...
59
1
from __future__ import annotations import random import unittest from transformers import TransfoXLConfig, 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 ...te...
59
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase_ = TypeVar('''T''') UpperCamelCase_ = TypeVar('''U''') class _snake_case ( Generic[T, U] ): '''simple docstring''' def __init__( ...
59
1
import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create simlink # import classes from unilm.wavlm.WavLM ...
59
from sklearn.metrics import matthews_corrcoef import datasets UpperCamelCase_ = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classifications. It takes into account true and fa...
59
1
import multiprocessing from typing import TYPE_CHECKING, Optional, Union from .. import Dataset, Features, config from ..formatting import query_table from ..packaged_modules.sql.sql import Sql from ..utils import logging from .abc import AbstractDatasetInputStream if TYPE_CHECKING: import sqlitea i...
59
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() UpperCamelCase_ = logging.get_logger('''transformers.models.speecht5''') def lowerCamelCase_ ( _a : str , _a : int , _...
59
1
import operator as op UpperCamelCase_ = '''scaler.pt''' UpperCamelCase_ = '''pytorch_model''' UpperCamelCase_ = '''random_states''' UpperCamelCase_ = '''optimizer''' UpperCamelCase_ = '''scheduler''' UpperCamelCase_ = '''pytorch_model.bin''' UpperCamelCase_ ...
59
import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format='''%(message)s''') def lowerCamelCase_ ( _a : np.ndarray ): '''simple docstring''' return input_array.reshape((input_array.size, 1) ) def ...
59
1
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = OrderedDict( [ ...
59
import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_ti...
59
1
def lowerCamelCase_ ( _a : int ): '''simple docstring''' if p < 2: raise ValueError("""p should not be less than 2!""" ) elif p == 2: return True UpperCAmelCase_ : List[Any] = 4 UpperCAmelCase_ : Optional[int] = (...
59
import os def lowerCamelCase_ ( _a : str = "input.txt" ): '''simple docstring''' with open(os.path.join(os.path.dirname(_a ) , _a ) ) as input_file: UpperCAmelCase_ : Dict = [ [int(_a ) for element in line.split(""",""" )] ...
59
1
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() clas...
59
# 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/licenses/LICENSE-2.0 # # Unless required by appli...
59
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_ = logging.get_logger(__name__) UpperCamelCase_ = { '''vocab_file''': '''vocab.json''', '''merges_...
59
def lowerCamelCase_ ( _a : int , _a : list[int] , _a : int ): '''simple docstring''' def count_of_possible_combinations(_a : int ) -> int: if target < 0: return 0 if target == 0: return 1 return sum(count_of_possible_...
59
1
import os from datetime import datetime as dt from github import Github UpperCamelCase_ = [ '''good first issue''', '''good second issue''', '''good difficult issue''', '''enhancement''', '''new pipeline/model''', '''new scheduler''', '''wip''', ] def lowerCamelCa...
59
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { '''junnyu/roformer_chinese_small''': '''https://...
59
1
import enum import shutil import sys UpperCamelCase_ ,UpperCamelCase_ = shutil.get_terminal_size() UpperCamelCase_ = {'''UP''': '''A''', '''DOWN''': '''B''', '''RIGHT''': '''C''', '''LEFT''': '''D'''} class _snake_case ( enum.Enum ): '''simple docstring''...
59
import argparse import dataclasses import json import logging import os import shutil from typing import List, Optional import datasets from accelerate import Accelerator from datasets import load_dataset from finetuning import finetune from tqdm.auto import tqdm import transformers from transformers import AutoC...
59
1
def lowerCamelCase_ ( _a : str , _a : int ): '''simple docstring''' UpperCAmelCase_ : list[list[str]] = [[] for _ in range(_a )] UpperCAmelCase_ : List[str] = key - 1 if key <= 0: raise ValueError("""Height of grid ca...
59
from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDiffusionScheduler from ...utils...
59
1
import re from filelock import FileLock try: import nltk UpperCamelCase_ = True except (ImportError, ModuleNotFoundError): UpperCamelCase_ = False if NLTK_AVAILABLE: with FileLock('''.lock''') as lock: nltk.download('''punkt''', quiet=True) def ...
59
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, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_channel_di...
59
1
import pickle import numpy as np from matplotlib import pyplot as plt class _snake_case : '''simple docstring''' def __init__( self: str ,lowerCamelCase_: Optional[Any] ,lowerCamelCase_: Tuple ,lowerCamelCase_: Tuple ,lowerCamelCase_:...
59
import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate import Accelerator from accelerate.t...
59
1
UpperCamelCase_ = '''0.18.2''' from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_available, is_k_diffusion_version, is_librosa_available, ...
59
from scipy.stats import spearmanr import datasets UpperCamelCase_ = ''' The Spearman rank-order correlation coefficient is a measure of the relationship between two datasets. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Positive correlations impl...
59
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCa...
59
def lowerCamelCase_ ( _a : int = 50 ): '''simple docstring''' UpperCAmelCase_ : Dict = [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 ...
59
1
from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class _snake_case ( __snake_case , __snake_case ): '''simple docstring''' @regis...
59
def lowerCamelCase_ ( _a : int ): '''simple docstring''' if a < 0: raise ValueError("""Input value must be a positive integer""" ) elif isinstance(_a , _a ): raise TypeError("""Input value must be a 'int' type""" ) return bin(_a ).count("""1""" ) if...
59
1
import itertools import json import os import unittest from transformers import AddedToken, LongformerTokenizer, LongformerTokenizerFast from transformers.models.longformer.tokenization_longformer import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, slow from ...test_tokenization_co...
59
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, resize, to_channel_dimension_format, ) fr...
59
1
import argparse from collections import defaultdict import yaml UpperCamelCase_ = '''docs/source/en/_toctree.yml''' def lowerCamelCase_ ( _a : Union[str, Any] ): '''simple docstring''' UpperCAmelCase_ : Dict = defaultdict(_a ) UpperCAmelCas...
59
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { '''shi-labs/dinat-mini-in1k-224''': '''http...
59
1
import os import numpy import onnx def lowerCamelCase_ ( _a : Dict , _a : List[Any] ): '''simple docstring''' UpperCAmelCase_ : List[str] = a.name UpperCAmelCase_ : List[str] = b.name UpperCAmelCase_ : Union[str...
59
import random from typing import Any def lowerCamelCase_ ( _a : list ): '''simple docstring''' for _ in range(len(_a ) ): UpperCAmelCase_ : List[str] = random.randint(0 , len(_a ) - 1 ) UpperCAmelCase_ : Any = r...
59
1
import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHECKING: from ... import...
59
# A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and v to U. We can also say that ...
59
1
from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class _snake_case : '''simple docstring''' pass
59
import argparse import os import torch from transformers.utils import WEIGHTS_NAME UpperCamelCase_ = ['''small''', '''medium''', '''large'''] UpperCamelCase_ = '''lm_head.decoder.weight''' UpperCamelCase_ = '''lm_head.weight''' def lowerCamelCase_ ( _a : str , ...
59
1
def lowerCamelCase_ ( _a : int ): '''simple docstring''' UpperCAmelCase_ : str = (1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def lowerCamelCase_ ( _a : int = 5000 ): '''simple docstring''' UpperCAmelCase_ : ...
59
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, RegNetYaagf, RegNetYaa...
59
1
# 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/licenses/LICENSE-2.0 # # Unless required by appli...
59
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase_ = TypeVar('''T''') UpperCamelCase_ = TypeVar('''U''') class _snake_case ( Generic[T, U] ): '''simple docstring''' def __init__( ...
59
1
import os from pathlib import Path def lowerCamelCase_ ( ): '''simple docstring''' from torch.utils.cpp_extension import load UpperCAmelCase_ : Optional[Any] = Path(_a ).resolve().parent.parent.parent / """kernels""" / """deformable_detr""" UpperCAmel...
59
from sklearn.metrics import matthews_corrcoef import datasets UpperCamelCase_ = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classifications. It takes into account true and fa...
59
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 ...
59
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() UpperCamelCase_ = logging.get_logger('''transformers.models.speecht5''') def lowerCamelCase_ ( _a : str , _a : int , _...
59
1
from collections import OrderedDict from typing import List, Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { '''google/e...
59
import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format='''%(message)s''') def lowerCamelCase_ ( _a : np.ndarray ): '''simple docstring''' return input_array.reshape((input_array.size, 1) ) def ...
59
1
import os def lowerCamelCase_ ( _a : str ): '''simple docstring''' UpperCAmelCase_ : int = len(grid[0] ) UpperCAmelCase_ : List[str] = len(_a ) UpperCAmelCase_ : List[str] = 0 UpperCAmelCase_ : ...
59
import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_ti...
59
1
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_ = logging.get_logger(__name__) UpperCamelCase_ = ...
59
import os def lowerCamelCase_ ( _a : str = "input.txt" ): '''simple docstring''' with open(os.path.join(os.path.dirname(_a ) , _a ) ) as input_file: UpperCAmelCase_ : Dict = [ [int(_a ) for element in line.split(""",""" )] ...
59
1
import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets UpperCamelCase_ = ''' @inproceedings{xu-etal-2016-optimizing, title = {Optimizing Statistical Machine Translation for Text Simplification}, authors={Xu, Wei a...
59
# 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/licenses/LICENSE-2.0 # # Unless required by appli...
59
1
from __future__ import annotations import csv import requests from bsa import BeautifulSoup def lowerCamelCase_ ( _a : str = "" ): '''simple docstring''' UpperCAmelCase_ : Optional[Any] = url or """https://www.imdb.com/chart/top/?ref_=nv_mv_250""" Upp...
59
def lowerCamelCase_ ( _a : int , _a : list[int] , _a : int ): '''simple docstring''' def count_of_possible_combinations(_a : int ) -> int: if target < 0: return 0 if target == 0: return 1 return sum(count_of_possible_...
59
1
import math from numpy import inf from scipy.integrate import quad def lowerCamelCase_ ( _a : float ): '''simple docstring''' if num <= 0: raise ValueError("""math domain error""" ) return quad(_a , 0 , _a , args=(_a) )[0] def lowerCam...
59
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { '''junnyu/roformer_chinese_small''': '''https://...
59
1
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _snake_case ( __snake_case ): '''simple docstring''' A__ : int = ["image_processor", "tokenizer"] A__ : int = "AutoImageProcessor" A__ :...
59
import argparse import dataclasses import json import logging import os import shutil from typing import List, Optional import datasets from accelerate import Accelerator from datasets import load_dataset from finetuning import finetune from tqdm.auto import tqdm import transformers from transformers import AutoC...
59
1
import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope="""session""" ) def lowerCamelCase_ ( ): '''simple...
59
from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDiffusionScheduler from ...utils...
59
1
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def lowerCamelCase_ ( _a : Optional[int] , _a : Any , _a : List[str] , _a : List[str]=1024 ): '''simple docstring''' UpperCAmelCase_ ...
59
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, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_channel_di...
59
1
"""simple docstring""" def lowerCamelCase_ ( _a : int = 10 , _a : int = 22 ): '''simple docstring''' UpperCAmelCase_ : List[str] = range(1 , _UpperCAmelCase ) UpperCAmelCase_ : Optional[int] = range(1 , _UpperCAmelCa...
350
import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate import Accelerator from accelerate.t...
59
0
def lowerCamelCase_ ( _a : int , _a : int ): '''simple docstring''' if a < 0 or b < 0: raise ValueError("""the value of both inputs must be positive""" ) UpperCAmelCase_ : Union[str, Any] = str(bin(lowercase__ ) )[2:] # remove the leading "0b"...
351
from scipy.stats import spearmanr import datasets UpperCamelCase_ = ''' The Spearman rank-order correlation coefficient is a measure of the relationship between two datasets. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Positive correlations impl...
59
0
UpperCamelCase_ = { '''Pillow''': '''Pillow<10.0.0''', '''accelerate''': '''accelerate>=0.20.3''', '''av''': '''av==9.2.0''', '''beautifulsoup4''': '''beautifulsoup4''', '''black''': '''black~=23.1''', '''codecarbon''': '''codecarbon==1.2.0''', '''cookiecutter''': '''cookiecutte...
352
def lowerCamelCase_ ( _a : int = 50 ): '''simple docstring''' UpperCAmelCase_ : Dict = [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 ...
59
0
import importlib.metadata import warnings from copy import deepcopy from packaging import version from ..utils import logging from .import_utils import is_accelerate_available, is_bitsandbytes_available if is_bitsandbytes_available(): import bitsandbytes as bnb import torch import torch.nn as ...
353
def lowerCamelCase_ ( _a : int ): '''simple docstring''' if a < 0: raise ValueError("""Input value must be a positive integer""" ) elif isinstance(_a , _a ): raise TypeError("""Input value must be a 'int' type""" ) return bin(_a ).count("""1""" ) if...
59
0
from __future__ import annotations from typing import Any def lowerCamelCase_ ( _a : list ): '''simple docstring''' if not postfix_notation: return 0 UpperCAmelCase_ : List[str] = {'''+''', '''-''', '''*''', '''/'''} UpperCAmelCase_ :...
354
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, resize, to_channel_dimension_format, ) fr...
59
0
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_ = logging.get_logger(__name__) UpperCamelCase_ = { '''google/vit-bas...
355
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { '''shi-labs/dinat-mini-in1k-224''': '''http...
59
0
from math import sqrt def lowerCamelCase_ ( _a : int ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False ...
356
import random from typing import Any def lowerCamelCase_ ( _a : list ): '''simple docstring''' for _ in range(len(_a ) ): UpperCAmelCase_ : List[str] = random.randint(0 , len(_a ) - 1 ) UpperCAmelCase_ : Any = r...
59
0
UpperCamelCase_ = {str(digit): digit**5 for digit in range(10)} def lowerCamelCase_ ( _a : int ): '''simple docstring''' return sum(DIGITS_FIFTH_POWER[digit] for digit in str(__A ) ) def lowerCamelCase_ ( ): '''simple docstring''' re...
357
# A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and v to U. We can also say that ...
59
0
import collections import os import re from pathlib import Path UpperCamelCase_ = 'src/transformers' # Matches is_xxx_available() UpperCamelCase_ = re.compile(R'''is\_([a-z_]*)_available()''') # Catches a one-line _import_struct = {xxx} UpperCamelCase_ = re.compile(R'''^_import_struct...
358
import argparse import os import torch from transformers.utils import WEIGHTS_NAME UpperCamelCase_ = ['''small''', '''medium''', '''large'''] UpperCamelCase_ = '''lm_head.decoder.weight''' UpperCamelCase_ = '''lm_head.weight''' def lowerCamelCase_ ( _a : str , ...
59
0
from bisect import bisect from itertools import accumulate def lowerCamelCase_ ( _a : Union[str, Any] , _a : Optional[Any] , _a : List[str] , _a : List[Any] ): '''simple docstring''' UpperCAmelCase_ : Dict = sorted(zip(_a , _a ...
359
import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import Callable, Dict, List, Tuple import timm import torch import torch.nn as nn from classy_vision.models.regnet import RegNet, RegNetParams, RegNetYaagf, RegNetYaagf, RegNetYaa...
59
0
from __future__ import annotations from itertools import permutations from random import randint from timeit import repeat def lowerCamelCase_ ( ): '''simple docstring''' UpperCAmelCase_ : Optional[Any] = [randint(-1000 , 1000 ) for i in range(10 )] ...
360
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar UpperCamelCase_ = TypeVar('''T''') UpperCamelCase_ = TypeVar('''U''') class _snake_case ( Generic[T, U] ): '''simple docstring''' def __init__( ...
59
0
from __future__ import annotations UpperCamelCase_ = 10 def lowerCamelCase_ ( _a : list[int] ): '''simple docstring''' UpperCAmelCase_ : List[str] = 1 UpperCAmelCase_ : List[str] = max(lowerCAmelCase__ ) while placement <...
361
from sklearn.metrics import matthews_corrcoef import datasets UpperCamelCase_ = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classifications. It takes into account true and fa...
59
0
class _snake_case : '''simple docstring''' def __init__( self: List[Any] ,lowerCamelCase_: int ) -> Optional[Any]: UpperCAmelCase_ : Optional[int] = len(lowerCamelCase_ ) UpperCAmelCase_ : Optional[int] ...
362
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() UpperCamelCase_ = logging.get_logger('''transformers.models.speecht5''') def lowerCamelCase_ ( _a : str , _a : int , _...
59
0
import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCLIPTextConfig, XCLIPVisionConfig, ) def ...
363
import logging import numpy as np import pytest from scipy.linalg import eigh logging.basicConfig(level=logging.INFO, format='''%(message)s''') def lowerCamelCase_ ( _a : np.ndarray ): '''simple docstring''' return input_array.reshape((input_array.size, 1) ) def ...
59
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, ...
364
import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_ti...
59
0
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny vocab first, and then a tiny model - so the outcome is truly tiny - # all f...
365
import os def lowerCamelCase_ ( _a : str = "input.txt" ): '''simple docstring''' with open(os.path.join(os.path.dirname(_a ) , _a ) ) as input_file: UpperCAmelCase_ : Dict = [ [int(_a ) for element in line.split(""",""" )] ...
59
0
from graphs.minimum_spanning_tree_kruskal import kruskal def lowerCamelCase_ ( ): '''simple docstring''' UpperCAmelCase_ : List[str] = 9 UpperCAmelCase_ : Dict = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, 8, ...
366
# 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/licenses/LICENSE-2.0 # # Unless required by appli...
59
0
from .constants import ( MODEL_NAME, OPTIMIZER_NAME, RNG_STATE_NAME, SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, SCALER_NAME, SCHEDULER_NAME, TORCH_LAUNCH_PARAMS, WEIGHTS_INDEX_NAME, WEIGHTS_NAME, ) from .dataclasses import ( BnbQuantizationConfig, ComputeEnvironment,...
367
def lowerCamelCase_ ( _a : int , _a : list[int] , _a : int ): '''simple docstring''' def count_of_possible_combinations(_a : int ) -> int: if target < 0: return 0 if target == 0: return 1 return sum(count_of_possible_...
59
0
UpperCamelCase_ = { 'Pillow': 'Pillow<10.0.0', 'accelerate': 'accelerate>=0.20.3', 'av': 'av==9.2.0', 'beautifulsoup4': 'beautifulsoup4', 'black': 'black~=23.1', 'codecarbon': 'codecarbon==1.2.0', 'cookiecutter': 'cookiecutter==1.7.3', 'dataclasses': 'dataclasses', 'data...
368
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { '''junnyu/roformer_chinese_small''': '''https://...
59
0
from abc import ABC, abstractmethod from argparse import ArgumentParser class _snake_case ( a__ ): @staticmethod @abstractmethod def A__ ( lowerCamelCase_: List[Any] ) -> Optional[Any]: raise NotImplementedError() @abstractmethod def ...
369
import argparse import dataclasses import json import logging import os import shutil from typing import List, Optional import datasets from accelerate import Accelerator from datasets import load_dataset from finetuning import finetune from tqdm.auto import tqdm import transformers from transformers import AutoC...
59
0
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.util...
370
from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDiffusionScheduler from ...utils...
59
0
def lowerCamelCase_ ( _a : list[int] ): '''simple docstring''' if not numbers: return 0 if not isinstance(UpperCAmelCase__ , (list, tuple) ) or not all( isinstance(UpperCAmelCase__ , UpperCAmelCase__ ) for number in numbers ): raise ValueError...
371
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, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_channel_di...
59
0