code stringlengths 82 54.1k | code_codestyle int64 0 699 | style_context stringlengths 111 35.6k | style_context_codestyle int64 0 699 | label int64 0 1 |
|---|---|---|---|---|
from __future__ import annotations
from math import ceil, floor, sqrt
def snake_case ( lowerCamelCase = 2_000_000 ):
'''simple docstring'''
__lowercase = [0]
__lowercase = 42
for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ):
triangl... | 80 |
"""simple docstring"""
from __future__ import annotations
from collections.abc import Iterator
class a :
def __init__( self , UpperCamelCase_ ):
UpperCAmelCase__ : str = value
UpperCAmelCase__ : Node | None = None
... | 110 | 0 |
import gc
import tempfile
import unittest
import numpy as np
import torch
from diffusers import VersatileDiffusionTextToImagePipeline
from diffusers.utils.testing_utils import nightly, require_torch_gpu, torch_device
_snake_case : Tuple = False
class a (unittest.TestCase ):
... | 81 |
"""simple docstring"""
import argparse
import torch
from torch import nn
from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration
def lowerCamelCase ( _snake_case ):
UpperCAmelCase__ : int = [
'encoder.version',
'decoder.version',
'model.enco... | 110 | 0 |
"""simple docstring"""
import argparse
import json
from pathlib import Path
import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel
from transformers.utils imp... | 82 |
"""simple docstring"""
import random
import unittest
import torch
from diffusers import IFImgaImgSuperResolutionPipeline
from diffusers.utils import floats_tensor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import skip_mps, torch_device
from ..pipeline_params... | 110 | 0 |
"""simple docstring"""
import math
import unittest
def snake_case_ ( A_ : int ):
'''simple docstring'''
assert isinstance(A_, A_ ) and (
number >= 0
), "'number' must been an int and positive"
if 1 < number < 4:
# 2 and 3 ... | 83 |
"""simple docstring"""
import unittest
from transformers import CamembertTokenizer, CamembertTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow
from transformers.utils import is_torch_available
from ...test_tokenization_common import TokenizerTester... | 110 | 0 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
UpperCAmelCase = logging.get_logger(__name__)
UpperCAmelCase = {
'''google/switch-base-8''': '''https://huggingface.co/google/switch-base-8/blob/main/config.json''',
}
class A_ ( __lowerCamelCase ... | 84 |
"""simple docstring"""
UpperCamelCase__ = {
'meter': 'm',
'kilometer': 'km',
'megametre': 'Mm',
'gigametre': 'Gm',
'terametre': 'Tm',
'petametre': 'Pm',
'exametre': 'Em',
'zettametre': 'Zm',
'yottametre': 'Ym',
}
# Exponent of the factor(meter)
UpperCamelCase__ ... | 110 | 0 |
import argparse
import json
from collections import OrderedDict
import torch
from huggingface_hub import cached_download, hf_hub_url
from transformers import AutoImageProcessor, CvtConfig, CvtForImageClassification
def _a ( lowercase__ : List[str] ):
'''simple docstring'''
... | 85 |
"""simple docstring"""
import argparse
from copy import deepcopy
import numpy as np
from datasets import ClassLabel, DatasetDict, load_dataset
from evaluate import load
from transformers import (
AutoModelForSequenceClassification,
AutoTokenizer,
DataCollatorWithPadding,
Trainer,
TrainerCallba... | 110 | 0 |
from typing import List
from .keymap import KEYMAP, get_character
def __snake_case ( __UpperCamelCase : str ):
"""simple docstring"""
def decorator(__UpperCamelCase : Union[str, Any] ):
A_ = getattr(__UpperCamelCase ,"handle_key" ,[] )
... | 86 |
"""simple docstring"""
from ...configuration_utils import PretrainedConfig
class a ( lowercase ):
UpperCamelCase : Union[str, Any] = """bert-generation"""
def __init__( self , UpperCamelCase_=50_358 , UpperCamelCase_=1_024 , UpperCamelCase_=24 ... | 110 | 0 |
import html
from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin
from ...utils import is_bsa_available, logging, requires_backends
if is_bsa_available():
import bsa
from bsa import BeautifulSoup
_lowerCamelCase : Optional[int] = logging.get_logger(__name__)
class... | 87 |
"""simple docstring"""
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.kandin... | 110 | 0 |
"""simple docstring"""
from typing import Optional, Union
import numpy as np
from ...image_processing_utils import BaseImageProcessor, BatchFeature
from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format
from ...image_utils import ChannelDimension, ImageInput, make_list_... | 88 |
"""simple docstring"""
def lowerCamelCase ( _snake_case ,_snake_case ):
return int((input_a, input_a).count(0 ) == 0 )
def lowerCamelCase ( ):
assert and_gate(0 ,0 ) == 0
assert and_gate(0 ,1 ) == 0
assert and_gate(1 ,0 ) == 0
assert and_gate(1 ,1 ) == 1
if... | 110 | 0 |
import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple
import sentencepiece as spm
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging
SCREAMING_SNAKE_CASE : str = logging.get_logger(__name__)
SCREAMING_SNAKE_CASE : Optional[Any] ... | 89 |
"""simple docstring"""
from typing import Any
class a :
def __init__( self , UpperCamelCase_ ):
UpperCAmelCase__ : Optional[Any] = data
UpperCAmelCase__ : List[str] = None
def __repr__( self ):
retur... | 110 | 0 |
'''simple docstring'''
from dataclasses import dataclass
from typing import Optional
import torch
from torch import nn
from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import BaseOutput
from .attention import BasicTransformerBlock
from .modeling_utils import M... | 90 |
"""simple docstring"""
import random
def lowerCamelCase ( _snake_case ):
UpperCAmelCase__ : Tuple = num - 1
UpperCAmelCase__ : Dict = 0
while s % 2 == 0:
UpperCAmelCase__ : Optional[int] = s // 2
t += 1
for _ in... | 110 | 0 |
"""simple docstring"""
from __future__ import annotations
_lowercase = 1.6021e-19 # units = C
def _snake_case ( snake_case__ : float , snake_case__ : float , snake_case__ : float , ):
if (conductivity, electron_conc, mobility).count(0 ) != 1:
raise ValueError('You ... | 91 |
"""simple docstring"""
from __future__ import annotations
UpperCamelCase__ = tuple[int, int, int]
UpperCamelCase__ = tuple[str, str, str]
# used alphabet --------------------------
# from string.ascii_uppercase
UpperCamelCase__ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
# ------------------------... | 110 | 0 |
'''simple docstring'''
import pandas as pd
from matplotlib import pyplot as plt
from sklearn.linear_model import LinearRegression
# Splitting the dataset into the Training set and Test set
from sklearn.model_selection import train_test_split
# Fitting Polynomial Regression to the dataset
from sklearn.preproces... | 92 |
"""simple docstring"""
import logging
import random
import ray
from transformers import RagConfig, RagRetriever, RagTokenizer
from transformers.models.rag.retrieval_rag import CustomHFIndex
UpperCamelCase__ = logging.getLogger(__name__)
class a :
def __init__( self ):
... | 110 | 0 |
"""simple docstring"""
from typing import Dict, Iterable, Optional, Union
import numpy as np
from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format, to_pil_image
from ...image_utils import... | 93 |
"""simple docstring"""
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roformer import RoForme... | 110 | 0 |
'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging
SCREAMING_SNAKE_CASE = logging.get_logger(__name__)
SCREAMING_SNAKE_CASE = {
'studio-ousia/luke-base': 'https://huggingface.co/studio-ousia/luke-base/resolve/main/config.json',
... | 94 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_torch_available,
)
UpperCamelCase__ = {
'configuration_mega': ['MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MegaConfig', 'MegaOnnxConfig'],
}
try:
if not is_torch... | 110 | 0 |
"""simple docstring"""
import argparse
import json
import logging
import os
import sys
from unittest.mock import patch
from transformers.testing_utils import TestCasePlus, get_gpu_count, slow
lowerCamelCase_ = [
os.path.join(os.path.dirname(__file__), dirname)
for dirname in [
'''t... | 95 |
"""simple docstring"""
import json
import os
import shutil
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 AutoConfig, BertConfig, GPTaConfig
from t... | 110 | 0 |
"""simple docstring"""
import os
try:
from .build_directory_md import good_file_paths
except ImportError:
from build_directory_md import good_file_paths # type: ignore
__lowerCamelCase = list(good_file_paths())
assert filepaths, "good_file_paths() failed!"
__l... | 96 |
"""simple docstring"""
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 buck... | 110 | 0 |
import heapq
import sys
import numpy as np
__a = tuple[int, int]
class lowercase__:
"""simple docstring"""
def __init__( self : Union[str, Any] ) -> Any:
lowercase_ = []
lowercase_ = set()
def _lowercase ( self : Dict ) ... | 97 |
"""simple docstring"""
from __future__ import annotations
import queue
class a :
def __init__( self , UpperCamelCase_ ):
UpperCAmelCase__ : int = data
UpperCAmelCase__ : Dict = None
UpperCAmelCase__ : Optional... | 110 | 0 |
'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging
lowercase__ : Union[str, Any] = logging.get_logger(__name__)
lowercase__ : Optional[Any] = {'ctrl': 'https://huggingface.co/ctrl/resolve/main/config.json'}
class __lowerCAme... | 98 |
"""simple docstring"""
def lowerCamelCase ( _snake_case ,_snake_case ,_snake_case ):
if len(_snake_case ) != len(_snake_case ):
raise ValueError('The length of profit and weight must be same.' )
if max_weight <= 0:
raise ValueError('max_weight must greater than zero.' )
... | 110 | 0 |
# 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 model through reduction of a normal pre-trained model, but keeping the
# full vocab, merges file... | 99 |
"""simple docstring"""
import warnings
from typing import List, Optional, Union
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType
class a ( lowercase ... | 110 | 0 |
import numpy as np
from sklearn.datasets import fetch_california_housing
from sklearn.metrics import mean_absolute_error, mean_squared_error
from sklearn.model_selection import train_test_split
from xgboost import XGBRegressor
def __snake_case ( lowerCAmelCase_ ) -> tuple:
return (da... | 100 |
"""simple docstring"""
from itertools import permutations
def lowerCamelCase ( _snake_case ):
if num[3] % 2 != 0:
return False
if (num[2] + num[3] + num[4]) % 3 != 0:
return False
if num[5] % 5 != 0:
return False
UpperCAmelCase__ : List[str] = ... | 110 | 0 |
import logging
import os
from dataclasses import dataclass, field
from typing import Dict, Optional
import datasets
import numpy as np
import tensorflow as tf
from transformers import (
AutoConfig,
AutoTokenizer,
EvalPrediction,
HfArgumentParser,
PreTrainedTokenizer,
TFAut... | 101 |
"""simple docstring"""
def lowerCamelCase ( _snake_case ,_snake_case ):
UpperCAmelCase__ : Optional[int] = ''
for i in table:
res += inp[i - 1]
return res
def lowerCamelCase ( _snake_case ):
return data[1:] + data[0]
def lowerCamelCase ( ... | 110 | 0 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_torch_available,
)
__magic_name__ : Optional[int] = {
"""configuration_speecht5""": [
""... | 102 |
"""simple docstring"""
from __future__ import annotations
from collections.abc import Iterator
class a :
def __init__( self , UpperCamelCase_ ):
UpperCAmelCase__ : str = value
UpperCAmelCase__ : Node | None = None
... | 110 | 0 |
"""simple docstring"""
# 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.or... | 103 |
"""simple docstring"""
import argparse
import torch
from torch import nn
from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration
def lowerCamelCase ( _snake_case ):
UpperCAmelCase__ : int = [
'encoder.version',
'decoder.version',
'model.enco... | 110 | 0 |
"""simple docstring"""
def _lowerCamelCase ( UpperCAmelCase_ : int = 200 ) -> int:
"""simple docstring"""
A__ = [1, 2, 5, 10, 20, 50, 100, 200]
A__ = [0] * (pence + 1)
A__ = 1 # base case: 1 way to m... | 104 |
"""simple docstring"""
import random
import unittest
import torch
from diffusers import IFImgaImgSuperResolutionPipeline
from diffusers.utils import floats_tensor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import skip_mps, torch_device
from ..pipeline_params... | 110 | 0 |
from math import factorial
def __UpperCAmelCase ( lowerCamelCase_ : int = 1_00 ) -> int:
"""simple docstring"""
return sum(int(lowerCamelCase_ ) for x in str(factorial(lowerCamelCase_ ) ) )
if __name__ == "__main__":
print(solution(int(input('''Enter... | 105 |
"""simple docstring"""
import unittest
from transformers import CamembertTokenizer, CamembertTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow
from transformers.utils import is_torch_available
from ...test_tokenization_common import TokenizerTester... | 110 | 0 |
from __future__ import annotations
import os
import tempfile
import unittest
from transformers import ConvBertConfig, 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... | 106 |
"""simple docstring"""
UpperCamelCase__ = {
'meter': 'm',
'kilometer': 'km',
'megametre': 'Mm',
'gigametre': 'Gm',
'terametre': 'Tm',
'petametre': 'Pm',
'exametre': 'Em',
'zettametre': 'Zm',
'yottametre': 'Ym',
}
# Exponent of the factor(meter)
UpperCamelCase__ ... | 110 | 0 |
'''simple docstring'''
def _SCREAMING_SNAKE_CASE ( __snake_case : int = 4_0_0_0_0_0_0 ):
_A = []
_A , _A = 0, 1
while b <= n:
if b % 2 == 0:
even_fibs.append(__snake_case )
_A , _A = b, a + b
return sum(__s... | 107 |
"""simple docstring"""
import argparse
from copy import deepcopy
import numpy as np
from datasets import ClassLabel, DatasetDict, load_dataset
from evaluate import load
from transformers import (
AutoModelForSequenceClassification,
AutoTokenizer,
DataCollatorWithPadding,
Trainer,
TrainerCallba... | 110 | 0 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_torch_available,
is_vision_available,
)
__a: Dict = {
'''configuration_mobilevit''': ['''MOBILEVIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MobileViTConfi... | 108 |
"""simple docstring"""
from ...configuration_utils import PretrainedConfig
class a ( lowercase ):
UpperCamelCase : Union[str, Any] = """bert-generation"""
def __init__( self , UpperCamelCase_=50_358 , UpperCamelCase_=1_024 , UpperCamelCase_=24 ... | 110 | 0 |
'''simple docstring'''
import pytest
a = "__dummy_dataset1__"
a = "\nimport json\nimport os\n\nimport datasets\n\n\nREPO_URL = \"https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/\"\nURLS = {\"train\": REPO_URL + \"wikiann-bn-train.jsonl\", \"validation\": REPO_URL + \"w... | 109 |
"""simple docstring"""
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.kandin... | 110 | 0 |
'''simple docstring'''
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 Acc... | 314 |
"""simple docstring"""
def lowerCamelCase ( _snake_case ,_snake_case ):
return int((input_a, input_a).count(0 ) == 0 )
def lowerCamelCase ( ):
assert and_gate(0 ,0 ) == 0
assert and_gate(0 ,1 ) == 0
assert and_gate(1 ,0 ) == 0
assert and_gate(1 ,1 ) == 1
if... | 110 | 0 |
"""simple docstring"""
import math
def lowercase__ ( snake_case_ :List[str] ):
__UpperCAmelCase = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 )
return exponent == int(_snake_case )
def lowercase__ ( snake_case... | 49 |
"""simple docstring"""
from typing import Any
class a :
def __init__( self , UpperCamelCase_ ):
UpperCAmelCase__ : Optional[Any] = data
UpperCAmelCase__ : List[str] = None
def __repr__( self ):
retur... | 110 | 0 |
import warnings
from ...utils import is_sklearn_available, requires_backends
if is_sklearn_available():
from scipy.stats import pearsonr, spearmanr
from sklearn.metrics import fa_score, matthews_corrcoef
_SCREAMING_SNAKE_CASE = (
'This metric will be removed from the library soon, m... | 401 |
"""simple docstring"""
import random
def lowerCamelCase ( _snake_case ):
UpperCAmelCase__ : Tuple = num - 1
UpperCAmelCase__ : Dict = 0
while s % 2 == 0:
UpperCAmelCase__ : Optional[int] = s // 2
t += 1
for _ in... | 110 | 0 |
'''simple docstring'''
from typing import List, Optional, Union
import numpy as np
import torch
import torchaudio.compliance.kaldi as ta_kaldi
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ...utils import PaddingStrategy, ... | 126 |
"""simple docstring"""
from __future__ import annotations
UpperCamelCase__ = tuple[int, int, int]
UpperCamelCase__ = tuple[str, str, str]
# used alphabet --------------------------
# from string.ascii_uppercase
UpperCamelCase__ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
# ------------------------... | 110 | 0 |
"""simple docstring"""
_UpperCamelCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
def lowerCAmelCase_ ( SCREAMING_SNAKE_CASE : List[str] ):
'''simple docstring'''
if not isinstance(_snake_case ... | 179 |
"""simple docstring"""
import logging
import random
import ray
from transformers import RagConfig, RagRetriever, RagTokenizer
from transformers.models.rag.retrieval_rag import CustomHFIndex
UpperCamelCase__ = logging.getLogger(__name__)
class a :
def __init__( self ):
... | 110 | 0 |
import argparse
from torch import nn
# transformers_old should correspond to branch `save_old_prophetnet_model_structure` here
# original prophetnet_checkpoints are saved under `patrickvonplaten/..._old` respectively
from transformers_old.modeling_prophetnet import (
ProphetNetForConditionalGeneration as ProphetN... | 537 |
"""simple docstring"""
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roformer import RoForme... | 110 | 0 |
"""simple docstring"""
import copy
from ...configuration_utils import PretrainedConfig
from ...utils import add_start_docstrings
lowercase__ = r"""\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n can be used to control the ... | 610 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_torch_available,
)
UpperCamelCase__ = {
'configuration_mega': ['MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MegaConfig', 'MegaOnnxConfig'],
}
try:
if not is_torch... | 110 | 0 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tf_available,
is_torch_available,
)
__UpperCAmelCase = {
'configuration_vision_encoder_decoder': ['VisionEncoderDecoderConfig', 'VisionEncoderDecoderOnnxCon... | 600 |
"""simple docstring"""
import json
import os
import shutil
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 AutoConfig, BertConfig, GPTaConfig
from t... | 110 | 0 |
"""simple docstring"""
import collections
import importlib.util
import os
import re
from pathlib import Path
a :int = "src/transformers"
# Matches is_xxx_available()
a :Optional[Any] = re.compile(r"is\_([a-z_]*)_available()")
# Catches a one-line _import_struct = {xxx}
a :str =... | 680 |
"""simple docstring"""
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 buck... | 110 | 0 |
'''simple docstring'''
import numpy as np
from transformers import BatchFeature
from transformers.testing_utils import require_tf, require_torch
from .test_feature_extraction_common import FeatureExtractionSavingTestMixin
class UpperCAmelCase__ ( lowercase__ ):
"""simple docstring"... | 229 |
"""simple docstring"""
from __future__ import annotations
import queue
class a :
def __init__( self , UpperCamelCase_ ):
UpperCAmelCase__ : int = data
UpperCAmelCase__ : Dict = None
UpperCAmelCase__ : Optional... | 110 | 0 |
import os
import socket
from contextlib import contextmanager
import torch
from ..commands.config.default import write_basic_config # noqa: F401
from ..state import PartialState
from .dataclasses import DistributedType
from .imports import is_deepspeed_available, is_tpu_available
from .transformer_engine import c... | 639 |
"""simple docstring"""
def lowerCamelCase ( _snake_case ,_snake_case ,_snake_case ):
if len(_snake_case ) != len(_snake_case ):
raise ValueError('The length of profit and weight must be same.' )
if max_weight <= 0:
raise ValueError('max_weight must greater than zero.' )
... | 110 | 0 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tf_available,
is_tokenizers_available,
is_torch_available,
is_vision_available,
)
lowercase_ = {
"""configuration_cl... | 314 |
"""simple docstring"""
import warnings
from typing import List, Optional, Union
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType
class a ( lowercase ... | 110 | 0 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
_lowercase : Tuple = {
'configuration_upernet': ['UperNetConfig'],
}
try:
if not is_torch_available():
raise Optional... | 49 |
"""simple docstring"""
from itertools import permutations
def lowerCamelCase ( _snake_case ):
if num[3] % 2 != 0:
return False
if (num[2] + num[3] + num[4]) % 3 != 0:
return False
if num[5] % 5 != 0:
return False
UpperCAmelCase__ : List[str] = ... | 110 | 0 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
_SCREAMING_SNAKE_CASE = logging.get_logger(__name__)
_SCREAMING_SNAKE_CASE = {
'uw-madison/mra-base-512-4': 'https://huggingface.co/uw-madison/mra-base-512-4/resolve/main/config.json',
}
class ... | 401 |
"""simple docstring"""
def lowerCamelCase ( _snake_case ,_snake_case ):
UpperCAmelCase__ : Optional[int] = ''
for i in table:
res += inp[i - 1]
return res
def lowerCamelCase ( _snake_case ):
return data[1:] + data[0]
def lowerCamelCase ( ... | 110 | 0 |
'''simple docstring'''
import argparse
import io
import requests
import torch
from omegaconf import OmegaConf
from diffusers import AutoencoderKL
from diffusers.pipelines.stable_diffusion.convert_from_ckpt import (
assign_to_checkpoint,
conv_attn_to_linear,
create_vae_diffusers_config,
renew... | 126 |
"""simple docstring"""
from __future__ import annotations
from collections.abc import Iterator
class a :
def __init__( self , UpperCamelCase_ ):
UpperCAmelCase__ : str = value
UpperCAmelCase__ : Node | None = None
... | 110 | 0 |
"""simple docstring"""
import logging
import os
import sys
from pathlib import Path
from unittest.mock import patch
from parameterized import parameterized
from run_eval import run_generate
from run_eval_search import run_search
from transformers.testing_utils import CaptureStdout, Te... | 179 |
"""simple docstring"""
import argparse
import torch
from torch import nn
from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration
def lowerCamelCase ( _snake_case ):
UpperCAmelCase__ : int = [
'encoder.version',
'decoder.version',
'model.enco... | 110 | 0 |
import torch
from diffusers import EulerDiscreteScheduler
from diffusers.utils import torch_device
from .test_schedulers import SchedulerCommonTest
class SCREAMING_SNAKE_CASE_ ( __lowerCAmelCase ):
__lowerCAmelCase = (EulerDiscreteScheduler,)
__lowerCAmelCase = 10
def ... | 537 |
"""simple docstring"""
import random
import unittest
import torch
from diffusers import IFImgaImgSuperResolutionPipeline
from diffusers.utils import floats_tensor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import skip_mps, torch_device
from ..pipeline_params... | 110 | 0 |
"""simple docstring"""
from __future__ import annotations
def __lowerCamelCase ( __UpperCamelCase ) -> Union[str, Any]:
"""simple docstring"""
if not nums:
return 0
lowerCAmelCase_ : Optional[int] = nums[0]
lowerCAmelCase_ : str = 0
... | 610 |
"""simple docstring"""
import unittest
from transformers import CamembertTokenizer, CamembertTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow
from transformers.utils import is_torch_available
from ...test_tokenization_common import TokenizerTester... | 110 | 0 |
def __UpperCamelCase ( lowercase__ : List[str] = 1000 ) -> int:
'''simple docstring'''
lowerCAmelCase_ : str = -1
lowerCAmelCase_ : List[Any] = 0
for a in range(1 , n // 3 ):
# Solving the two equations a**2+b**... | 600 |
"""simple docstring"""
UpperCamelCase__ = {
'meter': 'm',
'kilometer': 'km',
'megametre': 'Mm',
'gigametre': 'Gm',
'terametre': 'Tm',
'petametre': 'Pm',
'exametre': 'Em',
'zettametre': 'Zm',
'yottametre': 'Ym',
}
# Exponent of the factor(meter)
UpperCamelCase__ ... | 110 | 0 |
"""simple docstring"""
import itertools
from dataclasses import dataclass
from typing import List, Optional
import pyarrow as pa
import pyarrow.parquet as pq
import datasets
from datasets.table import table_cast
a :Optional[int] = datasets.utils.logging.get_logger(__name__)
@dataclass
class __a ... | 680 |
"""simple docstring"""
import argparse
from copy import deepcopy
import numpy as np
from datasets import ClassLabel, DatasetDict, load_dataset
from evaluate import load
from transformers import (
AutoModelForSequenceClassification,
AutoTokenizer,
DataCollatorWithPadding,
Trainer,
TrainerCallba... | 110 | 0 |
'''simple docstring'''
import gc
import unittest
import numpy as np
import torch
import torch.nn.functional as F
from transformers import (
ClapTextConfig,
ClapTextModelWithProjection,
RobertaTokenizer,
SpeechTaHifiGan,
SpeechTaHifiGanConfig,
)
from diffusers import (
AudioLDMPipeline,... | 229 |
"""simple docstring"""
from ...configuration_utils import PretrainedConfig
class a ( lowercase ):
UpperCamelCase : Union[str, Any] = """bert-generation"""
def __init__( self , UpperCamelCase_=50_358 , UpperCamelCase_=1_024 , UpperCamelCase_=24 ... | 110 | 0 |
import argparse
import copy
def lowercase_ ( _UpperCamelCase ):
'''simple docstring'''
__lowercase = {}
with open(_snake_case ) as f:
for line in f:
if line.split()[0] not in dict_of_neighbours:
__lowercase = []
_list.append([line.split... | 639 |
"""simple docstring"""
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.kandin... | 110 | 0 |
'''simple docstring'''
from random import shuffle
import tensorflow as tf
from numpy import array
def lowerCamelCase ( __lowerCamelCase : List[str] , __lowerCamelCase : Any ) ->Any:
_SCREAMING_SNAKE_CASE = int(_snake_case )
assert noofclusters < le... | 314 |
"""simple docstring"""
def lowerCamelCase ( _snake_case ,_snake_case ):
return int((input_a, input_a).count(0 ) == 0 )
def lowerCamelCase ( ):
assert and_gate(0 ,0 ) == 0
assert and_gate(0 ,1 ) == 0
assert and_gate(1 ,0 ) == 0
assert and_gate(1 ,1 ) == 1
if... | 110 | 0 |
"""simple docstring"""
from collections import OrderedDict
from typing import Mapping
from packaging import version
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
_lowercase : Optional[Any] = logging.get_logger... | 49 |
"""simple docstring"""
from typing import Any
class a :
def __init__( self , UpperCamelCase_ ):
UpperCAmelCase__ : Optional[Any] = data
UpperCAmelCase__ : List[str] = None
def __repr__( self ):
retur... | 110 | 0 |
def snake_case ( ) -> Tuple:
_A = 0
for i in range(1 , 1_001):
total += i**i
return str(_snake_case)[-10:]
if __name__ == "__main__":
print(solution())
| 401 |
"""simple docstring"""
import random
def lowerCamelCase ( _snake_case ):
UpperCAmelCase__ : Tuple = num - 1
UpperCAmelCase__ : Dict = 0
while s % 2 == 0:
UpperCAmelCase__ : Optional[int] = s // 2
t += 1
for _ in... | 110 | 0 |
'''simple docstring'''
from dataclasses import asdict, dataclass
from typing import Optional
from ...configuration_utils import PretrainedConfig
from ...utils import logging
_A: Union[str, Any] = logging.get_logger(__name__)
# TODO Update this
_A: Tuple = {
"""fac... | 126 |
"""simple docstring"""
from __future__ import annotations
UpperCamelCase__ = tuple[int, int, int]
UpperCamelCase__ = tuple[str, str, str]
# used alphabet --------------------------
# from string.ascii_uppercase
UpperCamelCase__ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
# ------------------------... | 110 | 0 |
"""simple docstring"""
from __future__ import annotations
from collections.abc import Generator
import requests
from bsa import BeautifulSoup
_UpperCamelCase = 'https://www.indeed.co.in/jobs?q=mobile+app+development&l='
def lowerCAmelCase_ ( SCREAMING_SNAK... | 179 |
"""simple docstring"""
import logging
import random
import ray
from transformers import RagConfig, RagRetriever, RagTokenizer
from transformers.models.rag.retrieval_rag import CustomHFIndex
UpperCamelCase__ = logging.getLogger(__name__)
class a :
def __init__( self ):
... | 110 | 0 |
import fire
from utils import calculate_rouge, save_json
def lowercase( UpperCamelCase_ , UpperCamelCase_ , UpperCamelCase_=None , **UpperCamelCase_ ) -> Optional[Any]:
'''simple docstring'''
UpperCamelCase = [x.strip() for x in open(_snake_case ).re... | 537 |
"""simple docstring"""
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roformer import RoForme... | 110 | 0 |
"""simple docstring"""
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
lowercase__ = """."""
if __name__ == "__main__":
lowercase__ = os.path.join(REPO_PATH, """utils/documentation_t... | 610 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_torch_available,
)
UpperCamelCase__ = {
'configuration_mega': ['MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MegaConfig', 'MegaOnnxConfig'],
}
try:
if not is_torch... | 110 | 0 |
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 __a ( __UpperCamel... | 600 |
"""simple docstring"""
import json
import os
import shutil
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 AutoConfig, BertConfig, GPTaConfig
from t... | 110 | 0 |
"""simple docstring"""
from ....configuration_utils import PretrainedConfig
from ....utils import logging
a :int = logging.get_logger(__name__)
a :Optional[Any] = {
"CarlCochet/trajectory-transformer-halfcheetah-medium-v2": (
"https://huggingface.co/CarlCochet/trajectory-trans... | 680 |
"""simple docstring"""
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 buck... | 110 | 0 |
'''simple docstring'''
import argparse
import random
import joblib
import numpy as np
import torch
from igf.igf import (
SecondaryLearner,
collect_objective_set,
compute_perplexity,
generate_datasets,
load_gpta,
recopy_gpta,
set_seed,
train_secondary_learner,
)
from torch.utils.... | 229 |
"""simple docstring"""
from __future__ import annotations
import queue
class a :
def __init__( self , UpperCamelCase_ ):
UpperCAmelCase__ : int = data
UpperCAmelCase__ : Dict = None
UpperCAmelCase__ : Optional... | 110 | 0 |
from __future__ import annotations
def lowercase_ ( _UpperCamelCase , _UpperCamelCase ):
'''simple docstring'''
if nth_term == "":
return [""]
__lowercase = int(_snake_case )
__lowercase = int(_snake_case )
__lowercase = []
for temp in range... | 639 |
"""simple docstring"""
def lowerCamelCase ( _snake_case ,_snake_case ,_snake_case ):
if len(_snake_case ) != len(_snake_case ):
raise ValueError('The length of profit and weight must be same.' )
if max_weight <= 0:
raise ValueError('max_weight must greater than zero.' )
... | 110 | 0 |
'''simple docstring'''
def lowerCamelCase ( __lowerCamelCase : Union[str, Any] , __lowerCamelCase : Optional[Any] , __lowerCamelCase : Tuple ) ->str:
if len(_snake_case ) != len(_snake_case ):
raise ValueError("""The length of profit and weigh... | 314 |
"""simple docstring"""
import warnings
from typing import List, Optional, Union
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType
class a ( lowercase ... | 110 | 0 |
"""simple docstring"""
from pathlib import Path
import json
import tempfile
from transformers import FSMTTokenizer, FSMTConfig, FSMTForConditionalGeneration
from transformers.models.fsmt.tokenization_fsmt import VOCAB_FILES_NAMES
_lowercase : List[Any] = 'tiny-wmt19-en-ru'
# B... | 49 |
"""simple docstring"""
from itertools import permutations
def lowerCamelCase ( _snake_case ):
if num[3] % 2 != 0:
return False
if (num[2] + num[3] + num[4]) % 3 != 0:
return False
if num[5] % 5 != 0:
return False
UpperCAmelCase__ : List[str] = ... | 110 | 0 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
_SCREAMING_SNAKE_CASE = logging.get_logger(__name__)
_SCREAMING_SNAKE_CASE = {
'tiiuae/falcon-40b': 'https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json',
'tiiuae/falcon-7b': 'https://hugg... | 401 |
"""simple docstring"""
def lowerCamelCase ( _snake_case ,_snake_case ):
UpperCAmelCase__ : Optional[int] = ''
for i in table:
res += inp[i - 1]
return res
def lowerCamelCase ( _snake_case ):
return data[1:] + data[0]
def lowerCamelCase ( ... | 110 | 0 |
'''simple docstring'''
import timeit
import numpy as np
import datasets
from datasets.arrow_writer import ArrowWriter
from datasets.features.features import _ArrayXD
def _lowerCAmelCase ( _lowerCAmelCase )-> Any:
def wrapper(*_lowerCAmelCase , **_lowerCAmelCase ):
__UpperCAme... | 126 |
"""simple docstring"""
from __future__ import annotations
from collections.abc import Iterator
class a :
def __init__( self , UpperCamelCase_ ):
UpperCAmelCase__ : str = value
UpperCAmelCase__ : Node | None = None
... | 110 | 0 |
"""simple docstring"""
_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=... | 179 |
"""simple docstring"""
import argparse
import torch
from torch import nn
from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration
def lowerCamelCase ( _snake_case ):
UpperCAmelCase__ : int = [
'encoder.version',
'decoder.version',
'model.enco... | 110 | 0 |
import argparse
import shlex
import runhouse as rh
if __name__ == "__main__":
# Refer to https://runhouse-docs.readthedocs-hosted.com/en/latest/api/python/cluster.html#hardware-setup for cloud access
# setup instructions, if using on-demand hardware
# If user passes --user <user> --host <host> --key_... | 537 |
"""simple docstring"""
import random
import unittest
import torch
from diffusers import IFImgaImgSuperResolutionPipeline
from diffusers.utils import floats_tensor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import skip_mps, torch_device
from ..pipeline_params... | 110 | 0 |
"""simple docstring"""
import os
from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home
lowercase__ = HUGGINGFACE_HUB_CACHE
lowercase__ = """config.json"""
lowercase__ = """diffusion_pytorch_model.bin"""
lowercase__ = """diffusion_flax_model.msgpack"""
lo... | 610 |
"""simple docstring"""
import unittest
from transformers import CamembertTokenizer, CamembertTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow
from transformers.utils import is_torch_available
from ...test_tokenization_common import TokenizerTester... | 110 | 0 |
import argparse
from copy import deepcopy
import numpy as np
from datasets import ClassLabel, DatasetDict, load_dataset
from evaluate import load
from transformers import (
AutoModelForSequenceClassification,
AutoTokenizer,
DataCollatorWithPadding,
Trainer,
TrainerCallback,
TrainingArgum... | 600 |
"""simple docstring"""
UpperCamelCase__ = {
'meter': 'm',
'kilometer': 'km',
'megametre': 'Mm',
'gigametre': 'Gm',
'terametre': 'Tm',
'petametre': 'Pm',
'exametre': 'Em',
'zettametre': 'Zm',
'yottametre': 'Ym',
}
# Exponent of the factor(meter)
UpperCamelCase__ ... | 110 | 0 |
"""simple docstring"""
a :Union[str, Any] = {str(digit): digit**5 for digit in range(10)}
def _lowercase ( __lowerCAmelCase ) -> Optional[Any]:
return sum(DIGITS_FIFTH_POWER[digit] for digit in str(_snake_case ) )
def _lowercase ( ) -> ... | 680 |
"""simple docstring"""
import argparse
from copy import deepcopy
import numpy as np
from datasets import ClassLabel, DatasetDict, load_dataset
from evaluate import load
from transformers import (
AutoModelForSequenceClassification,
AutoTokenizer,
DataCollatorWithPadding,
Trainer,
TrainerCallba... | 110 | 0 |
'''simple docstring'''
import requests
__lowerCAmelCase = """https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey="""
def UpperCAmelCase_ (__a : List[str] ):
"""simple docstring"""
_a : int = requests.get(_NEWS_API + bbc_news_api_key ... | 229 |
"""simple docstring"""
from ...configuration_utils import PretrainedConfig
class a ( lowercase ):
UpperCamelCase : Union[str, Any] = """bert-generation"""
def __init__( self , UpperCamelCase_=50_358 , UpperCamelCase_=1_024 , UpperCamelCase_=24 ... | 110 | 0 |
from typing import Dict, Iterable, Optional, Union
import numpy as np
from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import normalize, rescale, resize, to_channel_dimension_format, to_pil_image
from ...image_utils import (
IMAGENET_STANDARD_MEAN,
... | 639 |
"""simple docstring"""
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.kandin... | 110 | 0 |
'''simple docstring'''
from collections import defaultdict
def lowerCamelCase ( __lowerCamelCase : Union[str, Any] ) ->Tuple:
_SCREAMING_SNAKE_CASE = 1
_SCREAMING_SNAKE_CASE = True
for v in tree[start]:
if v not in visited:
ret += d... | 314 |
"""simple docstring"""
def lowerCamelCase ( _snake_case ,_snake_case ):
return int((input_a, input_a).count(0 ) == 0 )
def lowerCamelCase ( ):
assert and_gate(0 ,0 ) == 0
assert and_gate(0 ,1 ) == 0
assert and_gate(1 ,0 ) == 0
assert and_gate(1 ,1 ) == 1
if... | 110 | 0 |
"""simple docstring"""
import argparse
import json
from collections import OrderedDict
from pathlib import Path
import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerI... | 49 |
"""simple docstring"""
from typing import Any
class a :
def __init__( self , UpperCamelCase_ ):
UpperCAmelCase__ : Optional[Any] = data
UpperCAmelCase__ : List[str] = None
def __repr__( self ):
retur... | 110 | 0 |
import numpy as np
def snake_case ( snake_case__ :Union[str, Any]) -> Optional[Any]:
return 1 / (1 + np.exp(-vector))
def snake_case ( snake_case__ :Any) -> Dict:
return vector * sigmoid(_snake_case)
if __name__ == "__main__":
import do... | 401 |
"""simple docstring"""
import random
def lowerCamelCase ( _snake_case ):
UpperCAmelCase__ : Tuple = num - 1
UpperCAmelCase__ : Dict = 0
while s % 2 == 0:
UpperCAmelCase__ : Optional[int] = s // 2
t += 1
for _ in... | 110 | 0 |
'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging
_A: List[str] = logging.get_logger(__name__)
_A: Union[str, Any] = {
"""facebook/dpr-ctx_encoder-single-nq-base""": (
"""https://huggingface.co/facebook/... | 126 |
"""simple docstring"""
from __future__ import annotations
UpperCamelCase__ = tuple[int, int, int]
UpperCamelCase__ = tuple[str, str, str]
# used alphabet --------------------------
# from string.ascii_uppercase
UpperCamelCase__ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
# ------------------------... | 110 | 0 |
"""simple docstring"""
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 ... | 179 |
"""simple docstring"""
import logging
import random
import ray
from transformers import RagConfig, RagRetriever, RagTokenizer
from transformers.models.rag.retrieval_rag import CustomHFIndex
UpperCamelCase__ = logging.getLogger(__name__)
class a :
def __init__( self ):
... | 110 | 0 |
import unittest
import numpy as np
import torch
from diffusers import VersatileDiffusionImageVariationPipeline
from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device
_SCREAMING_SNAKE_CASE = False
class SCREAMING_SNAKE_CASE_ ( unittest.TestCase ):
pass
@slow... | 537 |
"""simple docstring"""
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_roformer import RoForme... | 110 | 0 |
"""simple docstring"""
from diffusers.utils.testing_utils import require_onnxruntime
@require_onnxruntime
class __lowerCamelCase :
'''simple docstring'''
pass
| 610 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_torch_available,
)
UpperCamelCase__ = {
'configuration_mega': ['MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MegaConfig', 'MegaOnnxConfig'],
}
try:
if not is_torch... | 110 | 0 |
import gc
import random
import tempfile
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DDIMInverseScheduler,
DDIMScheduler,
DPMSolverMultistepInverseScheduler,
... | 600 |
"""simple docstring"""
import json
import os
import shutil
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 AutoConfig, BertConfig, GPTaConfig
from t... | 110 | 0 |
"""simple docstring"""
import json
from typing import TYPE_CHECKING, List, Optional, Tuple
from tokenizers import pre_tokenizers
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
if TYPE_CHECKING:
from transformers.pipelines.conversational import Conversation
a ... | 680 |
"""simple docstring"""
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 buck... | 110 | 0 |
'''simple docstring'''
import os
import jsonlines
import numpy as np
from tqdm import tqdm
__lowerCAmelCase = 2_0_4_8
__lowerCAmelCase = 4_0_9_6
__lowerCAmelCase = 4_2
__lowerCAmelCase = os.environ.pop("""PROCESS_TRAIN""", """false""")
__lowerCAmelCase = {"""null""": 0... | 229 |
"""simple docstring"""
from __future__ import annotations
import queue
class a :
def __init__( self , UpperCamelCase_ ):
UpperCAmelCase__ : int = data
UpperCAmelCase__ : Dict = None
UpperCAmelCase__ : Optional... | 110 | 0 |
def lowercase_ ( _UpperCamelCase , _UpperCamelCase ):
'''simple docstring'''
if a < 0 or b < 0:
raise ValueError('''the value of both inputs must be positive''' )
__lowercase = str(bin(_snake_case ) )[2:] # remove the leading "0b"
__lowercase = str(bin(_sn... | 639 |
"""simple docstring"""
def lowerCamelCase ( _snake_case ,_snake_case ,_snake_case ):
if len(_snake_case ) != len(_snake_case ):
raise ValueError('The length of profit and weight must be same.' )
if max_weight <= 0:
raise ValueError('max_weight must greater than zero.' )
... | 110 | 0 |
'''simple docstring'''
from typing import Any, Dict, Optional
import torch
import torch.nn.functional as F
from torch import nn
from ..utils import maybe_allow_in_graph
from .activations import get_activation
from .attention_processor import Attention
from .embeddings import CombinedTimestepLabelEmbeddings
@... | 314 |
"""simple docstring"""
import warnings
from typing import List, Optional, Union
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
from ...utils import TensorType
class a ( lowercase ... | 110 | 0 |
"""simple docstring"""
import argparse
import json
from pathlib import Path
import requests
import torch
from huggingface_hub import cached_download, hf_hub_url
from PIL import Image
from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor
from tr... | 49 |
"""simple docstring"""
from itertools import permutations
def lowerCamelCase ( _snake_case ):
if num[3] % 2 != 0:
return False
if (num[2] + num[3] + num[4]) % 3 != 0:
return False
if num[5] % 5 != 0:
return False
UpperCAmelCase__ : List[str] = ... | 110 | 0 |
from statistics import mean
import numpy as np
def snake_case ( snake_case__ :List[Any] , snake_case__ :Union[str, Any] , snake_case__ :int , snake_case__ :List[Any]) -> int:
_A = 0
# Number of processes finished
_A = 0
... | 401 |
"""simple docstring"""
def lowerCamelCase ( _snake_case ,_snake_case ):
UpperCAmelCase__ : Optional[int] = ''
for i in table:
res += inp[i - 1]
return res
def lowerCamelCase ( _snake_case ):
return data[1:] + data[0]
def lowerCamelCase ( ... | 110 | 0 |
'''simple docstring'''
import warnings
from ...utils import logging
from .image_processing_deit import DeiTImageProcessor
_A: str = logging.get_logger(__name__)
class UpperCAmelCase ( UpperCAmelCase_ ):
def __init__( self , *__A , **__A ):
warni... | 126 |
"""simple docstring"""
from __future__ import annotations
from collections.abc import Iterator
class a :
def __init__( self , UpperCamelCase_ ):
UpperCAmelCase__ : str = value
UpperCAmelCase__ : Node | None = None
... | 110 | 0 |
"""simple docstring"""
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 ...sch... | 179 |
"""simple docstring"""
import argparse
import torch
from torch import nn
from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration
def lowerCamelCase ( _snake_case ):
UpperCAmelCase__ : int = [
'encoder.version',
'decoder.version',
'model.enco... | 110 | 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
_SCREAMING_SNAKE_CASE = logging.get_logger(__name__)
_SCREAMING_SNAKE_CASE = {
"""facebook/l... | 537 |
"""simple docstring"""
import random
import unittest
import torch
from diffusers import IFImgaImgSuperResolutionPipeline
from diffusers.utils import floats_tensor
from diffusers.utils.import_utils import is_xformers_available
from diffusers.utils.testing_utils import skip_mps, torch_device
from ..pipeline_params... | 110 | 0 |
"""simple docstring"""
import fire
from torch.utils.data import DataLoader
from tqdm import tqdm
from transformers import AutoTokenizer
from utils import SeqaSeqDataset, pickle_save
def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase=1024 , __UpperCamelCase=1024 ,... | 610 |
"""simple docstring"""
import unittest
from transformers import CamembertTokenizer, CamembertTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow
from transformers.utils import is_torch_available
from ...test_tokenization_common import TokenizerTester... | 110 | 0 |
import random
def __UpperCamelCase ( lowercase__ : Optional[int] ) -> Tuple:
'''simple docstring'''
lowerCAmelCase_ : Tuple = num - 1
lowerCAmelCase_ : Dict = 0
while s % 2 == 0:
lowerCAmelCase_ : Optional... | 600 |
"""simple docstring"""
UpperCamelCase__ = {
'meter': 'm',
'kilometer': 'km',
'megametre': 'Mm',
'gigametre': 'Gm',
'terametre': 'Tm',
'petametre': 'Pm',
'exametre': 'Em',
'zettametre': 'Zm',
'yottametre': 'Ym',
}
# Exponent of the factor(meter)
UpperCamelCase__ ... | 110 | 0 |
"""simple docstring"""
import json
import os
import unittest
from transformers import CLIPTokenizer, CLIPTokenizerFast
from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES
from transformers.testing_utils import require_ftfy, require_tokenizers
from ...test_tokenization_common import TokenizerT... | 680 |
"""simple docstring"""
import argparse
from copy import deepcopy
import numpy as np
from datasets import ClassLabel, DatasetDict, load_dataset
from evaluate import load
from transformers import (
AutoModelForSequenceClassification,
AutoTokenizer,
DataCollatorWithPadding,
Trainer,
TrainerCallba... | 110 | 0 |
'''simple docstring'''
from __future__ import annotations
def UpperCAmelCase_ (__a : Tuple , __a : str = None , __a : Tuple = None ):
"""simple docstring"""
if start is None:
_a : List[str] = 0
if end is None:
_a ... | 229 |
"""simple docstring"""
from ...configuration_utils import PretrainedConfig
class a ( lowercase ):
UpperCamelCase : Union[str, Any] = """bert-generation"""
def __init__( self , UpperCamelCase_=50_358 , UpperCamelCase_=1_024 , UpperCamelCase_=24 ... | 110 | 0 |
import os
from shutil import copyfile
from typing import List, Optional, Tuple
from ...tokenization_utils import AddedToken
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import is_sentencepiece_available, logging
if is_sentencepiece_available():
from .tokenization_albert import Alb... | 639 |
"""simple docstring"""
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.kandin... | 110 | 0 |
'''simple docstring'''
import copy
from typing import Any, Dict, List, Optional, Union
import numpy as np
from ...audio_utils import mel_filter_bank, spectrogram, window_function
from ...feature_extraction_sequence_utils import SequenceFeatureExtractor
from ...feature_extraction_utils import BatchFeature
from ... | 314 |
"""simple docstring"""
def lowerCamelCase ( _snake_case ,_snake_case ):
return int((input_a, input_a).count(0 ) == 0 )
def lowerCamelCase ( ):
assert and_gate(0 ,0 ) == 0
assert and_gate(0 ,1 ) == 0
assert and_gate(1 ,0 ) == 0
assert and_gate(1 ,1 ) == 1
if... | 110 | 0 |
"""simple docstring"""
def lowercase__ ( snake_case_ :Dict , snake_case_ :List[Any] ):
__UpperCAmelCase = ''
for i in table:
res += inp[i - 1]
return res
def lowercase__ ( snake_case_ :Optional[Any] ):
return data[1:] + data[0]
... | 49 |
"""simple docstring"""
from typing import Any
class a :
def __init__( self , UpperCamelCase_ ):
UpperCAmelCase__ : Optional[Any] = data
UpperCAmelCase__ : List[str] = None
def __repr__( self ):
retur... | 110 | 0 |
import sys
from typing import Tuple
import numpy as np
import torch
from PIL import Image
from torch import nn
from transformers.image_utils import PILImageResampling
from utils import img_tensorize
class a :
"""simple docstring"""
def __init__( self , ... | 401 |
"""simple docstring"""
import random
def lowerCamelCase ( _snake_case ):
UpperCAmelCase__ : Tuple = num - 1
UpperCAmelCase__ : Dict = 0
while s % 2 == 0:
UpperCAmelCase__ : Optional[int] = s // 2
t += 1
for _ in... | 110 | 0 |
'''simple docstring'''
import re
def _lowerCAmelCase ( _lowerCAmelCase )-> str:
if len(re.findall('[ATCG]' , _snake_case ) ) != len(_snake_case ):
raise ValueError('Invalid Strand' )
return dna.translate(dna.maketrans('ATCG' , 'TAGC' ) )
if __... | 126 |
"""simple docstring"""
from __future__ import annotations
UpperCamelCase__ = tuple[int, int, int]
UpperCamelCase__ = tuple[str, str, str]
# used alphabet --------------------------
# from string.ascii_uppercase
UpperCamelCase__ = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
# ------------------------... | 110 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.