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
"""simple docstring""" import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils impor...
673
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessin...
673
1
"""simple docstring""" from typing import TYPE_CHECKING from ..utils import _LazyModule lowerCAmelCase_ : Optional[Any] = { '''config''': [ '''EXTERNAL_DATA_FORMAT_SIZE_LIMIT''', '''OnnxConfig''', '''OnnxConfigWithPast''', '''OnnxSeq2SeqConfigWithP...
673
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import c...
673
1
"""simple docstring""" import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters lowerCAmelCase_ : str = (7_2_0, 1_2_8_0) # Height, Width lowerCAmelCase_ : Optional[int] = (0.4, 0.6) # if height or w...
673
"""simple docstring""" import socket def _lowerCAmelCase ( ): '''simple docstring''' UpperCAmelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) UpperCAmelCase = socket.gethostname() UpperCAmelCase ...
673
1
"""simple docstring""" import copy from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCAmelCase_ : D...
673
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' return math.sqrt(lowerCAmelCase ) * math.sqrt(lowerCAmelCase ) == num def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' ...
673
1
"""simple docstring""" # Lint as: python3 import sys from collections.abc import Mapping from typing import TYPE_CHECKING, Dict, Optional import numpy as np import pyarrow as pa from .. import config from ..utils.logging import get_logger from ..utils.py_utils import map_nested from .formatting import T...
673
"""simple docstring""" import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def _lowerCAmelCase ( *lowerCAmelCase ): '''simple docstring''' if not isinstance(lowerCAmelCase , lowerCAmelCase ): ...
673
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase_ : Dict = { '''configuration_bigbird_pegasus''': [ '''BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''B...
673
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase = 100 ): '''simple docstring''' UpperCAmelCase = sum(i * i for i in range(1 , n + 1 ) ) UpperCAmelCase = int(math.pow(sum(range(1 , n + 1 ) ...
673
1
"""simple docstring""" import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, Value, load_dataset ...
673
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [0] * len(lowerCAmelCase ) UpperCAmelCase = [] UpperCAmelCase = [1] * len(lowerCAmelCase ) for values...
673
1
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer lowerCAmelCase_ : List[str] = {'''vocab_file''': '''vocab....
673
"""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.org/licenses/LI...
673
1
"""simple docstring""" # limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401 from...
673
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class UpperCamelCase_ ( a_ )...
673
1
"""simple docstring""" import json import os import unittest from transformers.models.ctrl.tokenization_ctrl import VOCAB_FILES_NAMES, CTRLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class UpperCamelCase_ ( a_ , unittest.TestCase ): _A : str ...
673
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase_ : Any = { '''configuration_encodec''': [ '''ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''E...
673
1
"""simple docstring""" import math from collections import defaultdict from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutpu...
673
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
673
1
"""simple docstring""" from __future__ import annotations from numpy import array, cos, cross, floataa, radians, sin from numpy.typing import NDArray def _lowerCAmelCase ( lowerCAmelCase , lowerCAmelCase , lowerCAmelCase = False ): '''simple docstring''' ...
673
"""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.utils import flo...
673
1
"""simple docstring""" import tempfile import unittest import numpy as np from diffusers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionPipeline, PNDMScheduler, ) from diff...
673
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : int = logging.get_logger(__name__) lowerCAmelCase_ : Any = { '''facebook/wav2vec2-base-960h''': '''https:...
673
1
"""simple docstring""" import unittest from transformers import ( MODEL_FOR_CAUSAL_LM_MAPPING, TF_MODEL_FOR_CAUSAL_LM_MAPPING, TextGenerationPipeline, logging, pipeline, ) from transformers.testing_utils import ( CaptureLogger, is_pipeline_test, require_accelerate, req...
673
"""simple docstring""" import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Itera...
673
1
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' if number < 0: raise ValueError("""number must not be negative""" ) return number & (number - 1) == 0 if __name__ == "__main__": import doctest doctest.testmod(...
673
"""simple docstring""" import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow lowerCAmelCase_ : List[str] = False class UpperCamelCase_ ( ...
673
1
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = len(lowerCAmelCase ) UpperCAmelCase = len(matrix[0] ) UpperCAmelCase = min(lowerCAmelCase , lowerCAmel...
673
"""simple docstring""" import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class UpperCamelCase_ : def __init__( self , snake_case__=2 , snake_case__=3 , snake_case__=64 , snake_case__=None ) ...
673
1
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives,...
673
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class UpperCamelCase_ ( nn.Module ): _A : int _A : jnp.dtype = jnp.floataa def UpperCamelCase_ ( self ) -> Dict: """simple docstring""...
673
1
"""simple docstring""" import unittest import numpy as np from transformers import AlbertConfig, 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...
673
"""simple docstring""" from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configura...
673
1
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [0] * len(lowerCAmelCase ) UpperCAmelCase = [] UpperCAmelCase = [1] * len(lowerCAmelCase ) for values...
673
"""simple docstring""" import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_...
673
1
"""simple docstring""" import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import Pa...
673
"""simple docstring""" import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLIComman...
673
1
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mobilebert import MobileBertTokenizer lowerCAmelCase_ : List[Any] ...
673
"""simple docstring""" 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 UpperCamelCase_ : def __init__( self , snake_case__ , s...
673
1
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase = 100 ): '''simple docstring''' UpperCAmelCase = 0 UpperCAmelCase = 0 for i in range(1 , n + 1 ): sum_of_squares += i**2 sum_of_ints ...
673
"""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 DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils im...
673
1
"""simple docstring""" import sys lowerCAmelCase_ : int = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''125406987471585238630507156932909632...
673
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessin...
673
1
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = int(lowerCAmelCase ) if n_element < 1: UpperCAmelCase = ValueError("""a should be a positive number""" ) ...
673
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import c...
673
1
"""simple docstring""" import unittest import torch from torch import nn from accelerate.test_utils import require_cuda from accelerate.utils.memory import find_executable_batch_size, release_memory def _lowerCAmelCase ( ): '''simple docstring''' raise RuntimeError(...
673
"""simple docstring""" import socket def _lowerCAmelCase ( ): '''simple docstring''' UpperCAmelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) UpperCAmelCase = socket.gethostname() UpperCAmelCase ...
673
1
"""simple docstring""" import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class UpperCamelCase_ ( a_ ): @require_torch def UpperCamelCase_ ( self ) ->...
673
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' return math.sqrt(lowerCAmelCase ) * math.sqrt(lowerCAmelCase ) == num def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' ...
673
1
"""simple docstring""" import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.models.bert.configurat...
673
"""simple docstring""" import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def _lowerCAmelCase ( *lowerCAmelCase ): '''simple docstring''' if not isinstance(lowerCAmelCase , lowerCAmelCase ): ...
673
1
"""simple docstring""" # # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_node 2...
673
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase = 100 ): '''simple docstring''' UpperCAmelCase = sum(i * i for i in range(1 , n + 1 ) ) UpperCAmelCase = int(math.pow(sum(range(1 , n + 1 ) ...
673
1
"""simple docstring""" import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import...
673
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [0] * len(lowerCAmelCase ) UpperCAmelCase = [] UpperCAmelCase = [1] * len(lowerCAmelCase ) for values...
673
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase_ : List[Any] ...
673
"""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.org/licenses/LI...
673
1
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' return math.sqrt(lowerCAmelCase ) * math.sqrt(lowerCAmelCase ) == num def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' ...
673
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class UpperCamelCase_ ( a_ )...
673
1
"""simple docstring""" from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def _lowerCAmelCase ( lowerCAmelCase , lowerCAmelCase , lowerCAmelCase = None ): '''simple docstring''' if ver...
673
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase_ : Any = { '''configuration_encodec''': [ '''ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''E...
673
1
"""simple docstring""" import operator def _lowerCAmelCase ( lowerCAmelCase , lowerCAmelCase = False , lowerCAmelCase = None ): '''simple docstring''' UpperCAmelCase = operator.lt if reverse else operator.gt UpperCAmelCase ...
673
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
673
1
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase = 1000 ): '''simple docstring''' UpperCAmelCase = 2**power UpperCAmelCase = str(lowerCAmelCase ) UpperCAmelCase = list(lowerCAmelCase ) UpperCAme...
673
"""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.utils import flo...
673
1
"""simple docstring""" from __future__ import annotations import os from typing import Any import requests lowerCAmelCase_ : Optional[int] = '''https://api.github.com''' # https://docs.github.com/en/free-pro-team@latest/rest/reference/users#get-the-authenticated-user lowerCAmelCase_...
673
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : int = logging.get_logger(__name__) lowerCAmelCase_ : Any = { '''facebook/wav2vec2-base-960h''': '''https:...
673
1
"""simple docstring""" # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE...
673
"""simple docstring""" import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Itera...
673
1
"""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 transformer...
673
"""simple docstring""" import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow lowerCAmelCase_ : List[str] = False class UpperCamelCase_ ( ...
673
1
"""simple docstring""" # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the con...
673
"""simple docstring""" import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class UpperCamelCase_ : def __init__( self , snake_case__=2 , snake_case__=3 , snake_case__=64 , snake_case__=None ) ...
673
1
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase , lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = len(lowerCAmelCase ) + 1 UpperCAmelCase = len(lowerCAmelCase ) + 1 # dp is a 2d matrix where dp[i][...
673
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class UpperCamelCase_ ( nn.Module ): _A : int _A : jnp.dtype = jnp.floataa def UpperCamelCase_ ( self ) -> Dict: """simple docstring""...
673
1
"""simple docstring""" 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(): fr...
673
"""simple docstring""" from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configura...
673
1
def __lowercase ( snake_case, snake_case, snake_case ): """simple docstring""" return round(float(moles / volume ) * nfactor ) def __lowercase ( snake_case, snake_case, snake_case ): """simple docstring""" return round(float((moles * 0.0821 *...
0
"""simple docstring""" import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_...
673
0
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch if is...
1
"""simple docstring""" import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLIComman...
673
0
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ = logging.get_logger(__name__) UpperCAmelCase_ = {"""ctrl""": """https://huggingface.co/ctrl/resolve/main/config.json"""} class lowerCamelCase__ ( _A): """simple docstring"""...
2
"""simple docstring""" 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 UpperCamelCase_ : def __init__( self , snake_case__ , s...
673
0
'''simple docstring''' from unittest.mock import patch import pyspark from datasets.packaged_modules.spark.spark import ( Spark, SparkExamplesIterable, _generate_iterable_examples, ) from ..utils import ( require_dill_gt_0_3_2, require_not_windows, ) def A_( A...
3
"""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 DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils im...
673
0
"""simple docstring""" # A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and v to...
4
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessin...
673
0
'''simple docstring''' from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline _lowercase = logging.get_log...
5
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import c...
673
0
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
6
"""simple docstring""" import socket def _lowerCAmelCase ( ): '''simple docstring''' UpperCAmelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) UpperCAmelCase = socket.gethostname() UpperCAmelCase ...
673
0
"""simple docstring""" import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class lowercase_ ( unittest.TestCase , __lowerCAmelCase ): '''simple docstring''' def lowerCAmelCase_ ( self : Optional[Any] ): _A ...
7
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' return math.sqrt(lowerCAmelCase ) * math.sqrt(lowerCAmelCase ) == num def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' ...
673
0
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import req...
8
"""simple docstring""" import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def _lowerCAmelCase ( *lowerCAmelCase ): '''simple docstring''' if not isinstance(lowerCAmelCase , lowerCAmelCase ): ...
673
0
import os import string import sys SCREAMING_SNAKE_CASE__ = 1 << 8 SCREAMING_SNAKE_CASE__ = { '''tab''': ord('''\t'''), '''newline''': ord('''\r'''), '''esc''': 2_7, '''up''': 6_5 + ARROW_KEY_FLAG, '''down''': 6_6 + ARROW_KEY_FLAG, '''right''': 6_7 + ARROW_KEY_FLAG, '''l...
9
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase = 100 ): '''simple docstring''' UpperCAmelCase = sum(i * i for i in range(1 , n + 1 ) ) UpperCAmelCase = int(math.pow(sum(range(1 , n + 1 ) ...
673
0
import sys from collections import defaultdict class lowerCAmelCase_ : def __init__( self : Optional[int] ): _UpperCamelCase = [] def UpperCamelCase_ ( self : Any , _A : str ): return self.node_position[verte...
10
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [0] * len(lowerCAmelCase ) UpperCAmelCase = [] UpperCAmelCase = [1] * len(lowerCAmelCase ) for values...
673
0
'''simple docstring''' import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPP...
11
"""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.org/licenses/LI...
673
0
import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class _snake_case ( unittest.TestCase ): def lowercase__ ( self): ...
12
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class UpperCamelCase_ ( a_ )...
673
0
'''simple docstring''' def UpperCAmelCase__ ( UpperCAmelCase_ : int , UpperCAmelCase_ : int ) -> str: if a < 0 or b < 0: raise ValueError('the value of both inputs must be positive' ) __lowerCamelCase : int = str(bin...
13
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase_ : Any = { '''configuration_encodec''': [ '''ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''E...
673
0
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def __UpperCAmelCase ( ) -> None: """simple docstring""" print('''Making key files...''' ) make_key_files('''r...
14
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
673
0
def UpperCamelCase ( __magic_name__ : int , __magic_name__ : int ) -> str: """simple docstring""" if a < 0 or b < 0: raise ValueError("""the value of both inputs must be positive""" ) lowercase__ = str(bin(__magic_name__ ) )[2:] # remove the lea...
15
"""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.utils import flo...
673
0
import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class _SCREAMING_SNAKE_CASE ( unittest.TestCase ): ...
16
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : int = logging.get_logger(__name__) lowerCAmelCase_ : Any = { '''facebook/wav2vec2-base-960h''': '''https:...
673
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase_ : Any = { '''configuration_data2vec_audio''': ['''DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Data2VecAudioConfig'''], '''configuratio...
17
"""simple docstring""" import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Itera...
673
0
'''simple docstring''' from __future__ import annotations class lowerCAmelCase_ : def __init__( self , _lowerCAmelCase ) -> None: _lowerCAmelCase = data _lowerCAmelCase = None _lowerCAmelCase = None def __a(SCREAMING_S...
18
"""simple docstring""" import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow lowerCAmelCase_ : List[str] = False class UpperCamelCase_ ( ...
673
0
"""simple docstring""" import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils impo...
19
"""simple docstring""" import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class UpperCamelCase_ : def __init__( self , snake_case__=2 , snake_case__=3 , snake_case__=64 , snake_case__=None ) ...
673
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowerCAmelCase: Union[str, Any] = { 'configuration_roformer': ['ROFORMER_PRETRAINED_...
20
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class UpperCamelCase_ ( nn.Module ): _A : int _A : jnp.dtype = jnp.floataa def UpperCamelCase_ ( self ) -> Dict: """simple docstring""...
673
0
from __future__ import annotations def lowerCAmelCase_ ( lowerCamelCase , lowerCamelCase ): __magic_name__ : Tuple =sorted(numsa + numsa ) __magic_name__ , __magic_name__ : Optional[Any] =divmod(len(lowerCamelCase ) , 2 ) i...
21
"""simple docstring""" from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configura...
673
0
'''simple docstring''' import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _snake_case : Union[str, Any] = logging.get_logger(__name__) _snake_case : Optional[int] = { 'asapp/sew-d-tiny-100k': 'https://hug...
22
"""simple docstring""" import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_...
673
0
import copy from typing import TYPE_CHECKING, Any, Mapping, Optional, OrderedDict from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ..auto.configuration_auto import AutoConfig if TYPE_CHECKING: ...
23
"""simple docstring""" import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLIComman...
673
0
'''simple docstring''' import unittest import torch from diffusers import VQModel from diffusers.utils import floats_tensor, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNetTesterMixin enable_full_determinism() clas...
24
"""simple docstring""" 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 UpperCamelCase_ : def __init__( self , snake_case__ , s...
673
0
import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def lowerCamelCase__ ( _a): SCREAMING_SNAKE_CASE : Optional[Any] = [ "encoder.version", "decoder.version", "model.encoder.version", "model.decoder.vers...
25
"""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 DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils im...
673
0
'''simple docstring''' from typing import List, Optional, Union import numpy as np from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging __UpperCamelCa...
26
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessin...
673
0
import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset __A : Union[str, Any] = {1: (1, 1), 2: (2, 1), 3: (3, 1), 4: (2, ...
27
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import c...
673
0
'''simple docstring''' import logging import os import quant_trainer import torch from torch.utils.data import DataLoader from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput UpperCamelCase_ = logging.getLogger(__name__) ...
28
"""simple docstring""" import socket def _lowerCAmelCase ( ): '''simple docstring''' UpperCAmelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) UpperCAmelCase = socket.gethostname() UpperCAmelCase ...
673
0
"""simple docstring""" import os import re import sys import traceback import warnings from pathlib import Path from typing import Dict, Optional, Union from uuid import uuida from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami from huggingface_hub.file_download import REGEX_COMM...
29
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' return math.sqrt(lowerCAmelCase ) * math.sqrt(lowerCAmelCase ) == num def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' ...
673
0
import colorsys from PIL import Image # type: ignore def lowerCamelCase__ ( _lowercase , _lowercase , _lowercase ): '''simple docstring''' UpperCAmelCase_ : Union[str, Any] = x UpperCAmelCase_ : List[str] = y for step in range(_lowercase ): # ...
30
"""simple docstring""" import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def _lowerCAmelCase ( *lowerCAmelCase ): '''simple docstring''' if not isinstance(lowerCAmelCase , lowerCAmelCase ): ...
673
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ : str = logging.get_logger(__name__) lowerCamelCase__ : Tuple = { 'funnel-transformer/small': 'https://huggingface.co/funnel-transformer/small/resolve/main/config.json', ...
31
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase = 100 ): '''simple docstring''' UpperCAmelCase = sum(i * i for i in range(1 , n + 1 ) ) UpperCAmelCase = int(math.pow(sum(range(1 , n + 1 ) ...
673
0
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils im...
32
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [0] * len(lowerCAmelCase ) UpperCAmelCase = [] UpperCAmelCase = [1] * len(lowerCAmelCase ) for values...
673
0
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers fr...
33
"""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.org/licenses/LI...
673
0
"""simple docstring""" import random class snake_case_ : """simple docstring""" @staticmethod def UpperCAmelCase__ ( lowerCamelCase_) -> tuple[list[int], list[int]]: UpperCamelCase = [ord(lowerCamelCase_) for i in text] UpperCamelCase ...
34
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class UpperCamelCase_ ( a_ )...
673
0
from __future__ import annotations def a ( A__ ) -> bool: '''simple docstring''' SCREAMING_SNAKE_CASE__ : Union[str, Any] = str(A__ ) return len(A__ ) == 9 and set(A__ ) == set('''123456789''' ) def a ( ) -> int | No...
35
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase_ : Any = { '''configuration_encodec''': [ '''ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''E...
673
0
from __future__ import annotations import math class _A : '''simple docstring''' def __init__( self ,SCREAMING_SNAKE_CASE_ ): '''simple docstring''' snake_case : Dict = size # approximate the overall size of segment tree with given value snake_ca...
36
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
673
0
import unittest import numpy as np from transformers.testing_utils import is_flaky, require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): i...
37
"""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.utils import flo...
673
0
'''simple docstring''' import math def UpperCamelCase__ ( __magic_name__ : int ) -> int: '''simple docstring''' if not isinstance(__magic_name__ , __magic_name__ ): snake_case__ : Union[str, Any] = f"Input value of [number={number}] must be an i...
38
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ : int = logging.get_logger(__name__) lowerCAmelCase_ : Any = { '''facebook/wav2vec2-base-960h''': '''https:...
673
0
import tempfile import unittest from make_student import create_student_by_copying_alternating_layers from transformers import AutoConfig from transformers.file_utils import cached_property from transformers.testing_utils import require_torch lowerCAmelCase_ = '''sshleifer/bart-tiny-rando...
39
"""simple docstring""" import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Itera...
673
0
import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFAutoModel, is_tensorflow_text_available, is_tf_available from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.testing_utils import require_tensorflow_text, requi...
40
"""simple docstring""" import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow lowerCAmelCase_ : List[str] = False class UpperCamelCase_ ( ...
673
0
'''simple docstring''' import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class lowercase_ (lowerCamelCase__ ): """simple docstring""" SCREAMING_SNAKE_CASE : Dict = (DDPMScheduler,) def SCREAMING_SNAK...
41
"""simple docstring""" import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class UpperCamelCase_ : def __init__( self , snake_case__=2 , snake_case__=3 , snake_case__=64 , snake_case__=None ) ...
673
0
'''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 # ...
42
"""simple docstring""" import flax.linen as nn import jax import jax.numpy as jnp class UpperCamelCase_ ( nn.Module ): _A : int _A : jnp.dtype = jnp.floataa def UpperCamelCase_ ( self ) -> Dict: """simple docstring""...
673
0
def _a ( SCREAMING_SNAKE_CASE = 10_00 ): """simple docstring""" lowercase__ = 2**power lowercase__ = str(SCREAMING_SNAKE_CASE ) lowercase__ = list(SCREAMING_SNAKE_CASE ) lowercase__ = 0 for i in list_num: sum_of_num += int(SCREAMING_SNAKE_CASE ) retur...
43
"""simple docstring""" from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configura...
673
0
'''simple docstring''' def A_ ( _lowerCAmelCase : Optional[int] ): """simple docstring""" _lowerCamelCase : int = len(_lowerCAmelCase ) _lowerCamelCase : Dict = sum(_lowerCAmelCase ) _lowerCamelCase : List[Any] = [[False for x i...
44
"""simple docstring""" import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_...
673
0
import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin UpperCamelCase = get_tests_dir("fixtures/test_sentencepiece_with_bytefallback.m...
45
"""simple docstring""" import os from argparse import ArgumentParser, Namespace from ..data import SingleSentenceClassificationProcessor as Processor from ..pipelines import TextClassificationPipeline from ..utils import is_tf_available, is_torch_available, logging from . import BaseTransformersCLIComman...
673
0
"""simple docstring""" from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def lowerCamelCase_( _lowerCamelCase ) -> Tuple: '''simple docstring''' def is_in_circle(_lowerCamelCase , _lowerCamelCase ...
46
"""simple docstring""" 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 UpperCamelCase_ : def __init__( self , snake_case__ , s...
673
0
import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class _UpperCamelCase( __lowerCamelCase ): __SCREAMING_SNAKE_CASE : Any = '''MCTCTFeatureExtractor''' __SCREAMING_SNAKE_CASE : Tuple = ...
47
"""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 DeiTConfig, DeiTForImageClassificationWithTeacher, DeiTImageProcessor from transformers.utils im...
673
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import DistilBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, r...
48
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessin...
673
0
"""simple docstring""" import argparse import os import shutil import torch from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer def lowercase__ ( snake_case_ :Tuple ): __UpperCAmelCase = args.pruning_method __UpperCAmelCase ...
49
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import c...
673
0
'''simple docstring''' from collections.abc import Generator def A__ ( ): lowerCamelCase__ , lowerCamelCase__ = 0, 1 while True: lowerCamelCase__ , lowerCamelCase__ = b, a + b yield b def A__ ( __lowerCAmelCa...
50
"""simple docstring""" import socket def _lowerCAmelCase ( ): '''simple docstring''' UpperCAmelCase = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) UpperCAmelCase = socket.gethostname() UpperCAmelCase ...
673
0
'''simple docstring''' def __snake_case ( SCREAMING_SNAKE_CASE_ : str ) -> bool: """simple docstring""" UpperCAmelCase = [int(SCREAMING_SNAKE_CASE_ ) for i in ip_va_address.split('''.''' ) if i.isdigit()] return len(SCREAMING_SNAKE_CASE_ ) == 4 and all(0 <= int(S...
51
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' return math.sqrt(lowerCAmelCase ) * math.sqrt(lowerCAmelCase ) == num def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' ...
673
0
"""simple docstring""" import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE...
52
"""simple docstring""" import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def _lowerCAmelCase ( *lowerCAmelCase ): '''simple docstring''' if not isinstance(lowerCAmelCase , lowerCAmelCase ): ...
673
0
import requests _snake_case : Tuple = '' # <-- Put your OpenWeatherMap appid here! _snake_case : Dict = 'https://api.openweathermap.org/data/2.5/' def a_ ( lowerCAmelCase_ : str = "Chicago", lowerCAmelCase_ : str = APPID ): return reque...
53
"""simple docstring""" import math def _lowerCAmelCase ( lowerCAmelCase = 100 ): '''simple docstring''' UpperCAmelCase = sum(i * i for i in range(1 , n + 1 ) ) UpperCAmelCase = int(math.pow(sum(range(1 , n + 1 ) ...
673
0
from argparse import ArgumentParser from . import BaseTransformersCLICommand def a__ ( lowercase__ ): '''simple docstring''' return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) class A ...
54
"""simple docstring""" def _lowerCAmelCase ( lowerCAmelCase ): '''simple docstring''' UpperCAmelCase = [0] * len(lowerCAmelCase ) UpperCAmelCase = [] UpperCAmelCase = [1] * len(lowerCAmelCase ) for values...
673
0
def UpperCAmelCase ( a_ ) -> list: """simple docstring""" return [ txt[:a] + txt[a].upper() + txt[a + 1 :] for a in range(len(a_ ) ) if txt[a].isalpha() ] if __name__ == "__main__": __import__('doctest').testmod()
55
"""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.org/licenses/LI...
673
0
'''simple docstring''' from __future__ import annotations from typing import Any def _a (lowercase__ : list ) -> int: """simple docstring""" if not postfix_notation: return 0 __snake_case = {'+', '-', '*', '/'} __snake_case = ...
56
"""simple docstring""" from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class UpperCamelCase_ ( a_ )...
673
0
def snake_case (UpperCAmelCase__ ) -> str: if isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(UpperCAmelCase__ , UpperCAmelCase__ ): raise TypeError('\...
57
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase_ : Any = { '''configuration_encodec''': [ '''ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''E...
673
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 __lowerCAmelCase ( __UpperCamelCase :...
58
"""simple docstring""" from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyN...
673
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 __A = logging.get_logger(__name__) class _SCREAMING_SNAKE_CA...
59
"""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.utils import flo...
673
0