code stringlengths 81 54k | code_codestyle int64 0 721 | style_context stringlengths 91 41.9k | style_context_codestyle int64 0 699 | label int64 0 1 |
|---|---|---|---|---|
"""simple docstring"""
import copy
from dataclasses import dataclass, field
from typing import ClassVar, Dict
from ..features import ClassLabel, Features, Value
from .base import TaskTemplate
@dataclass(frozen=__UpperCAmelCase )
class snake_case ( __UpperCAmelCase ):
... | 702 | """simple docstring"""
from typing import Optional
import numpy as np
import torch
from torch import nn
from transformers import GPTaConfig, GPTaLMHeadModel
from transformers.modeling_utils import ModuleUtilsMixin
from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixi... | 632 | 0 |
"""simple docstring"""
import unittest
from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer
from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow
from transformers.utils import cached_property
from ...test_tokenization_co... | 703 | """simple docstring"""
import argparse
import os
import jax as jnp
import numpy as onp
import torch
import torch.nn as nn
from music_spectrogram_diffusion import inference
from tax import checkpoints
from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline
from diffusers.pipelines.spe... | 632 | 0 |
import json
import os
import re
import shutil
import tempfile
import unittest
from typing import Tuple
from transformers import AddedToken, BatchEncoding, PerceiverTokenizer
from transformers.utils import cached_property, is_tf_available, is_torch_available
from ...test_tokenization_common import TokenizerTesterMixin... | 704 | """simple docstring"""
import socket
def a_ ( ):
UpperCAmelCase__ = socket.socket(socket.AF_INET , socket.SOCK_STREAM )
UpperCAmelCase__ = socket.gethostname()
UpperCAmelCase__ = 1_2_3_1_2
sock.connect((host, port) )
sock.send(b'Hello server!'... | 632 | 0 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_torch_available,
)
lowerCAmelCase__ : int = {
'configuration_speecht5': [
'SPEECHT5_PRETRAINED_CONFIG_ARCHIVE_MAP... | 705 | """simple docstring"""
from __future__ import annotations
class snake_case :
"""simple docstring"""
def __init__( self : Dict ,lowerCamelCase__ : list[list[int]] ):
UpperCAmelCase__ = TypeError(
'Matrices must be formed from a list of z... | 632 | 0 |
"""simple docstring"""
from dataclasses import dataclass
from typing import Dict, Optional, Union
import torch
import torch.nn.functional as F
from torch import nn
from ..configuration_utils import ConfigMixin, register_to_config
from ..utils import BaseOutput
from .attention import BasicTransformerBlock
from .... | 706 | """simple docstring"""
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
lowerCAmelCase__ : int = {
'configuration_tapas': ['TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TapasConfig'],
'tokenization_tapas': ['... | 632 | 0 |
"""simple docstring"""
import webbrowser
from sys import argv
from urllib.parse import parse_qs, quote
import requests
from bsa import BeautifulSoup
from fake_useragent import UserAgent
if __name__ == "__main__":
lowerCAmelCase__ : Tuple = '%20'.join(argv[1:]) if len(argv) > 1 else quote... | 707 | """simple docstring"""
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
lowerCAmelCase__ : Optional[int] = False
class snake_case ( ... | 632 | 0 |
"""simple docstring"""
def a_ ( lowerCamelCase = 1_0_0_0_0_0_0 ):
UpperCAmelCase__ = limit + 1
UpperCAmelCase__ = [0] * limit
for first_term in range(1 , lowerCamelCase ):
for n in range(lowerCamelCase , lowerCamelCase , lowerCamelCase ):
... | 708 | """simple docstring"""
from __future__ import annotations
from math import ceil, floor, sqrt
def a_ ( lowerCamelCase = 2_0_0_0_0_0_0 ):
UpperCAmelCase__ = [0]
UpperCAmelCase__ = 42
for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ):
triangle_number... | 632 | 0 |
import json
import os
from typing import Dict, List, Optional, Tuple
import regex as re
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging
lowerCAmelCase__ : List[str] = logging.get_logger(__name__)
lowerCAmelCase__ : List[Any] = {
'vocab_file': 'v... | 709 | """simple docstring"""
import argparse
from pathlib import Path
from typing import Dict, OrderedDict, Tuple
import torch
from audiocraft.models import MusicGen
from transformers import (
AutoFeatureExtractor,
AutoTokenizer,
EncodecModel,
MusicgenDecoderConfig,
MusicgenForConditionalGeneratio... | 632 | 0 |
"""simple docstring"""
def a_ ( lowerCamelCase ):
if length <= 0 or not isinstance(lowerCamelCase , lowerCamelCase ):
raise ValueError('Length must be a positive integer.' )
return [n * (2 * n - 1) for n in range(lowerCamelCase )]
if __name__ == "__main__":
print(hexag... | 710 | """simple docstring"""
lowerCAmelCase__ : Tuple = range(2, 20 + 1)
lowerCAmelCase__ : Optional[Any] = [10**k for k in range(ks[-1] + 1)]
lowerCAmelCase__ : dict[int, dict[int, list[list[int]]]] = {}
def a_ ( lowerCamelCase , lowerCamelCase ,... | 632 | 0 |
"""simple docstring"""
import argparse
import torch
from transformers import YosoConfig, YosoForMaskedLM
def a_ ( lowerCamelCase ):
if "model" in orig_key:
UpperCAmelCase__ = orig_key.replace('model.' , '' )
if "norm1" in orig_key:
UpperCAmelCase__ = ... | 711 | """simple docstring"""
import random
class snake_case :
"""simple docstring"""
@staticmethod
def __lowerCAmelCase ( lowerCamelCase__ : str ):
UpperCAmelCase__ = [ord(lowerCamelCase__ ) for i in text]
UpperCAmelCase__ = []
... | 632 | 0 |
"""simple docstring"""
import pytest
import datasets.config
from datasets.utils.info_utils import is_small_dataset
@pytest.mark.parametrize('dataset_size' , [None, 4_0_0 * 2**2_0, 6_0_0 * 2**2_0] )
@pytest.mark.parametrize('input_in_memory_max_size' , ['default', 0, 1_0_0 * 2**2_0, 9_0_0 * 2**... | 712 | """simple docstring"""
import re
def a_ ( lowerCamelCase ):
return [char.split() for char in re.split(r'[^ a-z A-Z 0-9 \s]' , str_ )]
def a_ ( lowerCamelCase ):
UpperCAmelCase__ = split_input(str_ )
return "".join(
[''.join([char.capitalize() for ... | 632 | 0 |
"""simple docstring"""
def a_ ( ):
return 1
def a_ ( lowerCamelCase ):
return 0 if x < 0 else two_pence(x - 2 ) + one_pence()
def a_ ( lowerCamelCase ):
return 0 if x < 0 else five_pence(x - 5 ) + two_pence(lowerCamelCase )
def a_ ( lowerCamelCa... | 713 | """simple docstring"""
import shutil
import tempfile
import unittest
import numpy as np
from transformers.testing_utils import (
is_pt_tf_cross_test,
require_tf,
require_torch,
require_torchvision,
require_vision,
)
from transformers.utils import is_tf_available, is_torch_available, is_visio... | 632 | 0 |
"""simple docstring"""
from __future__ import absolute_import, division, print_function, unicode_literals
from torch import nn
from torch.nn import CrossEntropyLoss, MSELoss
from transformers import RobertaConfig
from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward
fro... | 714 | """simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging
lowerCAmelCase__ : Any = logging.get_logger(__name__)
lowerCAmelCase__ : str = {'ctrl': 'https://huggingface.co/ctrl/resolve/main/config.json'}
class snake_case ( __Up... | 632 | 0 |
"""simple docstring"""
import cva
import numpy as np
class snake_case :
"""simple docstring"""
def __init__( self : Any ,lowerCamelCase__ : float ,lowerCamelCase__ : int ):
if k in (0.0_4, 0.0_6):
UpperCAmelCase__ = k
UpperCAme... | 715 | """simple docstring"""
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | 632 | 0 |
"""simple docstring"""
from __future__ import annotations
lowerCAmelCase__ : Optional[Any] = 1.6021E-19 # units = C
def a_ ( lowerCamelCase , lowerCamelCase , lowerCamelCase , ):
if (conductivity, electron_conc, mobility).count(0 ) != 1:
raise Va... | 716 | """simple docstring"""
def a_ ( lowerCamelCase , lowerCamelCase ):
return x if y == 0 else greatest_common_divisor(lowerCamelCase , x % y )
def a_ ( lowerCamelCase , lowerCamelCase ):
return (x * y) // greatest_common_divisor(lowerCamelCase , lowe... | 632 | 0 |
"""simple docstring"""
from math import pi
def a_ ( lowerCamelCase , lowerCamelCase ):
return 2 * pi * radius * (angle / 3_6_0)
if __name__ == "__main__":
print(arc_length(90, 10))
| 717 | """simple docstring"""
import warnings
from functools import wraps
from typing import Callable
def a_ ( lowerCamelCase ):
@wraps(lowerCamelCase )
def _inner_fn(*lowerCamelCase , **lowerCamelCase ):
warnings.warn(
(f'''\'{fn.__name__}\' is experimental and might ... | 632 | 0 |
"""simple docstring"""
import re
def a_ ( lowerCamelCase ):
return [char.split() for char in re.split(r'[^ a-z A-Z 0-9 \s]' , str_ )]
def a_ ( lowerCamelCase ):
UpperCAmelCase__ = split_input(str_ )
return "".join(
[''.join([char.capitalize() for char in ... | 718 | """simple docstring"""
from __future__ import annotations
import string
from itertools import cycle, product
from pathlib import Path
lowerCAmelCase__ : str = (
string.ascii_letters + string.digits + string.punctuation + string.whitespace
)
lowerCAmelCase__ : list[int] = [ord(l... | 632 | 0 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
lowerCAmelCase__ : Union[str, Any] = logging.get_logger(__name__)
lowerCAmelCase__ : str = {
'naver-clova-ix/donut-base': 'https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json',
... | 719 | """simple docstring"""
import unittest
from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer
from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow
from transformers.utils import cached_property
from ...test_tokenization_co... | 632 | 0 |
"""simple docstring"""
import gc
import random
import unittest
import torch
from diffusers import (
IFImgaImgPipeline,
IFImgaImgSuperResolutionPipeline,
IFInpaintingPipeline,
IFInpaintingSuperResolutionPipeline,
IFPipeline,
IFSuperResolutionPipeline,
)
from diffusers... | 720 | """simple docstring"""
from __future__ import annotations
import collections
import pprint
from pathlib import Path
def a_ ( lowerCamelCase ):
return "".join(sorted(lowerCamelCase ) )
def a_ ( lowerCamelCase ):
return word_by_signature[signature(lowerCamelCase )]
lowerCAme... | 632 | 0 |
"""simple docstring"""
import unittest
import numpy as np
from transformers import RoFormerConfig, is_flax_available
from transformers.testing_utils import require_flax, slow
from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask
if is_flax_available():
import ... | 721 | """simple docstring"""
import os
import sys
from contextlib import contextmanager
# Windows only
if os.name == "nt":
import ctypes
import msvcrt # noqa
class snake_case ( ctypes.Structure ):
"""simple docstring"""
snake_case__ = [("size... | 632 | 0 |
import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple
import sentencepiece as spm
from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer
from ...utils import logging
lowerCAmelCase__ : Any = logging.get_logger(__name__)
lowerCAmelCase__ ... | 700 | """simple docstring"""
import inspect
import tempfile
from collections import OrderedDict, UserDict
from collections.abc import MutableMapping
from contextlib import ExitStack, contextmanager
from dataclasses import fields
from enum import Enum
from typing import Any, ContextManager, List, Tuple
import numpy as ... | 632 | 0 |
"""simple docstring"""
import platform
from argparse import ArgumentParser
import huggingface_hub
from .. import __version__ as version
from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available
from . import BaseDiffusersCLICommand
def a_ ( ... | 701 | """simple docstring"""
import gc
import tempfile
import unittest
import numpy as np
import torch
from diffusers import VersatileDiffusionPipeline
from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device
lowerCAmelCase__ : Union[str, Any] = False
class ... | 632 | 0 |
"""simple docstring"""
import inspect
import unittest
import warnings
from math import ceil, floor
from transformers import LevitConfig
from transformers.file_utils import cached_property, is_torch_available, is_vision_available
from transformers.models.auto import get_values
from transformers.tes... | 702 | """simple docstring"""
from typing import Optional
import numpy as np
import torch
from torch import nn
from transformers import GPTaConfig, GPTaLMHeadModel
from transformers.modeling_utils import ModuleUtilsMixin
from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixi... | 632 | 0 |
"""simple docstring"""
from datetime import datetime as dt
import os
from github import Github
lowerCAmelCase__ : Optional[int] = [
'good first issue',
'good second issue',
'good difficult issue',
'feature request',
'new model',
'wip',
]
def a_ ( ):
Upp... | 703 | """simple docstring"""
import argparse
import os
import jax as jnp
import numpy as onp
import torch
import torch.nn as nn
from music_spectrogram_diffusion import inference
from tax import checkpoints
from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline
from diffusers.pipelines.spe... | 632 | 0 |
import argparse
import requests
import torch
# pip3 install salesforce-lavis
# I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis
from lavis.models import load_model_and_preprocess
from PIL import Image
from transformers import (
AutoTokenizer,... | 704 | """simple docstring"""
import socket
def a_ ( ):
UpperCAmelCase__ = socket.socket(socket.AF_INET , socket.SOCK_STREAM )
UpperCAmelCase__ = socket.gethostname()
UpperCAmelCase__ = 1_2_3_1_2
sock.connect((host, port) )
sock.send(b'Hello server!'... | 632 | 0 |
"""simple docstring"""
from typing import Dict, List, Optional, Union
import numpy as np
from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format
from ...image_utils import (
IMA... | 705 | """simple docstring"""
from __future__ import annotations
class snake_case :
"""simple docstring"""
def __init__( self : Dict ,lowerCamelCase__ : list[list[int]] ):
UpperCAmelCase__ = TypeError(
'Matrices must be formed from a list of z... | 632 | 0 |
"""simple docstring"""
import re
def a_ ( lowerCamelCase ):
if len(re.findall('[ATCG]' , lowerCamelCase ) ) != len(lowerCamelCase ):
raise ValueError('Invalid Strand' )
return dna.translate(dna.maketrans('ATCG' , 'TAGC' ) )
if __name__ == "__main__":
import... | 706 | """simple docstring"""
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
lowerCAmelCase__ : int = {
'configuration_tapas': ['TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TapasConfig'],
'tokenization_tapas': ['... | 632 | 0 |
"""simple docstring"""
from __future__ import annotations
import inspect
import unittest
from typing import List, Tuple
from transformers import RegNetConfig
from transformers.testing_utils import require_tf, require_vision, slow
from transformers.utils import cached_property, is_tf_available, is_vision_avai... | 707 | """simple docstring"""
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
lowerCAmelCase__ : Optional[int] = False
class snake_case ( ... | 632 | 0 |
"""simple docstring"""
import unicodedata
from dataclasses import dataclass
from typing import Optional, Union
import numpy as np
from transformers.data.data_collator import DataCollatorMixin
from transformers.file_utils import PaddingStrategy
from transformers.tokenization_utils_base import PreTrainedTokenizer... | 708 | """simple docstring"""
from __future__ import annotations
from math import ceil, floor, sqrt
def a_ ( lowerCamelCase = 2_0_0_0_0_0_0 ):
UpperCAmelCase__ = [0]
UpperCAmelCase__ = 42
for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ):
triangle_number... | 632 | 0 |
import itertools
import math
def a_ ( lowerCamelCase ):
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
# All primes... | 709 | """simple docstring"""
import argparse
from pathlib import Path
from typing import Dict, OrderedDict, Tuple
import torch
from audiocraft.models import MusicGen
from transformers import (
AutoFeatureExtractor,
AutoTokenizer,
EncodecModel,
MusicgenDecoderConfig,
MusicgenForConditionalGeneratio... | 632 | 0 |
"""simple docstring"""
import json
import os
import unittest
from transformers import DebertaTokenizer, DebertaTokenizerFast
from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES
from transformers.testing_utils import slow
from ...test_tokenization_common import TokenizerTesterMixin
cla... | 710 | """simple docstring"""
lowerCAmelCase__ : Tuple = range(2, 20 + 1)
lowerCAmelCase__ : Optional[Any] = [10**k for k in range(ks[-1] + 1)]
lowerCAmelCase__ : dict[int, dict[int, list[list[int]]]] = {}
def a_ ( lowerCamelCase , lowerCamelCase ,... | 632 | 0 |
"""simple docstring"""
def a_ ( lowerCamelCase , lowerCamelCase , lowerCamelCase=False ):
if isinstance(lowerCamelCase , lowerCamelCase ) and isinstance(lowerCamelCase , lowerCamelCase ):
UpperCAmelCase__ = len(set_a.intersection(lowerCamelCase ) )... | 711 | """simple docstring"""
import random
class snake_case :
"""simple docstring"""
@staticmethod
def __lowerCAmelCase ( lowerCamelCase__ : str ):
UpperCAmelCase__ = [ord(lowerCamelCase__ ) for i in text]
UpperCAmelCase__ = []
... | 632 | 0 |
"""simple docstring"""
import argparse
import json
from typing import List
from ltp import LTP
from transformers.models.bert.tokenization_bert import BertTokenizer
def a_ ( lowerCamelCase ):
# This defines a "chinese character" as anything in the CJK Unicode block:
# https://en.wikipedi... | 712 | """simple docstring"""
import re
def a_ ( lowerCamelCase ):
return [char.split() for char in re.split(r'[^ a-z A-Z 0-9 \s]' , str_ )]
def a_ ( lowerCamelCase ):
UpperCAmelCase__ = split_input(str_ )
return "".join(
[''.join([char.capitalize() for ... | 632 | 0 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_tokenizers_available,
is_torch_available,
is_vision_available,
)
lowerCAmelCase__ : List[Any] = {'processing_layoutxl... | 713 | """simple docstring"""
import shutil
import tempfile
import unittest
import numpy as np
from transformers.testing_utils import (
is_pt_tf_cross_test,
require_tf,
require_torch,
require_torchvision,
require_vision,
)
from transformers.utils import is_tf_available, is_torch_available, is_visio... | 632 | 0 |
"""simple docstring"""
def a_ ( lowerCamelCase = 2_0_0 ):
UpperCAmelCase__ = [1, 2, 5, 1_0, 2_0, 5_0, 1_0_0, 2_0_0]
UpperCAmelCase__ = [0] * (pence + 1)
UpperCAmelCase__ = 1 # base case: 1 way to make 0 pence
for coin in coins:
for i in range(lowerC... | 714 | """simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging
lowerCAmelCase__ : Any = logging.get_logger(__name__)
lowerCAmelCase__ : str = {'ctrl': 'https://huggingface.co/ctrl/resolve/main/config.json'}
class snake_case ( __Up... | 632 | 0 |
"""simple docstring"""
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,
DPMSolverMultiste... | 715 | """simple docstring"""
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | 632 | 0 |
"""simple docstring"""
import importlib
import inspect
import json
import os
import re
import shutil
import sys
from pathlib import Path
from typing import Dict, Optional, Union
from urllib import request
from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info
from packaging import ver... | 716 | """simple docstring"""
def a_ ( lowerCamelCase , lowerCamelCase ):
return x if y == 0 else greatest_common_divisor(lowerCamelCase , x % y )
def a_ ( lowerCamelCase , lowerCamelCase ):
return (x * y) // greatest_common_divisor(lowerCamelCase , lowe... | 632 | 0 |
"""simple docstring"""
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
lowerCAmelCase__ : Union[str, Any] = logging.get_logger(__nam... | 717 | """simple docstring"""
import warnings
from functools import wraps
from typing import Callable
def a_ ( lowerCamelCase ):
@wraps(lowerCamelCase )
def _inner_fn(*lowerCamelCase , **lowerCamelCase ):
warnings.warn(
(f'''\'{fn.__name__}\' is experimental and might ... | 632 | 0 |
"""simple docstring"""
from typing import List, Optional, Tuple, Union
import torch
from ...utils import logging, randn_tensor
from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline
lowerCAmelCase__ : int = logging.get_logger(__name__) # pylint: disable=invalid-name
class s... | 718 | """simple docstring"""
from __future__ import annotations
import string
from itertools import cycle, product
from pathlib import Path
lowerCAmelCase__ : str = (
string.ascii_letters + string.digits + string.punctuation + string.whitespace
)
lowerCAmelCase__ : list[int] = [ord(l... | 632 | 0 |
from manim import *
class snake_case ( __UpperCAmelCase ):
"""simple docstring"""
def __lowerCAmelCase ( self : Any ):
UpperCAmelCase__ = Rectangle(height=0.5 ,width=0.5 )
UpperCAmelCase__ = Rectangle(height=0.2_5 ,width=0.2_... | 719 | """simple docstring"""
import unittest
from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer
from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow
from transformers.utils import cached_property
from ...test_tokenization_co... | 632 | 0 |
"""simple docstring"""
import copy
from ...configuration_utils import PretrainedConfig
from ...utils import logging
lowerCAmelCase__ : Any = logging.get_logger(__name__)
class snake_case ( __UpperCAmelCase ):
"""simple docstring"""
snake_case__... | 720 | """simple docstring"""
from __future__ import annotations
import collections
import pprint
from pathlib import Path
def a_ ( lowerCamelCase ):
return "".join(sorted(lowerCamelCase ) )
def a_ ( lowerCamelCase ):
return word_by_signature[signature(lowerCamelCase )]
lowerCAme... | 632 | 0 |
"""simple docstring"""
import inspect
import tempfile
from collections import OrderedDict, UserDict
from collections.abc import MutableMapping
from contextlib import ExitStack, contextmanager
from dataclasses import fields
from enum import Enum
from typing import Any, ContextManager, List, Tuple
import numpy as ... | 721 | """simple docstring"""
import os
import sys
from contextlib import contextmanager
# Windows only
if os.name == "nt":
import ctypes
import msvcrt # noqa
class snake_case ( ctypes.Structure ):
"""simple docstring"""
snake_case__ = [("size... | 632 | 0 |
import copy
import tempfile
import unittest
from huggingface_hub import HfFolder, delete_repo
from parameterized import parameterized
from requests.exceptions import HTTPError
from transformers import AutoConfig, GenerationConfig
from transformers.testing_utils import TOKEN, USER, is_staging_test
class snake_c... | 700 | """simple docstring"""
import inspect
import tempfile
from collections import OrderedDict, UserDict
from collections.abc import MutableMapping
from contextlib import ExitStack, contextmanager
from dataclasses import fields
from enum import Enum
from typing import Any, ContextManager, List, Tuple
import numpy as ... | 632 | 0 |
"""simple docstring"""
import socket
def a_ ( ):
UpperCAmelCase__ = socket.socket(socket.AF_INET , socket.SOCK_STREAM )
UpperCAmelCase__ = socket.gethostname()
UpperCAmelCase__ = 1_2_3_1_2
sock.connect((host, port) )
sock.send(b'Hello server!'... | 701 | """simple docstring"""
import gc
import tempfile
import unittest
import numpy as np
import torch
from diffusers import VersatileDiffusionPipeline
from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device
lowerCAmelCase__ : Union[str, Any] = False
class ... | 632 | 0 |
"""simple docstring"""
import argparse
from collections import OrderedDict
from pathlib import Path
import requests
import torch
from PIL import Image
from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor
from transformers.utils import logging
logging.set_verbosity... | 702 | """simple docstring"""
from typing import Optional
import numpy as np
import torch
from torch import nn
from transformers import GPTaConfig, GPTaLMHeadModel
from transformers.modeling_utils import ModuleUtilsMixin
from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixi... | 632 | 0 |
"""simple docstring"""
from typing import List, Optional, Tuple
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from ...utils import logging
from .tokenization_herbert import HerbertTokenizer
lowerCAmelCase__ : int = logging.get_logger(__name__)
lowerCAmelCase__ : Optio... | 703 | """simple docstring"""
import argparse
import os
import jax as jnp
import numpy as onp
import torch
import torch.nn as nn
from music_spectrogram_diffusion import inference
from tax import checkpoints
from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline
from diffusers.pipelines.spe... | 632 | 0 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_sentencepiece_available,
is_tokenizers_available,
is_torch_available,
)
lowerCAmelCase__ : Union[str, Any] = {
'configuration_llama': ['LLAMA_PRETRAINED_CONFIG_ARCHIVE_MAP', ... | 704 | """simple docstring"""
import socket
def a_ ( ):
UpperCAmelCase__ = socket.socket(socket.AF_INET , socket.SOCK_STREAM )
UpperCAmelCase__ = socket.gethostname()
UpperCAmelCase__ = 1_2_3_1_2
sock.connect((host, port) )
sock.send(b'Hello server!'... | 632 | 0 |
"""simple docstring"""
from statistics import mean
import numpy as np
def a_ ( lowerCamelCase , lowerCamelCase , lowerCamelCase , lowerCamelCase ):
UpperCAmelCase__ = 0
# Number of processes finished
UpperCAmelCase__ = 0
# Displays the fi... | 705 | """simple docstring"""
from __future__ import annotations
class snake_case :
"""simple docstring"""
def __init__( self : Dict ,lowerCamelCase__ : list[list[int]] ):
UpperCAmelCase__ = TypeError(
'Matrices must be formed from a list of z... | 632 | 0 |
"""simple docstring"""
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 He... | 706 | """simple docstring"""
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
lowerCAmelCase__ : int = {
'configuration_tapas': ['TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TapasConfig'],
'tokenization_tapas': ['... | 632 | 0 |
"""simple docstring"""
import argparse
import os
import platform
import numpy as np
import psutil
import torch
from accelerate import __version__ as version
from accelerate.commands.config import default_config_file, load_config_from_file
from ..utils import is_npu_available, is_xpu_available
def a... | 707 | """simple docstring"""
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
lowerCAmelCase__ : Optional[int] = False
class snake_case ( ... | 632 | 0 |
"""simple docstring"""
import json
import os
import subprocess
import unittest
from ast import literal_eval
import pytest
from parameterized import parameterized, parameterized_class
from . import is_sagemaker_available
if is_sagemaker_available():
from sagemaker import Session, TrainingJobAnalytics
... | 708 | """simple docstring"""
from __future__ import annotations
from math import ceil, floor, sqrt
def a_ ( lowerCamelCase = 2_0_0_0_0_0_0 ):
UpperCAmelCase__ = [0]
UpperCAmelCase__ = 42
for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ):
triangle_number... | 632 | 0 |
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, TensorType, logging
lowerCAmelC... | 709 | """simple docstring"""
import argparse
from pathlib import Path
from typing import Dict, OrderedDict, Tuple
import torch
from audiocraft.models import MusicGen
from transformers import (
AutoFeatureExtractor,
AutoTokenizer,
EncodecModel,
MusicgenDecoderConfig,
MusicgenForConditionalGeneratio... | 632 | 0 |
"""simple docstring"""
import logging
from dataclasses import dataclass, field
from typing import Optional
from seqaseq_trainer import arg_to_scheduler
from transformers import TrainingArguments
lowerCAmelCase__ : Dict = logging.getLogger(__name__)
@dataclass
class snake_case ( __... | 710 | """simple docstring"""
lowerCAmelCase__ : Tuple = range(2, 20 + 1)
lowerCAmelCase__ : Optional[Any] = [10**k for k in range(ks[-1] + 1)]
lowerCAmelCase__ : dict[int, dict[int, list[list[int]]]] = {}
def a_ ( lowerCamelCase , lowerCamelCase ,... | 632 | 0 |
"""simple docstring"""
import json
import logging
import os
import sys
from time import time
from unittest.mock import patch
from transformers.testing_utils import TestCasePlus, require_torch_tpu
logging.basicConfig(level=logging.DEBUG)
lowerCAmelCase__ : Tuple = logging.getLogger()
def ... | 711 | """simple docstring"""
import random
class snake_case :
"""simple docstring"""
@staticmethod
def __lowerCAmelCase ( lowerCamelCase__ : str ):
UpperCAmelCase__ = [ord(lowerCamelCase__ ) for i in text]
UpperCAmelCase__ = []
... | 632 | 0 |
"""simple docstring"""
def a_ ( lowerCamelCase = 5_0 ):
UpperCAmelCase__ = [[0] * 3 for _ in range(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 ):
... | 712 | """simple docstring"""
import re
def a_ ( lowerCamelCase ):
return [char.split() for char in re.split(r'[^ a-z A-Z 0-9 \s]' , str_ )]
def a_ ( lowerCamelCase ):
UpperCAmelCase__ = split_input(str_ )
return "".join(
[''.join([char.capitalize() for ... | 632 | 0 |
"""simple docstring"""
import argparse
import torch
from transformers import OpenAIGPTConfig, OpenAIGPTModel, load_tf_weights_in_openai_gpt
from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging
logging.set_verbosity_info()
def a_ ( lowerCamelCase , lowerCamelCase , l... | 713 | """simple docstring"""
import shutil
import tempfile
import unittest
import numpy as np
from transformers.testing_utils import (
is_pt_tf_cross_test,
require_tf,
require_torch,
require_torchvision,
require_vision,
)
from transformers.utils import is_tf_available, is_torch_available, is_visio... | 632 | 0 |
"""simple docstring"""
import itertools
import random
import unittest
import numpy as np
from transformers import BatchFeature, SpeechTaFeatureExtractor
from transformers.testing_utils import require_torch
from transformers.utils.import_utils import is_torch_available
from ...test_sequence_feature_extraction_c... | 714 | """simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging
lowerCAmelCase__ : Any = logging.get_logger(__name__)
lowerCAmelCase__ : str = {'ctrl': 'https://huggingface.co/ctrl/resolve/main/config.json'}
class snake_case ( __Up... | 632 | 0 |
"""simple docstring"""
from __future__ import annotations
import unittest
from transformers import is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow
if is_tf_available():
import numpy as np
import tensorflow as tf
from transfo... | 715 | """simple docstring"""
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | 632 | 0 |
"""simple docstring"""
import unittest
import numpy as np
from transformers.testing_utils import require_pytesseract, require_torch
from transformers.utils import is_pytesseract_available, is_torch_available
from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs
if i... | 716 | """simple docstring"""
def a_ ( lowerCamelCase , lowerCamelCase ):
return x if y == 0 else greatest_common_divisor(lowerCamelCase , x % y )
def a_ ( lowerCamelCase , lowerCamelCase ):
return (x * y) // greatest_common_divisor(lowerCamelCase , lowe... | 632 | 0 |
"""simple docstring"""
from copy import deepcopy
class snake_case :
"""simple docstring"""
def __init__( self : Dict ,lowerCamelCase__ : list[int] | None = None ,lowerCamelCase__ : int | None = None ):
if arr is None and size is not None:
... | 717 | """simple docstring"""
import warnings
from functools import wraps
from typing import Callable
def a_ ( lowerCamelCase ):
@wraps(lowerCamelCase )
def _inner_fn(*lowerCamelCase , **lowerCamelCase ):
warnings.warn(
(f'''\'{fn.__name__}\' is experimental and might ... | 632 | 0 |
"""simple docstring"""
import tempfile
import torch
from diffusers import PNDMScheduler
from .test_schedulers import SchedulerCommonTest
class snake_case ( __UpperCAmelCase ):
"""simple docstring"""
snake_case__ = (PNDMScheduler,)
snake_case__ = (... | 718 | """simple docstring"""
from __future__ import annotations
import string
from itertools import cycle, product
from pathlib import Path
lowerCAmelCase__ : str = (
string.ascii_letters + string.digits + string.punctuation + string.whitespace
)
lowerCAmelCase__ : list[int] = [ord(l... | 632 | 0 |
import json
import os
import tempfile
from transformers.testing_utils import check_json_file_has_correct_format
class snake_case :
"""simple docstring"""
snake_case__ = None
def __lowerCAmelCase ( self : Optional[int] ):
UpperCAmelCase__ = ... | 719 | """simple docstring"""
import unittest
from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer
from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow
from transformers.utils import cached_property
from ...test_tokenization_co... | 632 | 0 |
"""simple docstring"""
import gc
import tempfile
import unittest
import numpy as np
import torch
from diffusers import VersatileDiffusionPipeline
from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device
lowerCAmelCase__ : Union[str, Any] = ... | 720 | """simple docstring"""
from __future__ import annotations
import collections
import pprint
from pathlib import Path
def a_ ( lowerCamelCase ):
return "".join(sorted(lowerCamelCase ) )
def a_ ( lowerCamelCase ):
return word_by_signature[signature(lowerCamelCase )]
lowerCAme... | 632 | 0 |
"""simple docstring"""
def a_ ( lowerCamelCase , lowerCamelCase ):
UpperCAmelCase__ = len(lowerCamelCase )
print('The following activities are selected:' )
# The first activity is always selected
UpperCAmelCase__ = 0
print(lowerCamelCase , end=','... | 721 | """simple docstring"""
import os
import sys
from contextlib import contextmanager
# Windows only
if os.name == "nt":
import ctypes
import msvcrt # noqa
class snake_case ( ctypes.Structure ):
"""simple docstring"""
snake_case__ = [("size... | 632 | 0 |
from __future__ import annotations
# This is the precision for this function which can be altered.
# It is recommended for users to keep this number greater than or equal to 10.
lowerCAmelCase__ : str = 10
def a_ ( lowerCamelCase , lowerCamelCase , lowerCamelCase , ... | 700 | """simple docstring"""
import inspect
import tempfile
from collections import OrderedDict, UserDict
from collections.abc import MutableMapping
from contextlib import ExitStack, contextmanager
from dataclasses import fields
from enum import Enum
from typing import Any, ContextManager, List, Tuple
import numpy as ... | 632 | 0 |
"""simple docstring"""
import unittest
import numpy as np
from transformers import RobertaPreLayerNormConfig, is_flax_available
from transformers.testing_utils import require_flax, slow
from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask
if is_flax_... | 701 | """simple docstring"""
import gc
import tempfile
import unittest
import numpy as np
import torch
from diffusers import VersatileDiffusionPipeline
from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device
lowerCAmelCase__ : Union[str, Any] = False
class ... | 632 | 0 |
"""simple docstring"""
from __future__ import annotations
class snake_case :
"""simple docstring"""
def __init__( self : Dict ,lowerCamelCase__ : list[list[int]] ):
UpperCAmelCase__ = TypeError(
'Matrices must be formed... | 702 | """simple docstring"""
from typing import Optional
import numpy as np
import torch
from torch import nn
from transformers import GPTaConfig, GPTaLMHeadModel
from transformers.modeling_utils import ModuleUtilsMixin
from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixi... | 632 | 0 |
"""simple docstring"""
import os
import re
from shutil import copyfile
from typing import List, Optional, Tuple
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging
lowerCAmelCase__ : Tuple = logging.get_logger(__name__)
lowerCAmelCase__ : Tuple = {
... | 703 | """simple docstring"""
import argparse
import os
import jax as jnp
import numpy as onp
import torch
import torch.nn as nn
from music_spectrogram_diffusion import inference
from tax import checkpoints
from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline
from diffusers.pipelines.spe... | 632 | 0 |
import math
import os
import re
import sys
import unittest
from pathlib import Path
from typing import Tuple
from unittest.mock import patch
from parameterized import parameterized
from transformers.testing_utils import (
CaptureStderr,
ExtendSysPath,
TestCasePlus,
execute_subprocess_async,
get_gp... | 704 | """simple docstring"""
import socket
def a_ ( ):
UpperCAmelCase__ = socket.socket(socket.AF_INET , socket.SOCK_STREAM )
UpperCAmelCase__ = socket.gethostname()
UpperCAmelCase__ = 1_2_3_1_2
sock.connect((host, port) )
sock.send(b'Hello server!'... | 632 | 0 |
"""simple docstring"""
def a_ ( lowerCamelCase ):
UpperCAmelCase__ = current_set.copy()
for row_index, row in enumerate(lowerCamelCase ):
UpperCAmelCase__ = row[0]
for column_index, column in enumerate(lowerCamelCase ):
if magnitude == 0:
... | 705 | """simple docstring"""
from __future__ import annotations
class snake_case :
"""simple docstring"""
def __init__( self : Dict ,lowerCamelCase__ : list[list[int]] ):
UpperCAmelCase__ = TypeError(
'Matrices must be formed from a list of z... | 632 | 0 |
"""simple docstring"""
import sacrebleu as scb
from packaging import version
from sacrebleu import TER
import datasets
lowerCAmelCase__ : str = '\\n@inproceedings{snover-etal-2006-study,\n title = "A Study of Translation Edit Rate with Targeted Human Annotation",\n author = "Snover, Matthe... | 706 | """simple docstring"""
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
lowerCAmelCase__ : int = {
'configuration_tapas': ['TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TapasConfig'],
'tokenization_tapas': ['... | 632 | 0 |
"""simple docstring"""
from typing import Dict, List, Optional, Union
import numpy as np
from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict
from ...image_transforms import (
center_crop,
convert_to_rgb,
get_resize_output_image_size,
normalize,
rescale,
... | 707 | """simple docstring"""
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
lowerCAmelCase__ : Optional[int] = False
class snake_case ( ... | 632 | 0 |
"""simple docstring"""
import argparse
import re
import numpy as np
import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from transformers import (
SamConfig,
SamImageProcessor,
SamModel,
SamProcessor,
SamVisionConfig,
)
lowerCAmelCase__ : ... | 708 | """simple docstring"""
from __future__ import annotations
from math import ceil, floor, sqrt
def a_ ( lowerCamelCase = 2_0_0_0_0_0_0 ):
UpperCAmelCase__ = [0]
UpperCAmelCase__ = 42
for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ):
triangle_number... | 632 | 0 |
import tempfile
import unittest
from transformers import TaConfig, is_torch_available
from transformers.testing_utils import (
require_sentencepiece,
require_tokenizers,
require_torch,
slow,
torch_device,
)
from ...generation.test_utils import GenerationTesterMixin
from ...test_modeling_common imp... | 709 | """simple docstring"""
import argparse
from pathlib import Path
from typing import Dict, OrderedDict, Tuple
import torch
from audiocraft.models import MusicGen
from transformers import (
AutoFeatureExtractor,
AutoTokenizer,
EncodecModel,
MusicgenDecoderConfig,
MusicgenForConditionalGeneratio... | 632 | 0 |
"""simple docstring"""
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tokenizers_available,
is_torch_available,
is_vision_available,
)
lowerCAmelCase__ : int = {
'configuration_layoutlmv2': ['LAYOUTLMV2_PRETRAIN... | 710 | """simple docstring"""
lowerCAmelCase__ : Tuple = range(2, 20 + 1)
lowerCAmelCase__ : Optional[Any] = [10**k for k in range(ks[-1] + 1)]
lowerCAmelCase__ : dict[int, dict[int, list[list[int]]]] = {}
def a_ ( lowerCamelCase , lowerCamelCase ,... | 632 | 0 |
"""simple docstring"""
import os
import zipfile
import requests
from get_ci_error_statistics import download_artifact, get_artifacts_links
def a_ ( lowerCamelCase , lowerCamelCase=7 ):
UpperCAmelCase__ = None
if token is not None:
UpperCAmelCase__ = {'Acce... | 711 | """simple docstring"""
import random
class snake_case :
"""simple docstring"""
@staticmethod
def __lowerCAmelCase ( lowerCamelCase__ : str ):
UpperCAmelCase__ = [ord(lowerCamelCase__ ) for i in text]
UpperCAmelCase__ = []
... | 632 | 0 |
"""simple docstring"""
import unittest
from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast
from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow
from ...test_tokenization_common import TokenizerTesterMixin
lowerCAmelCase__ : int = ... | 712 | """simple docstring"""
import re
def a_ ( lowerCamelCase ):
return [char.split() for char in re.split(r'[^ a-z A-Z 0-9 \s]' , str_ )]
def a_ ( lowerCamelCase ):
UpperCAmelCase__ = split_input(str_ )
return "".join(
[''.join([char.capitalize() for ... | 632 | 0 |
"""simple docstring"""
import argparse
import logging
import os
from datetime import datetime
import numpy as np
import torch
from torch import nn
from torch.utils.data import DataLoader, RandomSampler, TensorDataset
from tqdm import tqdm
from transformers import GPTaLMHeadModel
lowerCAmelCase__ : s... | 713 | """simple docstring"""
import shutil
import tempfile
import unittest
import numpy as np
from transformers.testing_utils import (
is_pt_tf_cross_test,
require_tf,
require_torch,
require_torchvision,
require_vision,
)
from transformers.utils import is_tf_available, is_torch_available, is_visio... | 632 | 0 |
"""simple docstring"""
from __future__ import annotations
import string
from itertools import cycle, product
from pathlib import Path
lowerCAmelCase__ : str = (
string.ascii_letters + string.digits + string.punctuation + string.whitespace
)
lowerCAmelCase__ : list[int] = [ord(l... | 714 | """simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging
lowerCAmelCase__ : Any = logging.get_logger(__name__)
lowerCAmelCase__ : str = {'ctrl': 'https://huggingface.co/ctrl/resolve/main/config.json'}
class snake_case ( __Up... | 632 | 0 |
"""simple docstring"""
from collections import OrderedDict
from typing import TYPE_CHECKING, Any, List, Mapping, Optional
from packaging import version
if TYPE_CHECKING:
from ... import PreTrainedTokenizer, TensorType
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfigWith... | 715 | """simple docstring"""
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | 632 | 0 |
"""simple docstring"""
def a_ ( lowerCamelCase ):
if not isinstance(lowerCamelCase , lowerCamelCase ):
raise TypeError('only integers accepted as input' )
else:
UpperCAmelCase__ = str(abs(lowerCamelCase ) )
UpperCAmelCase__ = [list(lowerCamelC... | 716 | """simple docstring"""
def a_ ( lowerCamelCase , lowerCamelCase ):
return x if y == 0 else greatest_common_divisor(lowerCamelCase , x % y )
def a_ ( lowerCamelCase , lowerCamelCase ):
return (x * y) // greatest_common_divisor(lowerCamelCase , lowe... | 632 | 0 |
"""simple docstring"""
from __future__ import annotations
def a_ ( lowerCamelCase ):
# preprocessing the first row
for i in range(1 , len(matrix[0] ) ):
matrix[0][i] += matrix[0][i - 1]
# preprocessing the first column
for i in range(1 , len(lowerCamelCase ... | 717 | """simple docstring"""
import warnings
from functools import wraps
from typing import Callable
def a_ ( lowerCamelCase ):
@wraps(lowerCamelCase )
def _inner_fn(*lowerCamelCase , **lowerCamelCase ):
warnings.warn(
(f'''\'{fn.__name__}\' is experimental and might ... | 632 | 0 |
"""simple docstring"""
def a_ ( lowerCamelCase = 6_0_0_8_5_1_4_7_5_1_4_3 ):
try:
UpperCAmelCase__ = int(lowerCamelCase )
except (TypeError, ValueError):
raise TypeError('Parameter n must be int or castable to int.' )
if n <= 0:
raise ValueError('Parameter n must be greater ... | 718 | """simple docstring"""
from __future__ import annotations
import string
from itertools import cycle, product
from pathlib import Path
lowerCAmelCase__ : str = (
string.ascii_letters + string.digits + string.punctuation + string.whitespace
)
lowerCAmelCase__ : list[int] = [ord(l... | 632 | 0 |
import argparse
import os
import jax as jnp
import numpy as onp
import torch
import torch.nn as nn
from music_spectrogram_diffusion import inference
from tax import checkpoints
from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline
from diffusers.pipelines.spectrogram_diffusion import Spe... | 719 | """simple docstring"""
import unittest
from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer
from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow
from transformers.utils import cached_property
from ...test_tokenization_co... | 632 | 0 |
"""simple docstring"""
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 transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel
... | 720 | """simple docstring"""
from __future__ import annotations
import collections
import pprint
from pathlib import Path
def a_ ( lowerCamelCase ):
return "".join(sorted(lowerCamelCase ) )
def a_ ( lowerCamelCase ):
return word_by_signature[signature(lowerCamelCase )]
lowerCAme... | 632 | 0 |
"""simple docstring"""
import gc
import unittest
from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline
from diffusers.utils import is_flax_available, load_image, slow
from diffusers.utils.testing_utils import require_flax
if is_flax_available():
import jax
import jax.nump... | 721 | """simple docstring"""
import os
import sys
from contextlib import contextmanager
# Windows only
if os.name == "nt":
import ctypes
import msvcrt # noqa
class snake_case ( ctypes.Structure ):
"""simple docstring"""
snake_case__ = [("size... | 632 | 0 |
def a_ ( lowerCamelCase , lowerCamelCase ):
return int(input_a == input_a == 0 )
def a_ ( ):
print('Truth Table of NOR Gate:' )
print('| Input 1 | Input 2 | Output |' )
print(f'''| 0 | 0 | {nor_gate(0 , 0 )} |''' )
print(f'''| ... | 700 | """simple docstring"""
import inspect
import tempfile
from collections import OrderedDict, UserDict
from collections.abc import MutableMapping
from contextlib import ExitStack, contextmanager
from dataclasses import fields
from enum import Enum
from typing import Any, ContextManager, List, Tuple
import numpy as ... | 632 | 0 |
"""simple docstring"""
def a_ ( lowerCamelCase ):
for i in range(0 , lowerCamelCase ):
for _ in range(0 , n - i - 1 ): # printing spaces
print(' ' , end='' )
for _ in range(0 , i + 1 ): # printing stars
print('* ' , ... | 701 | """simple docstring"""
import gc
import tempfile
import unittest
import numpy as np
import torch
from diffusers import VersatileDiffusionPipeline
from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device
lowerCAmelCase__ : Union[str, Any] = False
class ... | 632 | 0 |
"""simple docstring"""
import random
import unittest
import numpy as np
import torch
from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer
from diffusers import (
AutoencoderKL,
DDIMScheduler,
UNetaDConditionModel,
VideoToVideoSDPipeline,
)
from diffusers.util... | 702 | """simple docstring"""
from typing import Optional
import numpy as np
import torch
from torch import nn
from transformers import GPTaConfig, GPTaLMHeadModel
from transformers.modeling_utils import ModuleUtilsMixin
from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixi... | 632 | 0 |
"""simple docstring"""
import unittest
from dataclasses import dataclass
import pytest
from accelerate.commands.config.config_args import SageMakerConfig
from accelerate.utils import ComputeEnvironment
from accelerate.utils.launch import _convert_nargs_to_dict
@dataclass
class snake_case ( __UpperCAme... | 703 | """simple docstring"""
import argparse
import os
import jax as jnp
import numpy as onp
import torch
import torch.nn as nn
from music_spectrogram_diffusion import inference
from tax import checkpoints
from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline
from diffusers.pipelines.spe... | 632 | 0 |
from typing import Optional
import numpy as np
import torch
from torch import nn
from transformers import GPTaConfig, GPTaLMHeadModel
from transformers.modeling_utils import ModuleUtilsMixin
from ...configuration_utils import ConfigMixin, register_to_config
from ...models import ModelMixin
class snake_case ( ... | 704 | """simple docstring"""
import socket
def a_ ( ):
UpperCAmelCase__ = socket.socket(socket.AF_INET , socket.SOCK_STREAM )
UpperCAmelCase__ = socket.gethostname()
UpperCAmelCase__ = 1_2_3_1_2
sock.connect((host, port) )
sock.send(b'Hello server!'... | 632 | 0 |
"""simple docstring"""
import sys
import warnings
from os.path import abspath, dirname, join
# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
lowerCAmelCase__ : List[str] = abspath(join(... | 705 | """simple docstring"""
from __future__ import annotations
class snake_case :
"""simple docstring"""
def __init__( self : Dict ,lowerCamelCase__ : list[list[int]] ):
UpperCAmelCase__ = TypeError(
'Matrices must be formed from a list of z... | 632 | 0 |
"""simple docstring"""
import unittest
import numpy as np
import torch
from torch import nn
from transformers import (
CLIPImageProcessor,
CLIPTextConfig,
CLIPTextModelWithProjection,
CLIPTokenizer,
CLIPVisionConfig,
CLIPVisionModelWithProjection,
)
from diffusers import KandinskyVaaPrio... | 706 | """simple docstring"""
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
lowerCAmelCase__ : int = {
'configuration_tapas': ['TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TapasConfig'],
'tokenization_tapas': ['... | 632 | 0 |
"""simple docstring"""
import json
import sys
def a_ ( lowerCamelCase , lowerCamelCase ):
with open(lowerCamelCase , encoding='utf-8' ) as f:
UpperCAmelCase__ = json.load(lowerCamelCase )
UpperCAmelCase__ = ['<details>', '<summary>Show updated b... | 707 | """simple docstring"""
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
lowerCAmelCase__ : Optional[int] = False
class snake_case ( ... | 632 | 0 |
"""simple docstring"""
import warnings
from ...utils import logging
from .image_processing_poolformer import PoolFormerImageProcessor
lowerCAmelCase__ : Any = logging.get_logger(__name__)
class snake_case ( __UpperCAmelCase ):
"""simple docstring"""
def __init__( ... | 708 | """simple docstring"""
from __future__ import annotations
from math import ceil, floor, sqrt
def a_ ( lowerCamelCase = 2_0_0_0_0_0_0 ):
UpperCAmelCase__ = [0]
UpperCAmelCase__ = 42
for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ):
triangle_number... | 632 | 0 |
from __future__ import annotations
import unittest
from transformers import DebertaVaConfig, is_tf_available
from transformers.testing_utils import require_tf, slow
from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ... | 709 | """simple docstring"""
import argparse
from pathlib import Path
from typing import Dict, OrderedDict, Tuple
import torch
from audiocraft.models import MusicGen
from transformers import (
AutoFeatureExtractor,
AutoTokenizer,
EncodecModel,
MusicgenDecoderConfig,
MusicgenForConditionalGeneratio... | 632 | 0 |
"""simple docstring"""
import argparse
import logging
import os
import time
import timeit
import datasets
import numpy as np
import pycuda.autoinit # noqa: F401
import pycuda.driver as cuda
import tensorrt as trt
import torch
from absl import logging as absl_logging
from accelerate import Accelerator
from datas... | 710 | """simple docstring"""
lowerCAmelCase__ : Tuple = range(2, 20 + 1)
lowerCAmelCase__ : Optional[Any] = [10**k for k in range(ks[-1] + 1)]
lowerCAmelCase__ : dict[int, dict[int, list[list[int]]]] = {}
def a_ ( lowerCamelCase , lowerCamelCase ,... | 632 | 0 |
"""simple docstring"""
from collections import OrderedDict
from ...utils import logging
from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update
from .configuration_auto import CONFIG_MAPPING_NAMES
lowerCAmelCase__ : List[str] = logging.get_logger(__name__)
lowerCAmel... | 711 | """simple docstring"""
import random
class snake_case :
"""simple docstring"""
@staticmethod
def __lowerCAmelCase ( lowerCamelCase__ : str ):
UpperCAmelCase__ = [ord(lowerCamelCase__ ) for i in text]
UpperCAmelCase__ = []
... | 632 | 0 |
"""simple docstring"""
from __future__ import annotations
def a_ ( lowerCamelCase ):
UpperCAmelCase__ = str(lowerCamelCase )
return len(lowerCamelCase ) == 9 and set(lowerCamelCase ) == set('123456789' )
def a_ ( ):
for base_num in range(9_9_9_9 , 4_9_9_9... | 712 | """simple docstring"""
import re
def a_ ( lowerCamelCase ):
return [char.split() for char in re.split(r'[^ a-z A-Z 0-9 \s]' , str_ )]
def a_ ( lowerCamelCase ):
UpperCAmelCase__ = split_input(str_ )
return "".join(
[''.join([char.capitalize() for ... | 632 | 0 |
"""simple docstring"""
def a_ ( lowerCamelCase ):
UpperCAmelCase__ = 1
for i in range(1 , num + 1 ):
fact *= i
return fact
def a_ ( lowerCamelCase ):
UpperCAmelCase__ = 0
while number > 0:
UpperCAmelCase__ = number %... | 713 | """simple docstring"""
import shutil
import tempfile
import unittest
import numpy as np
from transformers.testing_utils import (
is_pt_tf_cross_test,
require_tf,
require_torch,
require_torchvision,
require_vision,
)
from transformers.utils import is_tf_available, is_torch_available, is_visio... | 632 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.